Browse Source

build: Add conventional-changelog-cli plugin

陈凯龙 3 years ago
parent
commit
384485f699
6 changed files with 622 additions and 117 deletions
  1. 0 0
      CHANGELOG.md
  2. 0 3
      log.md
  3. 2 0
      package.json
  4. 607 110
      pnpm-lock.yaml
  5. 3 3
      src/permission.ts
  6. 10 1
      src/router/index.ts

+ 0 - 0
CHANGELOG.md


+ 0 - 3
log.md

@@ -1,3 +0,0 @@
-vscode 安装 WindiCSS IntelliSense
-
-自动导入太慢了。所以暂时不使用这种方案

+ 2 - 0
package.json

@@ -15,6 +15,7 @@
     "serve:dev": "vite preview --mode dev",
     "serve:test": "vite preview --mode test",
     "npm:check": "npx npm-check-updates",
+    "log": "conventional-changelog -p angular -i CHANGELOG.md -s",
     "clean": "npx rimraf node_modules",
     "clean:cache": "npx rimraf node_modules/.cache",
     "lint:eslint": "eslint --fix --ext .js,.ts,.vue ./src",
@@ -68,6 +69,7 @@
     "@vitejs/plugin-vue-jsx": "^1.3.7",
     "autoprefixer": "^10.4.2",
     "commitizen": "^4.2.4",
+    "conventional-changelog-cli": "^2.2.2",
     "eslint": "^8.9.0",
     "eslint-config-prettier": "^8.3.0",
     "eslint-define-config": "^1.2.5",

File diff suppressed because it is too large
+ 607 - 110
pnpm-lock.yaml


+ 3 - 3
src/permission.ts

@@ -27,7 +27,7 @@ router.beforeEach(async (to, from, next) => {
       next({ path: '/' })
     } else {
       if (permissionStore.getIsAddRouters) {
-        to.path === '/' ? next({ path: permissionStore.addRouters[0]?.path as string }) : next()
+        next()
         return
       }
 
@@ -46,11 +46,11 @@ router.beforeEach(async (to, from, next) => {
       const redirect = decodeURIComponent(redirectPath as string)
       const nextData = to.path === redirect ? { ...to, replace: true } : { path: redirect }
       permissionStore.setIsAddRouters(true)
-      next(to.path === '/' ? { path: permissionStore.addRouters[0]?.path as string } : nextData)
+      next(nextData)
     }
   } else {
     if (whiteList.indexOf(to.path) !== -1) {
-      to.path === '/' ? next({ path: permissionStore.addRouters[0]?.path as string }) : next()
+      next()
     } else {
       next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页
     }

+ 10 - 1
src/router/index.ts

@@ -7,6 +7,15 @@ import { useI18n } from '@/hooks/web/useI18n'
 const { t } = useI18n()
 
 export const constantRouterMap: AppRouteRecordRaw[] = [
+  {
+    path: '/',
+    component: Layout,
+    redirect: '/dashboard/analysis',
+    name: 'Root',
+    meta: {
+      hidden: true
+    }
+  },
   {
     path: '/redirect',
     component: Layout,
@@ -488,7 +497,7 @@ const router = createRouter({
 })
 
 export const resetRouter = (): void => {
-  const resetWhiteNameList = ['Redirect', 'Login', 'NoFind']
+  const resetWhiteNameList = ['Redirect', 'Login', 'NoFind', 'Root']
   router.getRoutes().forEach((route) => {
     const { name } = route
     if (name && !resetWhiteNameList.includes(name as string)) {

Some files were not shown because too many files changed in this diff