xiaoxian521
3 years ago
13 changed files with 155 additions and 37 deletions
-
85build/info.ts
-
2build/plugins.ts
-
7package.json
-
59pnpm-lock.yaml
-
4src/layout/components/setting/index.vue
-
2src/layout/components/sidebar/breadCrumb.vue
-
2src/layout/components/tag/index.vue
-
2src/plugins/i18n/index.ts
-
2src/router/index.ts
-
12src/router/utils.ts
-
2src/store/modules/multiTags.ts
-
2src/store/modules/permission.ts
-
11src/style/element-plus.scss
@ -0,0 +1,85 @@ |
|||||
|
import { readdir, stat } from "fs"; |
||||
|
import type { Plugin } from "vite"; |
||||
|
import dayjs, { Dayjs } from "dayjs"; |
||||
|
import { sum } from "lodash-unified"; |
||||
|
import duration from "dayjs/plugin/duration"; |
||||
|
import { green, blue, bold } from "picocolors"; |
||||
|
dayjs.extend(duration); |
||||
|
|
||||
|
const staticPath = "dist"; |
||||
|
const fileListTotal: number[] = []; |
||||
|
|
||||
|
const recursiveDirectory = (folder: string, callback: Function): void => { |
||||
|
readdir(folder, (err, files: string[]) => { |
||||
|
if (err) throw err; |
||||
|
let count = 0; |
||||
|
const checkEnd = () => { |
||||
|
++count == files.length && callback(); |
||||
|
}; |
||||
|
files.forEach((item: string) => { |
||||
|
stat(folder + "/" + item, async (err, stats) => { |
||||
|
if (err) throw err; |
||||
|
if (stats.isFile()) { |
||||
|
fileListTotal.push(stats.size); |
||||
|
checkEnd(); |
||||
|
} else if (stats.isDirectory()) { |
||||
|
recursiveDirectory(`${staticPath}/${item}/`, checkEnd); |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
files.length === 0 && callback(); |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
const formatBytes = (a: number, b?: number): string => { |
||||
|
if (0 == a) return "0 Bytes"; |
||||
|
const c = 1024, |
||||
|
d = b || 2, |
||||
|
e = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"], |
||||
|
f = Math.floor(Math.log(a) / Math.log(c)); |
||||
|
return parseFloat((a / Math.pow(c, f)).toFixed(d)) + " " + e[f]; |
||||
|
}; |
||||
|
|
||||
|
export function viteBuildInfo(): Plugin { |
||||
|
let config: { command: string }; |
||||
|
let startTime: Dayjs; |
||||
|
let endTime: Dayjs; |
||||
|
return { |
||||
|
name: "vite:buildInfo", |
||||
|
configResolved(resolvedConfig: { command: string }) { |
||||
|
config = resolvedConfig; |
||||
|
}, |
||||
|
buildStart() { |
||||
|
if (config.command === "build") { |
||||
|
startTime = dayjs(new Date()); |
||||
|
} |
||||
|
}, |
||||
|
closeBundle() { |
||||
|
if (config.command === "build") { |
||||
|
console.log( |
||||
|
bold( |
||||
|
green( |
||||
|
`👏欢迎使用${blue( |
||||
|
"[vue-pure-admin]" |
||||
|
)},如果您感觉不错,记得点击后面链接给个star哦💖 https://github.com/xiaoxian521/vue-pure-admin`
|
||||
|
) |
||||
|
) |
||||
|
); |
||||
|
endTime = dayjs(new Date()); |
||||
|
recursiveDirectory(staticPath, () => { |
||||
|
console.log( |
||||
|
bold( |
||||
|
green( |
||||
|
`恭喜打包完成🎉(总用时${dayjs |
||||
|
.duration(endTime.diff(startTime)) |
||||
|
.format("mm分ss秒")},打包后的大小为${formatBytes( |
||||
|
sum(fileListTotal) |
||||
|
)})`
|
||||
|
) |
||||
|
) |
||||
|
); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
}; |
||||
|
} |
@ -11,6 +11,7 @@ specifiers: |
|||||
"@iconify/vue": ^3.1.3 |
"@iconify/vue": ^3.1.3 |
||||
"@types/element-resize-detector": 1.1.3 |
"@types/element-resize-detector": 1.1.3 |
||||
"@types/js-cookie": ^3.0.1 |
"@types/js-cookie": ^3.0.1 |
||||
|
"@types/lodash-es": ^4.17.6 |
||||
"@types/mockjs": 1.0.3 |
"@types/mockjs": 1.0.3 |
||||
"@types/node": 14.14.14 |
"@types/node": 14.14.14 |
||||
"@types/nprogress": 0.2.0 |
"@types/nprogress": 0.2.0 |
||||
@ -32,7 +33,7 @@ specifiers: |
|||||
cross-env: 7.0.3 |
cross-env: 7.0.3 |
||||
css-color-function: ^1.3.3 |
css-color-function: ^1.3.3 |
||||
dayjs: ^1.10.7 |
dayjs: ^1.10.7 |
||||
element-plus: ^2.0.2 |
|
||||
|
element-plus: ^2.0.3 |
||||
element-resize-detector: ^1.2.3 |
element-resize-detector: ^1.2.3 |
||||
eslint: ^8.8.0 |
eslint: ^8.8.0 |
||||
eslint-plugin-prettier: ^4.0.0 |
eslint-plugin-prettier: ^4.0.0 |
||||
@ -41,10 +42,12 @@ specifiers: |
|||||
js-cookie: ^3.0.1 |
js-cookie: ^3.0.1 |
||||
lint-staged: 11.1.2 |
lint-staged: 11.1.2 |
||||
lodash-es: ^4.17.21 |
lodash-es: ^4.17.21 |
||||
|
lodash-unified: ^1.0.2 |
||||
mitt: ^3.0.0 |
mitt: ^3.0.0 |
||||
mockjs: ^1.1.0 |
mockjs: ^1.1.0 |
||||
nprogress: ^0.2.0 |
nprogress: ^0.2.0 |
||||
path: ^0.12.7 |
path: ^0.12.7 |
||||
|
picocolors: ^1.0.0 |
||||
pinia: ^2.0.11 |
pinia: ^2.0.11 |
||||
postcss: ^8.4.6 |
postcss: ^8.4.6 |
||||
postcss-html: ^1.3.0 |
postcss-html: ^1.3.0 |
||||
@ -57,7 +60,7 @@ specifiers: |
|||||
responsive-storage: ^1.0.11 |
responsive-storage: ^1.0.11 |
||||
rgb-hex: ^4.0.0 |
rgb-hex: ^4.0.0 |
||||
rimraf: 3.0.2 |
rimraf: 3.0.2 |
||||
rollup-plugin-visualizer: ^5.5.4 |
|
||||
|
rollup-plugin-visualizer: ^5.6.0 |
||||
sass: ^1.49.0 |
sass: ^1.49.0 |
||||
sass-loader: ^12.4.0 |
sass-loader: ^12.4.0 |
||||
stylelint: ^14.3.0 |
stylelint: ^14.3.0 |
||||
@ -91,10 +94,11 @@ dependencies: |
|||||
axios: 0.25.0 |
axios: 0.25.0 |
||||
css-color-function: 1.3.3 |
css-color-function: 1.3.3 |
||||
dayjs: 1.10.7 |
dayjs: 1.10.7 |
||||
element-plus: 2.0.[email protected] |
|
||||
|
element-plus: 2.0.3_1a412d14def5ff5ca1122000e4bee666 |
||||
element-resize-detector: 1.2.4 |
element-resize-detector: 1.2.4 |
||||
js-cookie: 3.0.1 |
js-cookie: 3.0.1 |
||||
lodash-es: 4.17.21 |
lodash-es: 4.17.21 |
||||
|
lodash-unified: 1.0.2_f567d1d3c0c6a67669f03af7a1aa4dad |
||||
mitt: 3.0.0 |
mitt: 3.0.0 |
||||
mockjs: 1.1.0 |
mockjs: 1.1.0 |
||||
nprogress: 0.2.0 |
nprogress: 0.2.0 |
||||
@ -119,6 +123,7 @@ devDependencies: |
|||||
"@iconify/vue": 3.1[email protected] |
"@iconify/vue": 3.1[email protected] |
||||
"@types/element-resize-detector": 1.1.3 |
"@types/element-resize-detector": 1.1.3 |
||||
"@types/js-cookie": 3.0.1 |
"@types/js-cookie": 3.0.1 |
||||
|
"@types/lodash-es": 4.17.6 |
||||
"@types/mockjs": 1.0.3 |
"@types/mockjs": 1.0.3 |
||||
"@types/node": 14.14.14 |
"@types/node": 14.14.14 |
||||
"@types/nprogress": 0.2.0 |
"@types/nprogress": 0.2.0 |
||||
@ -138,6 +143,7 @@ devDependencies: |
|||||
eslint-plugin-vue: 8.4[email protected] |
eslint-plugin-vue: 8.4[email protected] |
||||
husky: 7.0.2 |
husky: 7.0.2 |
||||
lint-staged: 11.1.2 |
lint-staged: 11.1.2 |
||||
|
picocolors: 1.0.0 |
||||
postcss: 8.4.6 |
postcss: 8.4.6 |
||||
postcss-html: 1.3.0 |
postcss-html: 1.3.0 |
||||
postcss-import: 14.0[email protected] |
postcss-import: 14.0[email protected] |
||||
@ -145,7 +151,7 @@ devDependencies: |
|||||
prettier: 2.5.1 |
prettier: 2.5.1 |
||||
pretty-quick: 3.1[email protected] |
pretty-quick: 3.1[email protected] |
||||
rimraf: 3.0.2 |
rimraf: 3.0.2 |
||||
rollup-plugin-visualizer: 5.5.4 |
|
||||
|
rollup-plugin-visualizer: 5.6.0 |
||||
sass: 1.49.7 |
sass: 1.49.7 |
||||
sass-loader: 12.6[email protected] |
sass-loader: 12.6[email protected] |
||||
stylelint: 14.5.0 |
stylelint: 14.5.0 |
||||
@ -1098,6 +1104,22 @@ packages: |
|||||
} |
} |
||||
dev: true |
dev: true |
||||
|
|
||||
|
/@types/lodash-es/4.17.6: |
||||
|
resolution: |
||||
|
{ |
||||
|
integrity: sha512-R+zTeVUKDdfoRxpAryaQNRKk3105Rrgx2CFRClIgRGaqDTdjsm8h6IYA8ir584W3ePzkZfst5xIgDwYrlh9HLg== |
||||
|
} |
||||
|
dependencies: |
||||
|
"@types/lodash": 4.14.179 |
||||
|
dev: true |
||||
|
|
||||
|
/@types/lodash/4.14.179: |
||||
|
resolution: |
||||
|
{ |
||||
|
integrity: sha512-uwc1x90yCKqGcIOAT6DwOSuxnrAbpkdPsUOZtwrXb4D/6wZs+6qG7QnIawDuZWg0sWpxl+ltIKCaLoMlna678w== |
||||
|
} |
||||
|
dev: true |
||||
|
|
||||
/@types/minimatch/3.0.5: |
/@types/minimatch/3.0.5: |
||||
resolution: |
resolution: |
||||
{ |
{ |
||||
@ -2805,10 +2827,10 @@ packages: |
|||||
} |
} |
||||
dev: true |
dev: true |
||||
|
|
||||
/element-plus/2.0.[email protected]: |
|
||||
|
/element-plus/2.0.3_1a412d14def5ff5ca1122000e4bee666: |
||||
resolution: |
resolution: |
||||
{ |
{ |
||||
integrity: sha512-URjC0HwwiqtlLxqTmHXQ31WXrdAq4ChWyyn52OcQs3PRsnMPfahGVq2AWnfzzlzlhVeI5lY3HQiuB1zDathS+g== |
|
||||
|
integrity: sha512-k+b4V4sGmgOpOYjrAWyp0k+N1mVaIZQ9LpbXWvmJNzE+j21DYOe9m1zGn5mFDPgeLOZcUS7QzzwYAommhwFj0g== |
||||
} |
} |
||||
peerDependencies: |
peerDependencies: |
||||
vue: ^3.2.0 |
vue: ^3.2.0 |
||||
@ -2821,7 +2843,7 @@ packages: |
|||||
dayjs: 1.10.7 |
dayjs: 1.10.7 |
||||
lodash: 4.17.21 |
lodash: 4.17.21 |
||||
lodash-es: 4.17.21 |
lodash-es: 4.17.21 |
||||
lodash-unified: 1.0.[email protected][email protected] |
|
||||
|
lodash-unified: 1.0.2_da03a4540fbd16bbaafbb96724306afd |
||||
memoize-one: 6.0.0 |
memoize-one: 6.0.0 |
||||
normalize-wheel-es: 1.1.1 |
normalize-wheel-es: 1.1.1 |
||||
vue: 3.2.31 |
vue: 3.2.31 |
||||
@ -4388,20 +4410,35 @@ packages: |
|||||
} |
} |
||||
dev: false |
dev: false |
||||
|
|
||||
/lodash-unified/1.0.[email protected][email protected]: |
|
||||
|
/lodash-unified/1.0.2_da03a4540fbd16bbaafbb96724306afd: |
||||
resolution: |
resolution: |
||||
{ |
{ |
||||
integrity: sha512-Py+twfpWn+2dFQWCuGcp21WiQRwZwnm1cyE3piSt/VtBVKVyxlR58WgOVRzXtmdmDRGJKH8F8GPaA29WK/yK8g== |
|
||||
|
integrity: sha512-OGbEy+1P+UT26CYi4opY4gebD8cWRDxAT6MAObIVQMiqYdxZr1g3QHWCToVsm31x2NkLS4K3+MC2qInaRMa39g== |
||||
} |
} |
||||
peerDependencies: |
peerDependencies: |
||||
"@types/lodash-es": "*" |
"@types/lodash-es": "*" |
||||
lodash: "*" |
lodash: "*" |
||||
lodash-es: "*" |
lodash-es: "*" |
||||
dependencies: |
dependencies: |
||||
|
"@types/lodash-es": 4.17.6 |
||||
lodash: 4.17.21 |
lodash: 4.17.21 |
||||
lodash-es: 4.17.21 |
lodash-es: 4.17.21 |
||||
dev: false |
dev: false |
||||
|
|
||||
|
/lodash-unified/1.0.2_f567d1d3c0c6a67669f03af7a1aa4dad: |
||||
|
resolution: |
||||
|
{ |
||||
|
integrity: sha512-OGbEy+1P+UT26CYi4opY4gebD8cWRDxAT6MAObIVQMiqYdxZr1g3QHWCToVsm31x2NkLS4K3+MC2qInaRMa39g== |
||||
|
} |
||||
|
peerDependencies: |
||||
|
"@types/lodash-es": "*" |
||||
|
lodash: "*" |
||||
|
lodash-es: "*" |
||||
|
dependencies: |
||||
|
"@types/lodash-es": 4.17.6 |
||||
|
lodash-es: 4.17.21 |
||||
|
dev: false |
||||
|
|
||||
/lodash.get/4.4.2: |
/lodash.get/4.4.2: |
||||
resolution: { integrity: sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk= } |
resolution: { integrity: sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk= } |
||||
dev: true |
dev: true |
||||
@ -5866,10 +5903,10 @@ packages: |
|||||
glob: 7.2.0 |
glob: 7.2.0 |
||||
dev: true |
dev: true |
||||
|
|
||||
/rollup-plugin-visualizer/5.5.4: |
|
||||
|
/rollup-plugin-visualizer/5.6.0: |
||||
resolution: |
resolution: |
||||
{ |
{ |
||||
integrity: sha512-CJQFUuZ75S1daGEkk62UH7lL6UFCoP86Sn/iz4gXBdamdwFeD5nPGCHHXfXCrly/wNgQOYTH7cdcxk4+OG3Xjw== |
|
||||
|
integrity: sha512-CKcc8GTUZjC+LsMytU8ocRr/cGZIfMR7+mdy4YnlyetlmIl/dM8BMnOEpD4JPIGt+ZVW7Db9ZtSsbgyeBH3uTA== |
||||
} |
} |
||||
engines: { node: ">=12" } |
engines: { node: ">=12" } |
||||
hasBin: true |
hasBin: true |
||||
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue