Browse Source

feat: 移除前端gifsicle和vite-plugin-imagemin

pull/126/head 7.3.3.2
wangjun 3 years ago
parent
commit
40ef07643f
  1. 20
      templates/abp-vnext-pro-nuget-all/Delete-BIN-OBJ-Folders.bat
  2. 13
      templates/abp-vnext-pro-nuget-all/deploy.bat
  3. 59
      templates/abp-vnext-pro-nuget-all/docker-compose.yml
  4. 2
      templates/abp-vnext-pro-nuget-all/vben28/.env.production
  5. 2
      templates/abp-vnext-pro-nuget-all/vben28/.env.test
  6. 21
      templates/abp-vnext-pro-nuget-all/vben28/Dockerfile
  7. 66
      templates/abp-vnext-pro-nuget-all/vben28/build/vite/plugin/imagemin.ts
  8. 2
      templates/abp-vnext-pro-nuget-all/vben28/build/vite/plugin/index.ts
  9. 4
      templates/abp-vnext-pro-nuget-all/vben28/package.json
  10. 12404
      templates/abp-vnext-pro-nuget-all/vben28/yarn.lock
  11. 20
      templates/abp-vnext-pro-nuget-simplify/Delete-BIN-OBJ-Folders.bat
  12. 11
      templates/abp-vnext-pro-nuget-simplify/deploy.bat
  13. 59
      templates/abp-vnext-pro-nuget-simplify/docker-compose.yml
  14. 2
      templates/abp-vnext-pro-nuget-simplify/vben28/.env.production
  15. 2
      templates/abp-vnext-pro-nuget-simplify/vben28/.env.test
  16. 21
      templates/abp-vnext-pro-nuget-simplify/vben28/Dockerfile
  17. 66
      templates/abp-vnext-pro-nuget-simplify/vben28/build/vite/plugin/imagemin.ts
  18. 2
      templates/abp-vnext-pro-nuget-simplify/vben28/build/vite/plugin/index.ts
  19. 4
      templates/abp-vnext-pro-nuget-simplify/vben28/package.json
  20. 12404
      templates/abp-vnext-pro-nuget-simplify/vben28/yarn.lock
  21. 2
      vben28/.env.production
  22. 2
      vben28/.env.test
  23. 3
      vben28/Dockerfile
  24. 66
      vben28/build/vite/plugin/imagemin.ts
  25. 2
      vben28/build/vite/plugin/index.ts
  26. 4
      vben28/package.json
  27. 16282
      vben28/pnpm-lock.yaml

20
templates/abp-vnext-pro-nuget-all/Delete-BIN-OBJ-Folders.bat

@ -1,20 +0,0 @@
@ECHO off
cls
ECHO Deleting all BIN and OBJ folders...
ECHO.
FOR /d /r . %%d in (bin,obj) DO (
IF EXIST "%%d" (
ECHO %%d | FIND /I "\node_modules\" > Nul && (
ECHO.Skipping: %%d
) || (
ECHO.Deleting: %%d
rd /s/q "%%d"
)
)
)
ECHO.
ECHO.BIN and OBJ folders have been successfully deleted. Press any key to exit.
pause > nul

13
templates/abp-vnext-pro-nuget-all/deploy.bat

@ -1,13 +0,0 @@
@echo off
@echo build vben28
cd vben28&&pnpm install&&pnpm run build
cd %~dp0
cd ./aspnet-core/src/MyCompanyName.MyProjectName.DbMigrator && dotnet publish -o publish
cd %~dp0
cd ./aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host && dotnet publish -o publish
cd %~dp0
cd %~dp0
cd ./aspnet-core/gateways/\MyCompanyName.MyProjectName.WebGateway && dotnet publish -o publish

59
templates/abp-vnext-pro-nuget-all/docker-compose.yml

@ -1,59 +0,0 @@
version: '3'
services:
mysql:
image: bitnami/mysql:8.0.30
container_name: mysql
restart: always
environment:
MYSQL_ROOT_USER: "root" # 管理员账户名
MYSQL_ROOT_PASSWORD: "1q2w3E*" # 管理员密码
MYSQL_AUTHENTICATION_PLUGIN: "mysql_native_password" # 认证插件
MYSQL_CHARACTER_SET: utf8mb4 # 默认字符集(服务器级别)
MYSQL_COLLATE: utf8mb4_unicode_ci # 默认排序规则(服务器级别)
MYSQL_ENABLE_SLOW_QUERY: 0 # 是否开启慢查询,0:不开启 1:开启
MYSQL_LONG_QUERY_TIME: 5.0 # 慢查询超时时间
ports:
- "3306:3306"
redis:
image: redis:6.2.6
container_name: redis
restart: always
ports:
- 6379:6379
command: ["redis-server", "--appendonly", "yes", "--requirepass","1q2w3E*"]
lion.abp.pro:
build: ./aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host
container_name: lion.abp.pro
restart: always
ports:
- "8080:80"
depends_on:
- mysql
- redis
- lion.abp.pro.migrator
links:
- mysql
- redis
lion.abp.pro.migrator:
build: ./aspnet-core/src/MyCompanyName.MyProjectName.DbMigrator
container_name: lion.abp.pro.migrator
depends_on:
- mysql
links:
- mysql
lion.abp.pro.vben28:
build: ./vben28
container_name: lion.abp.pro.vben28
ports:
- "80:80"
depends_on:
- lion.abp.pro
links:
- lion.abp.pro

2
templates/abp-vnext-pro-nuget-all/vben28/.env.production

@ -26,7 +26,7 @@ VITE_GLOB_UPLOAD_URL=/upload
VITE_GLOB_API_URL_PREFIX= VITE_GLOB_API_URL_PREFIX=
# Whether to enable image compression # Whether to enable image compression
VITE_USE_IMAGEMIN= true VITE_USE_IMAGEMIN= false
# use pwa # use pwa
VITE_USE_PWA = false VITE_USE_PWA = false

2
templates/abp-vnext-pro-nuget-all/vben28/.env.test

@ -27,7 +27,7 @@ VITE_GLOB_UPLOAD_URL=/upload
VITE_GLOB_API_URL_PREFIX= VITE_GLOB_API_URL_PREFIX=
# Whether to enable image compression # Whether to enable image compression
VITE_USE_IMAGEMIN= true VITE_USE_IMAGEMIN= false
# use pwa # use pwa
VITE_USE_PWA = false VITE_USE_PWA = false

21
templates/abp-vnext-pro-nuget-all/vben28/Dockerfile

@ -1,9 +1,18 @@
FROM nginx:1.17.3-alpine as base FROM node:16-alpine as build-stage
EXPOSE 80 WORKDIR /app
COPY . ./
ENV NODE_OPTIONS=--max-old-space-size=16384
RUN npm install pnpm -g
RUN pnpm i
RUN npm run build
COPY /_nginx/nginx.conf /etc/nginx/nginx.conf
COPY /_nginx/env.js /etc/nginx/env.js FROM nginx:1.17.3-alpine as production-stage
COPY /_nginx/default.conf /etc/nginx/conf.d/default.conf COPY --from=build-stage app/_nginx/nginx.conf /etc/nginx/nginx.conf
COPY /dist/ /usr/share/nginx/html COPY --from=build-stage app/_nginx/env.js /etc/nginx/env.js
COPY --from=build-stage app/_nginx/default.conf /etc/nginx/conf.d/default.conf
COPY --from=build-stage app/dist/ /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"] CMD ["nginx", "-g", "daemon off;"]

66
templates/abp-vnext-pro-nuget-all/vben28/build/vite/plugin/imagemin.ts

@ -1,34 +1,34 @@
// Image resource files used to compress the output of the production environment // // Image resource files used to compress the output of the production environment
// https://github.com/anncwb/vite-plugin-imagemin // // https://github.com/anncwb/vite-plugin-imagemin
import viteImagemin from 'vite-plugin-imagemin'; // import viteImagemin from 'vite-plugin-imagemin';
export function configImageminPlugin() { // export function configImageminPlugin() {
const plugin = viteImagemin({ // const plugin = viteImagemin({
gifsicle: { // gifsicle: {
optimizationLevel: 7, // optimizationLevel: 7,
interlaced: false, // interlaced: false,
}, // },
optipng: { // optipng: {
optimizationLevel: 7, // optimizationLevel: 7,
}, // },
mozjpeg: { // mozjpeg: {
quality: 20, // quality: 20,
}, // },
pngquant: { // pngquant: {
quality: [0.8, 0.9], // quality: [0.8, 0.9],
speed: 4, // speed: 4,
}, // },
svgo: { // svgo: {
plugins: [ // plugins: [
{ // {
name: 'removeViewBox', // name: 'removeViewBox',
}, // },
{ // {
name: 'removeEmptyAttrs', // name: 'removeEmptyAttrs',
active: false, // active: false,
}, // },
], // ],
}, // },
}); // });
return plugin; // return plugin;
} // }

2
templates/abp-vnext-pro-nuget-all/vben28/build/vite/plugin/index.ts

@ -67,7 +67,7 @@ export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) {
// The following plugins only work in the production environment // The following plugins only work in the production environment
if (isBuild) { if (isBuild) {
// vite-plugin-imagemin // vite-plugin-imagemin
VITE_USE_IMAGEMIN && vitePlugins.push(configImageminPlugin()); // VITE_USE_IMAGEMIN && vitePlugins.push(configImageminPlugin());
// rollup-plugin-gzip // rollup-plugin-gzip
vitePlugins.push( vitePlugins.push(

4
templates/abp-vnext-pro-nuget-all/vben28/package.json

@ -135,7 +135,6 @@
"vite": "^2.9.5", "vite": "^2.9.5",
"vite-plugin-compression": "^0.5.1", "vite-plugin-compression": "^0.5.1",
"vite-plugin-html": "^3.2.0", "vite-plugin-html": "^3.2.0",
"vite-plugin-imagemin": "^0.6.1",
"vite-plugin-mkcert": "^1.6.0", "vite-plugin-mkcert": "^1.6.0",
"vite-plugin-mock": "^2.9.6", "vite-plugin-mock": "^2.9.6",
"vite-plugin-purge-icons": "^0.8.1", "vite-plugin-purge-icons": "^0.8.1",
@ -150,8 +149,7 @@
}, },
"resolutions": { "resolutions": {
"bin-wrapper": "npm:bin-wrapper-china", "bin-wrapper": "npm:bin-wrapper-china",
"rollup": "^2.56.3", "rollup": "^2.56.3"
"gifsicle": "5.2.0"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

12404
templates/abp-vnext-pro-nuget-all/vben28/yarn.lock

File diff suppressed because it is too large

20
templates/abp-vnext-pro-nuget-simplify/Delete-BIN-OBJ-Folders.bat

@ -1,20 +0,0 @@
@ECHO off
cls
ECHO Deleting all BIN and OBJ folders...
ECHO.
FOR /d /r . %%d in (bin,obj) DO (
IF EXIST "%%d" (
ECHO %%d | FIND /I "\node_modules\" > Nul && (
ECHO.Skipping: %%d
) || (
ECHO.Deleting: %%d
rd /s/q "%%d"
)
)
)
ECHO.
ECHO.BIN and OBJ folders have been successfully deleted. Press any key to exit.
pause > nul

11
templates/abp-vnext-pro-nuget-simplify/deploy.bat

@ -1,11 +0,0 @@
@echo off
@echo build vben28
cd vben28&&pnpm install&&pnpm run build
cd %~dp0
cd ./aspnet-core/src/MyCompanyName.MyProjectName.DbMigrator && dotnet publish -o publish
cd %~dp0
cd ./aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host && dotnet publish -o publish
cd %~dp0

59
templates/abp-vnext-pro-nuget-simplify/docker-compose.yml

@ -1,59 +0,0 @@
version: '3'
services:
mysql:
image: bitnami/mysql:8.0.30
container_name: mysql
restart: always
environment:
MYSQL_ROOT_USER: "root" # 管理员账户名
MYSQL_ROOT_PASSWORD: "1q2w3E*" # 管理员密码
MYSQL_AUTHENTICATION_PLUGIN: "mysql_native_password" # 认证插件
MYSQL_CHARACTER_SET: utf8mb4 # 默认字符集(服务器级别)
MYSQL_COLLATE: utf8mb4_unicode_ci # 默认排序规则(服务器级别)
MYSQL_ENABLE_SLOW_QUERY: 0 # 是否开启慢查询,0:不开启 1:开启
MYSQL_LONG_QUERY_TIME: 5.0 # 慢查询超时时间
ports:
- "3306:3306"
redis:
image: redis:6.2.6
container_name: redis
restart: always
ports:
- 6379:6379
command: ["redis-server", "--appendonly", "yes", "--requirepass","1q2w3E*"]
lion.abp.pro:
build: ./aspnet-core/host/MyCompanyName.MyProjectName.HttpApi.Host
container_name: lion.abp.pro
restart: always
ports:
- "8080:80"
depends_on:
- mysql
- redis
- lion.abp.pro.migrator
links:
- mysql
- redis
lion.abp.pro.migrator:
build: ./aspnet-core/src/MyCompanyName.MyProjectName.DbMigrator
container_name: lion.abp.pro.migrator
depends_on:
- mysql
links:
- mysql
lion.abp.pro.vben28:
build: ./vben28
container_name: lion.abp.pro.vben28
ports:
- "80:80"
depends_on:
- lion.abp.pro
links:
- lion.abp.pro

2
templates/abp-vnext-pro-nuget-simplify/vben28/.env.production

@ -26,7 +26,7 @@ VITE_GLOB_UPLOAD_URL=/upload
VITE_GLOB_API_URL_PREFIX= VITE_GLOB_API_URL_PREFIX=
# Whether to enable image compression # Whether to enable image compression
VITE_USE_IMAGEMIN= true VITE_USE_IMAGEMIN= false
# use pwa # use pwa
VITE_USE_PWA = false VITE_USE_PWA = false

2
templates/abp-vnext-pro-nuget-simplify/vben28/.env.test

@ -27,7 +27,7 @@ VITE_GLOB_UPLOAD_URL=/upload
VITE_GLOB_API_URL_PREFIX= VITE_GLOB_API_URL_PREFIX=
# Whether to enable image compression # Whether to enable image compression
VITE_USE_IMAGEMIN= true VITE_USE_IMAGEMIN= false
# use pwa # use pwa
VITE_USE_PWA = false VITE_USE_PWA = false

21
templates/abp-vnext-pro-nuget-simplify/vben28/Dockerfile

@ -1,9 +1,18 @@
FROM nginx:1.17.3-alpine as base FROM node:16-alpine as build-stage
EXPOSE 80 WORKDIR /app
COPY . ./
ENV NODE_OPTIONS=--max-old-space-size=16384
RUN npm install pnpm -g
RUN pnpm i
RUN npm run build
COPY /_nginx/nginx.conf /etc/nginx/nginx.conf
COPY /_nginx/env.js /etc/nginx/env.js FROM nginx:1.17.3-alpine as production-stage
COPY /_nginx/default.conf /etc/nginx/conf.d/default.conf COPY --from=build-stage app/_nginx/nginx.conf /etc/nginx/nginx.conf
COPY /dist/ /usr/share/nginx/html COPY --from=build-stage app/_nginx/env.js /etc/nginx/env.js
COPY --from=build-stage app/_nginx/default.conf /etc/nginx/conf.d/default.conf
COPY --from=build-stage app/dist/ /usr/share/nginx/html
EXPOSE 80
CMD ["nginx", "-g", "daemon off;"] CMD ["nginx", "-g", "daemon off;"]

66
templates/abp-vnext-pro-nuget-simplify/vben28/build/vite/plugin/imagemin.ts

@ -1,34 +1,34 @@
// Image resource files used to compress the output of the production environment // // Image resource files used to compress the output of the production environment
// https://github.com/anncwb/vite-plugin-imagemin // // https://github.com/anncwb/vite-plugin-imagemin
import viteImagemin from 'vite-plugin-imagemin'; // import viteImagemin from 'vite-plugin-imagemin';
export function configImageminPlugin() { // export function configImageminPlugin() {
const plugin = viteImagemin({ // const plugin = viteImagemin({
gifsicle: { // // gifsicle: {
optimizationLevel: 7, // // optimizationLevel: 7,
interlaced: false, // // interlaced: false,
}, // // },
optipng: { // optipng: {
optimizationLevel: 7, // optimizationLevel: 7,
}, // },
mozjpeg: { // mozjpeg: {
quality: 20, // quality: 20,
}, // },
pngquant: { // pngquant: {
quality: [0.8, 0.9], // quality: [0.8, 0.9],
speed: 4, // speed: 4,
}, // },
svgo: { // svgo: {
plugins: [ // plugins: [
{ // {
name: 'removeViewBox', // name: 'removeViewBox',
}, // },
{ // {
name: 'removeEmptyAttrs', // name: 'removeEmptyAttrs',
active: false, // active: false,
}, // },
], // ],
}, // },
}); // });
return plugin; // return plugin;
} // }

2
templates/abp-vnext-pro-nuget-simplify/vben28/build/vite/plugin/index.ts

@ -67,7 +67,7 @@ export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) {
// The following plugins only work in the production environment // The following plugins only work in the production environment
if (isBuild) { if (isBuild) {
// vite-plugin-imagemin // vite-plugin-imagemin
VITE_USE_IMAGEMIN && vitePlugins.push(configImageminPlugin()); // VITE_USE_IMAGEMIN && vitePlugins.push(configImageminPlugin());
// rollup-plugin-gzip // rollup-plugin-gzip
vitePlugins.push( vitePlugins.push(

4
templates/abp-vnext-pro-nuget-simplify/vben28/package.json

@ -135,7 +135,6 @@
"vite": "^2.9.5", "vite": "^2.9.5",
"vite-plugin-compression": "^0.5.1", "vite-plugin-compression": "^0.5.1",
"vite-plugin-html": "^3.2.0", "vite-plugin-html": "^3.2.0",
"vite-plugin-imagemin": "^0.6.1",
"vite-plugin-mkcert": "^1.6.0", "vite-plugin-mkcert": "^1.6.0",
"vite-plugin-mock": "^2.9.6", "vite-plugin-mock": "^2.9.6",
"vite-plugin-purge-icons": "^0.8.1", "vite-plugin-purge-icons": "^0.8.1",
@ -150,8 +149,7 @@
}, },
"resolutions": { "resolutions": {
"bin-wrapper": "npm:bin-wrapper-china", "bin-wrapper": "npm:bin-wrapper-china",
"rollup": "^2.56.3", "rollup": "^2.56.3"
"gifsicle": "5.2.0"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

12404
templates/abp-vnext-pro-nuget-simplify/vben28/yarn.lock

File diff suppressed because it is too large

2
vben28/.env.production

@ -26,7 +26,7 @@ VITE_GLOB_UPLOAD_URL=/upload
VITE_GLOB_API_URL_PREFIX= VITE_GLOB_API_URL_PREFIX=
# Whether to enable image compression # Whether to enable image compression
VITE_USE_IMAGEMIN= true VITE_USE_IMAGEMIN= false
# use pwa # use pwa
VITE_USE_PWA = false VITE_USE_PWA = false

2
vben28/.env.test

@ -27,7 +27,7 @@ VITE_GLOB_UPLOAD_URL=/upload
VITE_GLOB_API_URL_PREFIX= VITE_GLOB_API_URL_PREFIX=
# Whether to enable image compression # Whether to enable image compression
VITE_USE_IMAGEMIN= true VITE_USE_IMAGEMIN= false
# use pwa # use pwa
VITE_USE_PWA = false VITE_USE_PWA = false

3
vben28/Dockerfile

@ -3,6 +3,9 @@ WORKDIR /app
COPY . ./ COPY . ./
ENV NODE_OPTIONS=--max-old-space-size=16384 ENV NODE_OPTIONS=--max-old-space-size=16384
RUN npm install pnpm -g RUN npm install pnpm -g
# 切换淘宝镜像源
# RUN npm config set registry https://registry.npmmirror.com/
# RUN pnpm config set registry https://registry.npmmirror.com/
RUN pnpm i RUN pnpm i
RUN npm run build RUN npm run build

66
vben28/build/vite/plugin/imagemin.ts

@ -1,34 +1,34 @@
// Image resource files used to compress the output of the production environment // // Image resource files used to compress the output of the production environment
// https://github.com/anncwb/vite-plugin-imagemin // // https://github.com/anncwb/vite-plugin-imagemin
import viteImagemin from 'vite-plugin-imagemin'; // import viteImagemin from 'vite-plugin-imagemin';
export function configImageminPlugin() { // export function configImageminPlugin() {
const plugin = viteImagemin({ // const plugin = viteImagemin({
gifsicle: { // // gifsicle: {
optimizationLevel: 7, // // optimizationLevel: 7,
interlaced: false, // // interlaced: false,
}, // // },
optipng: { // optipng: {
optimizationLevel: 7, // optimizationLevel: 7,
}, // },
mozjpeg: { // mozjpeg: {
quality: 20, // quality: 20,
}, // },
pngquant: { // pngquant: {
quality: [0.8, 0.9], // quality: [0.8, 0.9],
speed: 4, // speed: 4,
}, // },
svgo: { // svgo: {
plugins: [ // plugins: [
{ // {
name: 'removeViewBox', // name: 'removeViewBox',
}, // },
{ // {
name: 'removeEmptyAttrs', // name: 'removeEmptyAttrs',
active: false, // active: false,
}, // },
], // ],
}, // },
}); // });
return plugin; // return plugin;
} // }

2
vben28/build/vite/plugin/index.ts

@ -67,7 +67,7 @@ export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) {
// The following plugins only work in the production environment // The following plugins only work in the production environment
if (isBuild) { if (isBuild) {
// vite-plugin-imagemin // vite-plugin-imagemin
VITE_USE_IMAGEMIN && vitePlugins.push(configImageminPlugin()); // VITE_USE_IMAGEMIN && vitePlugins.push(configImageminPlugin());
// rollup-plugin-gzip // rollup-plugin-gzip
vitePlugins.push( vitePlugins.push(

4
vben28/package.json

@ -135,7 +135,6 @@
"vite": "^2.9.5", "vite": "^2.9.5",
"vite-plugin-compression": "^0.5.1", "vite-plugin-compression": "^0.5.1",
"vite-plugin-html": "^3.2.0", "vite-plugin-html": "^3.2.0",
"vite-plugin-imagemin": "^0.6.1",
"vite-plugin-mkcert": "^1.6.0", "vite-plugin-mkcert": "^1.6.0",
"vite-plugin-mock": "^2.9.6", "vite-plugin-mock": "^2.9.6",
"vite-plugin-purge-icons": "^0.8.1", "vite-plugin-purge-icons": "^0.8.1",
@ -150,8 +149,7 @@
}, },
"resolutions": { "resolutions": {
"bin-wrapper": "npm:bin-wrapper-china", "bin-wrapper": "npm:bin-wrapper-china",
"rollup": "^2.56.3", "rollup": "^2.56.3"
"gifsicle": "5.2.0"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

16282
vben28/pnpm-lock.yaml

File diff suppressed because it is too large
Loading…
Cancel
Save