diff --git a/.cz-config.js b/.cz-config.js deleted file mode 100644 index 23bcae1ae..000000000 --- a/.cz-config.js +++ /dev/null @@ -1,91 +0,0 @@ -module.exports = { - // type 类型(定义之后,可通过上下键选择) - types: [ - { value: 'feat', name: 'feat: 新增功能' }, - { value: 'fix', name: 'fix: 修复 bug' }, - { value: 'docs', name: 'docs: 文档变更' }, - { - value: 'style', - name: 'style: 代码格式(不影响功能,例如空格、分号等格式修正)', - }, - { - value: 'refactor', - name: 'refactor: 代码重构(不包括 bug 修复、功能新增)', - }, - { value: 'perf', name: 'perf: 性能优化' }, - { value: 'test', name: 'test: 添加、修改测试用例' }, - { - value: 'build', - name: 'build: 构建流程、外部依赖变更(如升级 npm 包、修改 webpack 配置等)', - }, - { value: 'ci', name: 'ci: 修改 CI 配置、脚本' }, - { - value: 'chore', - name: 'chore: 对构建过程或辅助工具和库的更改(不影响源文件、测试用例)', - }, - { value: 'revert', name: 'revert: 回滚 commit' }, - ], - - // scope 类型(定义之后,可通过上下键选择) - scopes: [ - ['components', '组件相关'], - ['hooks', 'hook 相关'], - ['utils', 'utils 相关'], - ['element-ui', '对 element-ui 的调整'], - ['styles', '样式相关'], - ['deps', '项目依赖'], - ['auth', '对 auth 修改'], - ['other', '其他修改'], - // 如果选择 custom,后面会让你再输入一个自定义的 scope。也可以不设置此项,把后面的 allowCustomScopes 设置为 true - ['custom', '以上都不是?我要自定义'], - ].map(([value, description]) => { - return { - value, - name: `${value.padEnd(30)} (${description})`, - }; - }), - - // 是否允许自定义填写 scope,在 scope 选择的时候,会有 empty 和 custom 可以选择。 - // allowCustomScopes: true, - - // allowTicketNumber: false, - // isTicketNumberRequired: false, - // ticketNumberPrefix: 'TICKET-', - // ticketNumberRegExp: '\\d{1,5}', - - // 针对每一个 type 去定义对应的 scopes,例如 fix - /* - scopeOverrides: { - fix: [ - { name: 'merge' }, - { name: 'style' }, - { name: 'e2eTest' }, - { name: 'unitTest' } - ] - }, - */ - - // 交互提示信息 - messages: { - type: '确保本次提交遵循 Angular 规范!\n选择你要提交的类型:', - scope: '\n选择一个 scope(可选):', - // 选择 scope: custom 时会出下面的提示 - customScope: '请输入自定义的 scope:', - subject: '填写简短精炼的变更描述:\n', - body: '填写更加详细的变更描述(可选)。使用 "|" 换行:\n', - breaking: '列举非兼容性重大的变更(可选):\n', - footer: '列举出所有变更的 ISSUES CLOSED(可选)。 例如: #31, #34:\n', - confirmCommit: '确认提交?', - }, - - // 设置只有 type 选择了 feat 或 fix,才询问 breaking message - allowBreakingChanges: ['feat', 'fix'], - - // 跳过要询问的步骤 - // skipQuestions: ['body', 'footer'], - - subjectLimit: 100, // subject 限制长度 - breaklineChar: '|', // 换行符,支持 body 和 footer - // footerPrefix : 'ISSUES CLOSED:' - // askForBreakingChangeFirst : true, -}; diff --git a/.eslintignore b/.eslintignore index ce9628dc6..7f159ff35 100644 --- a/.eslintignore +++ b/.eslintignore @@ -14,3 +14,4 @@ dist /bin /src/mock Dockerfile +commitlint.config.js diff --git a/.prettierignore b/.prettierignore index f7e39e60b..63e81681f 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,6 +1,7 @@ /dist/* .local .output.js +commitlint.config.js /node_modules/** **/*.svg diff --git a/commitlint.config.js b/commitlint.config.js index 54598876e..70e42b683 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -1,3 +1,12 @@ +const { execSync } = require('child_process'); + +// @tip: git branch name = feature/issue_33 => auto get defaultIssues = #33 +const issue = execSync('git rev-parse --abbrev-ref HEAD') + .toString() + .trim() + .split("_")[1] + +/** @type {import('cz-git').UserConfig} */ module.exports = { ignores: [(commit) => commit.includes('init')], extends: ['@commitlint/config-conventional'], @@ -8,26 +17,55 @@ module.exports = { 'subject-empty': [2, 'never'], 'type-empty': [2, 'never'], 'subject-case': [0], - 'type-enum': [ - 2, - 'always', - [ - 'feat', - 'fix', - 'perf', - 'style', - 'docs', - 'test', - 'refactor', - 'build', - 'ci', - 'chore', - 'revert', - 'wip', - 'workflow', - 'types', - 'release', - ], - ], + 'type-enum': [2, 'always', [ 'feat', 'fix', 'perf', 'style', 'docs', 'test', 'refactor', 'build', 'ci', 'chore', 'revert', 'wip', 'workflow', 'types', 'release']], }, + prompt: { + messages: { + type: '确保本次提交遵循 Angular 规范!\n选择你要提交的类型:', + scope: '选择一个提交范围(可选):', + customScope: '请输入自定义的提交范围: ', + subject: '填写简短精炼的变更描述:\n', + body: '填写更加详细的变更描述(可选)。使用 "|" 换行:\n', + breaking: '列举非兼容性重大的变更(可选)。使用 "|" 换行:\n', + footerPrefixsSelect: "选择关联issue前缀(可选):", + customFooterPrefixs: "输入自定义issue前缀 :", + footer: "列举关联issue (可选) 例如: #31, #I3244 :", + confirmCommit: "是否提交或修改 commit ?", + }, + types: [ + {value: 'feat', name: 'feat: 新增功能'}, + {value: 'fix', name: 'fix: 修复缺陷'}, + {value: 'types', name: 'types: 类型修改'}, + {value: 'docs', name: 'docs: 文档变更'}, + {value: 'perf', name: 'perf: 性能优化'}, + {value: 'style', name: 'style: 代码格式(不影响功能,例如空格、分号等格式修正)'}, + {value: 'refactor', name: 'refactor: 代码重构(不包括 bug 修复、功能新增)'}, + {value: 'test', name: 'test: 添加、修改测试用例'}, + {value: 'build', name: 'build: 构建流程、外部依赖变更(如升级 npm 包、修改 webpack 配置等)'}, + {value: 'ci', name: 'ci: 修改 CI 配置、脚本'}, + {value: 'revert', name: 'revert: 回滚 commit'}, + {value: 'wip', name: 'wip: 功能开发中'}, + {value: 'workflow', name: 'workflow: 工作流程变更'}, + {value: 'chore', name: 'chore: 对构建过程或辅助工具和库的更改(不影响源文件、测试用例)'}, + ], + scopes: [ + {value: 'components', name: 'components: 组件相关'}, + {value: 'hooks', name: 'hooks: 组件相关'}, + {value: 'utils', name: 'utils: utils 相关'}, + {value: 'element-ui', name: 'element-ui: 对 element-ui 的调整'}, + {value: 'styles', name: 'styles: 对样式的调整'}, + {value: 'deps', name: 'deps: 项目依赖'}, + {value: 'auth', name: 'auth: 对 auth 修改'}, + {value: 'other', name: 'other: 其他修改'}, + ], + customScopesAlign: "top-bottom", + customScopesAlias: "custom: 以上都不是?我要自定义", + allowBreakingChanges: ['feat', 'fix'], + issuePrefixs: [ + { value: "link", name: "link: 链接 ISSUES 进行中" }, + { value: "closed", name: "closed: 标记 ISSUES 已完成" }, + ], + customIssuePrefixsAlign: !issue ? "top" : "bottom", + defaultIssues: !issue ? "" : `#${issue}` + } }; diff --git a/package.json b/package.json index 8edd3aa01..7580e313a 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "build:report": "vue-cli-service build --report && npx live-server --open=dist/report.html", "clean:lib": "npx rimraf node_modules", "deploy": "npm run build && npx gh-pages -d dist", + "dev:debug": "cross-env DEBUG_ANTDV=true npm run serve", "lint": "vue-cli-service lint", "lint:eslint": "eslint --cache --max-warnings 0 \"{src,mock}/**/*.{vue,ts,tsx}\" --fix", "lint:prettier": "prettier --write \"src/**/*.{js,json,tsx,css,less,scss,vue,html,md}\"", @@ -26,15 +27,16 @@ "reinstall": "rimraf yarn.lock && rimraf package.lock.json && rimraf node_modules && npm run dev", "version": "conventional-changelog -p angular -i CHANGELOG.md -s && git add CHANGELOG.md", "test:gzip": "npx http-server dist --cors --gzip -c-1", - "test:br": "npx http-server dist --cors --brotli -c-1" + "test:br": "npx http-server dist --cors --brotli -c-1", + "commit": "git cz" }, "dependencies": { "@ant-design/icons-vue": "^6.1.0", - "@vueuse/core": "^8.2.5", - "ant-design-vue": "3.1.1", - "axios": "^0.26.1", - "core-js": "^3.21.1", - "dayjs": "^1.11.0", + "@vueuse/core": "^8.3.1", + "ant-design-vue": "3.2.2", + "axios": "^0.27.1", + "core-js": "^3.22.2", + "dayjs": "^1.11.1", "file-saver": "^2.0.5", "lodash-es": "^4.17.21", "mitt": "^3.0.0", @@ -42,9 +44,9 @@ "nprogress": "^1.0.0-1", "pinia": "2.0.13", "qs": "^6.10.3", - "socket.io-client": "4.4.1", + "socket.io-client": "4.5.0", "sortablejs": "^1.15.0", - "vue": "^3.2.32", + "vue": "3.2.33", "vue-i18n": "9.2.0-beta.30", "vue-router": "^4.0.14", "vue-types": "^4.1.1", @@ -54,35 +56,37 @@ "@commitlint/cli": "^16.2.3", "@commitlint/config-conventional": "^16.2.1", "@types/lodash-es": "^4.17.6", - "@types/node": "^17.0.23", - "@types/webpack-env": "^1.16.3", - "@typescript-eslint/eslint-plugin": "^5.19.0", - "@typescript-eslint/parser": "^5.19.0", + "@types/node": "^17.0.29", + "@types/webpack-env": "^1.16.4", + "@typescript-eslint/eslint-plugin": "^5.21.0", + "@typescript-eslint/parser": "^5.21.0", "@vue/cli-plugin-babel": "^5.0.4", "@vue/cli-plugin-eslint": "^5.0.4", "@vue/cli-plugin-router": "^5.0.4", "@vue/cli-plugin-typescript": "^5.0.4", "@vue/cli-service": "^5.0.4", "@vue/eslint-config-typescript": "^10.0.0", - "babel-plugin-import": "^1.13.3", + "babel-plugin-import": "^1.13.5", "commitizen": "^4.2.4", "conventional-changelog-cli": "^2.2.2", - "eslint": "^8.13.0", + "cross-env": "^7.0.3", + "cz-git": "^1.2.3", + "eslint": "^8.14.0", "eslint-config-prettier": "^8.5.0", "eslint-plugin-import": "2.26.0", "eslint-plugin-prettier": "^4.0.0", - "eslint-plugin-vue": "^8.6.0", + "eslint-plugin-vue": "^8.7.1", "husky": "^7.0.4", "less": "^4.1.2", "less-loader": "10.2.0", - "lint-staged": "^12.3.7", + "lint-staged": "^12.4.1", "path-browserify": "^1.0.1", - "postcss-html": "^1.3.1", + "postcss-html": "^1.4.1", "postcss-less": "^6.0.0", "prettier": "^2.6.2", "regenerator-runtime": "^0.13.9", "speed-measure-webpack-plugin": "^1.5.0", - "stylelint": "^14.6.1", + "stylelint": "^14.8.0", "stylelint-config-html": "^1.0.0", "stylelint-config-prettier": "^9.0.3", "stylelint-config-recommended": "^7.0.0", @@ -91,7 +95,7 @@ "stylelint-order": "^5.0.0", "svg-sprite-loader": "^6.0.11", "typescript": "^4.6.3", - "unplugin-vue-define-options": "^0.6.0", + "unplugin-vue-define-options": "^0.6.1", "vue-cli-plugin-windicss": "^1.1.4", "vue-eslint-parser": "^8.3.0" }, diff --git a/src/App.vue b/src/App.vue index 1cd93b00f..0fad4ddf1 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,6 +1,6 @@