From 1b14680d7376464d9cbb5e57c3e5ab402ec8bcdd Mon Sep 17 00:00:00 2001 From: kailong321200875 <321200875@qq.com> Date: Sat, 16 Jul 2022 11:09:30 +0800 Subject: [PATCH 1/3] chore: update deps --- mock/_createProductionServer.ts | 9 ++++--- package.json | 48 ++++++++++++++++----------------- src/utils/routerHelper.ts | 10 +++++-- vite.config.ts | 2 +- 4 files changed, 39 insertions(+), 30 deletions(-) diff --git a/mock/_createProductionServer.ts b/mock/_createProductionServer.ts index 00b21de..4f13681 100644 --- a/mock/_createProductionServer.ts +++ b/mock/_createProductionServer.ts @@ -1,13 +1,16 @@ import { createProdMockServer } from 'vite-plugin-mock/es/createProdMockServer' -const modules = import.meta.globEager('./**/*.ts') +const modules = import.meta.glob('./**/*.ts', { + import: 'default', + eager: true +}) const mockModules: any[] = [] -Object.keys(modules).forEach((key) => { +Object.keys(modules).forEach(async (key) => { if (key.includes('_')) { return } - mockModules.push(...modules[key].default) + mockModules.push(...(modules[key] as any).default) }) export function setupProdMockServer() { diff --git a/package.json b/package.json index 44c1314..58e0d8c 100644 --- a/package.json +++ b/package.json @@ -27,82 +27,82 @@ }, "dependencies": { "@iconify/iconify": "^2.2.1", - "@vueuse/core": "^8.7.5", - "@wangeditor/editor": "^5.1.1", + "@vueuse/core": "^8.9.3", + "@wangeditor/editor": "^5.1.9", "@wangeditor/editor-for-vue": "^5.1.10", "@zxcvbn-ts/core": "^2.0.1", "animate.css": "^4.1.1", "axios": "^0.27.2", "echarts": "^5.3.3", "echarts-wordcloud": "^2.0.0", - "element-plus": "2.2.7", - "intro.js": "^5.1.0", + "element-plus": "2.2.9", + "intro.js": "^6.0.0", "js-md5": "^0.7.3", "lodash-es": "^4.17.21", "mitt": "^3.0.0", "mockjs": "^1.1.0", "nprogress": "^0.2.0", - "pinia": "^2.0.14", + "pinia": "^2.0.16", "pinia-plugin-persist": "^1.0.0", - "qrcode": "^1.5.0", + "qrcode": "^1.5.1", "qs": "^6.11.0", "url": "^0.11.0", "vue": "3.2.37", "vue-i18n": "9.1.10", - "vue-router": "^4.0.16", + "vue-router": "^4.1.2", "vue-types": "^4.1.1", "web-storage-cache": "^1.1.1" }, "devDependencies": { "@commitlint/cli": "^17.0.3", "@commitlint/config-conventional": "^17.0.3", - "@iconify/json": "^2.1.70", - "@intlify/vite-plugin-vue-i18n": "^3.4.0", + "@iconify/json": "^2.1.78", + "@intlify/vite-plugin-vue-i18n": "^5.0.0", "@purge-icons/generated": "^0.8.1", - "@types/intro.js": "^3.0.2", + "@types/intro.js": "^5.1.0", "@types/js-md5": "^0.4.3", "@types/lodash-es": "^4.17.6", - "@types/node": "^18.0.0", + "@types/node": "^18.0.5", "@types/nprogress": "^0.2.0", "@types/qrcode": "^1.4.2", "@types/qs": "^6.9.7", - "@typescript-eslint/eslint-plugin": "^5.30.0", - "@typescript-eslint/parser": "^5.30.0", - "@vitejs/plugin-vue": "^2.3.3", - "@vitejs/plugin-vue-jsx": "^1.3.10", + "@typescript-eslint/eslint-plugin": "^5.30.6", + "@typescript-eslint/parser": "^5.30.6", + "@vitejs/plugin-vue": "^3.0.0", + "@vitejs/plugin-vue-jsx": "^2.0.0", "autoprefixer": "^10.4.7", - "eslint": "^8.18.0", + "eslint": "^8.19.0", "eslint-config-prettier": "^8.5.0", "eslint-define-config": "^1.5.1", "eslint-plugin-prettier": "^4.2.1", - "eslint-plugin-vue": "^9.1.1", + "eslint-plugin-vue": "^9.2.0", "husky": "^8.0.1", "less": "^4.1.3", "lint-staged": "^13.0.3", "plop": "^3.1.1", "postcss": "^8.4.14", - "postcss-html": "^1.4.1", + "postcss-html": "^1.5.0", "postcss-less": "^6.0.0", "prettier": "^2.7.1", "rimraf": "^3.0.2", - "rollup": "^2.75.7", + "rollup": "^2.77.0", "stylelint": "^14.9.1", - "stylelint-config-html": "^1.0.0", + "stylelint-config-html": "^1.1.0", "stylelint-config-prettier": "^9.0.3", "stylelint-config-recommended": "^8.0.0", "stylelint-config-standard": "^26.0.0", "stylelint-order": "^5.0.0", "typescript": "4.7.4", - "unplugin-vue-define-options": "^0.6.1", - "vite": "2.9.13", + "unplugin-vue-define-options": "^0.6.2", + "vite": "3.0.0", "vite-plugin-eslint": "^1.6.1", "vite-plugin-html": "^3.2.0", "vite-plugin-mock": "^2.9.6", "vite-plugin-purge-icons": "^0.8.1", "vite-plugin-style-import": "^1.4.1", "vite-plugin-svg-icons": "^2.0.1", - "vite-plugin-windicss": "^1.8.6", - "vue-tsc": "^0.38.2", + "vite-plugin-windicss": "^1.8.7", + "vue-tsc": "^0.38.5", "windicss": "^3.5.6", "windicss-analysis": "^0.3.5" }, diff --git a/src/utils/routerHelper.ts b/src/utils/routerHelper.ts index 44549ea..bc80677 100644 --- a/src/utils/routerHelper.ts +++ b/src/utils/routerHelper.ts @@ -1,5 +1,11 @@ import { createRouter, createWebHashHistory } from 'vue-router' -import type { Router, RouteLocationNormalized, RouteRecordNormalized, RouteMeta } from 'vue-router' +import type { + Router, + RouteLocationNormalized, + RouteRecordNormalized, + RouteMeta, + RouteRecordRaw +} from 'vue-router' import { isUrl } from '@/utils/is' import { omit, cloneDeep } from 'lodash-es' @@ -154,7 +160,7 @@ const isMultipleRoute = (route: AppRouteRecordRaw) => { // 生成二级路由 const promoteRouteLevel = (route: AppRouteRecordRaw) => { let router: Router | null = createRouter({ - routes: [route as unknown as RouteRecordNormalized], + routes: [route as RouteRecordRaw], history: createWebHashHistory() }) diff --git a/vite.config.ts b/vite.config.ts index d0123ca..84655f7 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -107,7 +107,7 @@ export default ({ command, mode }: ConfigEnv): UserConfig => { minify: 'terser', outDir: env.VITE_OUT_DIR || 'dist', sourcemap: env.VITE_SOURCEMAP === 'true' ? 'inline' : false, - brotliSize: false, + // brotliSize: false, terserOptions: { compress: { drop_debugger: env.VITE_DROP_DEBUGGER === 'true', From 14530cf790bfbbe37c72fa831f0376bbb4209e9d Mon Sep 17 00:00:00 2001 From: kailong321200875 <321200875@qq.com> Date: Sat, 16 Jul 2022 15:11:19 +0800 Subject: [PATCH 2/3] fix: fix build:test error --- .env.base | 8 ++++---- .env.dev | 16 ++++++++-------- .env.gitee | 16 ++++++++-------- .env.pro | 16 ++++++++-------- .env.test | 17 ++++++++++------- mock/_createProductionServer.ts | 2 +- src/utils/index.ts | 1 + src/views/Components/Search.vue | 5 ++++- src/views/Login/Login.vue | 1 + 9 files changed, 45 insertions(+), 37 deletions(-) diff --git a/.env.base b/.env.base index 106665c..8a8d91c 100644 --- a/.env.base +++ b/.env.base @@ -1,11 +1,11 @@ # 环境 -NODE_ENV = development +NODE_ENV=development # 接口前缀 -VITE_API_BASEPATH = base +VITE_API_BASEPATH=base # 打包路径 -VITE_BASE_PATH = / +VITE_BASE_PATH=/ # 标题 -VITE_APP_TITLE = ElementAdmin +VITE_APP_TITLE=ElementAdmin diff --git a/.env.dev b/.env.dev index afb5ac0..6a641a3 100644 --- a/.env.dev +++ b/.env.dev @@ -1,23 +1,23 @@ # 环境 -NODE_ENV = production +NODE_ENV=production # 接口前缀 -VITE_API_BASEPATH = dev +VITE_API_BASEPATH=dev # 打包路径 -VITE_BASE_PATH = /dist-dev/ +VITE_BASE_PATH=/dist-dev/ # 是否删除debugger -VITE_DROP_DEBUGGER = false +VITE_DROP_DEBUGGER=false # 是否删除console.log -VITE_DROP_CONSOLE = false +VITE_DROP_CONSOLE=false # 是否sourcemap -VITE_SOURCEMAP = true +VITE_SOURCEMAP=true # 输出路径 -VITE_OUT_DIR = dist-dev +VITE_OUT_DIR=dist-dev # 标题 -VITE_APP_TITLE = ElementAdmin +VITE_APP_TITLE=ElementAdmin diff --git a/.env.gitee b/.env.gitee index 6eaa2cd..c55b595 100644 --- a/.env.gitee +++ b/.env.gitee @@ -1,23 +1,23 @@ # 环境 -NODE_ENV = production +NODE_ENV=production # 接口前缀 -VITE_API_BASEPATH = pro +VITE_API_BASEPATH=pro # 打包路径 -VITE_BASE_PATH = /vue-element-plus-admin/ +VITE_BASE_PATH=/vue-element-plus-admin/ # 是否删除debugger -VITE_DROP_DEBUGGER = true +VITE_DROP_DEBUGGER=true # 是否删除console.log -VITE_DROP_CONSOLE = true +VITE_DROP_CONSOLE=true # 是否sourcemap -VITE_SOURCEMAP = false +VITE_SOURCEMAP=false # 输出路径 -VITE_OUT_DIR = dist-pro +VITE_OUT_DIR=dist-pro # 标题 -VITE_APP_TITLE = ElementAdmin +VITE_APP_TITLE=ElementAdmin diff --git a/.env.pro b/.env.pro index 3f1cd94..99a9480 100644 --- a/.env.pro +++ b/.env.pro @@ -1,23 +1,23 @@ # 环境 -NODE_ENV = production +NODE_ENV=production # 接口前缀 -VITE_API_BASEPATH = pro +VITE_API_BASEPATH=pro # 打包路径 -VITE_BASE_PATH = / +VITE_BASE_PATH=/ # 是否删除debugger -VITE_DROP_DEBUGGER = true +VITE_DROP_DEBUGGER=true # 是否删除console.log -VITE_DROP_CONSOLE = true +VITE_DROP_CONSOLE=true # 是否sourcemap -VITE_SOURCEMAP = false +VITE_SOURCEMAP=false # 输出路径 -VITE_OUT_DIR = dist-pro +VITE_OUT_DIR=dist-pro # 标题 -VITE_APP_TITLE = ElementAdmin +VITE_APP_TITLE=ElementAdmin diff --git a/.env.test b/.env.test index 2940240..3f6ebe1 100644 --- a/.env.test +++ b/.env.test @@ -1,20 +1,23 @@ # 环境 -NODE_ENV = production +NODE_ENV=production # 接口前缀 -VITE_API_BASEPATH = test +VITE_API_BASEPATH=test # 打包路径 -VITE_BASE_PATH = /dist-test/ +VITE_BASE_PATH=/dist-test/ # 是否删除debugger -VITE_DROP_DEBUGGER = false +VITE_DROP_DEBUGGER=false # 是否删除console.log -VITE_DROP_CONSOLE = false +VITE_DROP_CONSOLE=false # 是否sourcemap -VITE_SOURCEMAP = true +VITE_SOURCEMAP=true # 输出路径 -VITE_OUT_DIR = dist-test +VITE_OUT_DIR=dist-test + +# 标题 +VITE_APP_TITLE=ElementAdmin diff --git a/mock/_createProductionServer.ts b/mock/_createProductionServer.ts index 4f13681..caa26bf 100644 --- a/mock/_createProductionServer.ts +++ b/mock/_createProductionServer.ts @@ -10,7 +10,7 @@ Object.keys(modules).forEach(async (key) => { if (key.includes('_')) { return } - mockModules.push(...(modules[key] as any).default) + mockModules.push(...(modules[key] as any)) }) export function setupProdMockServer() { diff --git a/src/utils/index.ts b/src/utils/index.ts index 93ccd11..246de69 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -30,6 +30,7 @@ export const humpToUnderline = (str: string): string => { * @returns 字符串驼峰 */ export const underlineToHump = (str: string): string => { + if (!str) return '' return str.replace(/\-(\w)/g, (_, letter: string) => { return letter.toUpperCase() }) diff --git a/src/views/Components/Search.vue b/src/views/Components/Search.vue index 652e04b..206d69e 100644 --- a/src/views/Components/Search.vue +++ b/src/views/Components/Search.vue @@ -34,7 +34,10 @@ const schema = reactive([ label: 'option2', value: '2' } - ] + ], + onChange: (value: string) => { + console.log(value) + } } }, { diff --git a/src/views/Login/Login.vue b/src/views/Login/Login.vue index 25170cb..72ec9e4 100644 --- a/src/views/Login/Login.vue +++ b/src/views/Login/Login.vue @@ -13,6 +13,7 @@ const { getPrefixCls } = useDesign() const prefixCls = getPrefixCls('login') const appStore = useAppStore() +console.log(appStore) const { t } = useI18n() From 94afe29e891019457b0eda2090eb0aa00972c7ee Mon Sep 17 00:00:00 2001 From: Archer <32283845+kailong321200875@users.noreply.github.com> Date: Sat, 16 Jul 2022 15:35:26 +0800 Subject: [PATCH 3/3] chore(master): release 1.5.4 --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 966d03e..11bdb27 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,13 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [1.5.4](https://github.com/kailong321200875/vue-element-plus-admin/compare/v1.5.3...v1.5.4) (2022-07-16) + + +### Bug Fixes + +* fix build:test error ([14530cf](https://github.com/kailong321200875/vue-element-plus-admin/commit/14530cf790bfbbe37c72fa831f0376bbb4209e9d)) + ## [1.5.3](https://github.com/kailong321200875/vue-element-plus-admin/compare/v1.5.2...v1.5.3) (2022-07-01) diff --git a/package.json b/package.json index 58e0d8c..0b40cb7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vue-element-plus-admin", - "version": "1.5.3", + "version": "1.5.4", "description": "一套基于vue3、element-plus、typesScript、vite2的后台集成方案。", "author": "Archer <502431556@qq.com>", "private": false,