From d6a36abc4704271d8411c29996416b9ed0fbba71 Mon Sep 17 00:00:00 2001 From: Bunny <1319900154@qq.com> Date: Sun, 12 May 2024 02:05:33 +0800 Subject: [PATCH 1/4] =?UTF-8?q?feat:=20=F0=9F=9A=80=20=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=8E=A7=E5=88=B6=E5=8F=B0=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .husky/commit-msg | 8 - .husky/common.sh | 9 - .husky/pre-commit | 10 +- .prettierrc.js | 2 +- build/info.ts | 19 +- commitlint.config.js | 84 +- index.html | 106 +- lint-staged.config.js | 8 + locales/en.yaml | 4 + locales/zh-CN.yaml | 4 + mock/asyncRoutes.ts | 14 +- package.json | 13 +- pnpm-lock.yaml | 1091 ++++++++++++++++- .../{RePureTableBar => TableBar}/index.ts | 0 .../{RePureTableBar => TableBar}/src/bar.tsx | 9 +- .../hook.tsx => hooks/monitor/useRole.ts} | 5 +- src/router/enums.ts | 4 +- src/router/modules/remaining.ts | 3 +- src/views/login/index.vue | 6 +- src/views/login/utils/rule.ts | 15 +- src/views/monitor/logs/login/hook.tsx | 168 --- src/views/monitor/logs/login/index.vue | 118 +- src/views/monitor/logs/operation/hook.tsx | 174 --- src/views/monitor/logs/operation/index.vue | 118 +- src/views/monitor/logs/system/detail.vue | 13 +- src/views/monitor/logs/system/hook.tsx | 65 +- src/views/monitor/logs/system/index.vue | 102 +- src/views/monitor/online/index.vue | 88 +- src/views/system/dept/form.vue | 73 +- src/views/system/dept/index.vue | 124 +- src/views/system/menu/form.vue | 176 +-- src/views/system/menu/index.vue | 106 +- src/views/system/role/index.vue | 167 +-- src/views/system/user/index.vue | 2 +- 34 files changed, 1513 insertions(+), 1395 deletions(-) delete mode 100644 .husky/commit-msg delete mode 100644 .husky/common.sh create mode 100644 lint-staged.config.js rename src/components/{RePureTableBar => TableBar}/index.ts (100%) rename src/components/{RePureTableBar => TableBar}/src/bar.tsx (96%) rename src/{views/monitor/online/hook.tsx => hooks/monitor/useRole.ts} (93%) delete mode 100644 src/views/monitor/logs/login/hook.tsx delete mode 100644 src/views/monitor/logs/operation/hook.tsx diff --git a/.husky/commit-msg b/.husky/commit-msg deleted file mode 100644 index 5ee2d16..0000000 --- a/.husky/commit-msg +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -# shellcheck source=./_/husky.sh -. "$(dirname "$0")/_/husky.sh" - -PATH="/usr/local/bin:$PATH" - -npx --no-install commitlint --edit "$1" \ No newline at end of file diff --git a/.husky/common.sh b/.husky/common.sh deleted file mode 100644 index 5f0540b..0000000 --- a/.husky/common.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -command_exists () { - command -v "$1" >/dev/null 2>&1 -} - -# Workaround for Windows 10, Git Bash and Pnpm -if command_exists winpty && test -t 1; then - exec < /dev/tty -fi diff --git a/.husky/pre-commit b/.husky/pre-commit index 6e229ea..08d8ec7 100644 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,10 +1,4 @@ #!/bin/sh -. "$(dirname "$0")/_/husky.sh" -. "$(dirname "$0")/common.sh" +. "$(dirname -- "$0")/_/husky.sh" -[ -n "$CI" ] && exit 0 - -PATH="/usr/local/bin:$PATH" - -# Perform lint check on files in the staging area through .lintstagedrc configuration -pnpm exec lint-staged \ No newline at end of file +pnpm exec lint-staged diff --git a/.prettierrc.js b/.prettierrc.js index 13454b4..613f0cb 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -2,7 +2,7 @@ /** @type {import("prettier").Config} */ export default { - printWidth: 230, + printWidth: 200, bracketSpacing: true, singleQuote: false, arrowParens: "avoid", diff --git a/build/info.ts b/build/info.ts index b4e9834..43140ab 100644 --- a/build/info.ts +++ b/build/info.ts @@ -4,13 +4,13 @@ import dayjs, { type Dayjs } from "dayjs"; import duration from "dayjs/plugin/duration"; import gradientString from "gradient-string"; import boxen, { type Options as BoxenOptions } from "boxen"; + dayjs.extend(duration); const welcomeMessage = gradientString("cyan", "magenta").multiline( -`您好! 欢迎使用 pure-admin 开源项目 -我们为您精心准备了下面两个贴心的保姆级文档 -https://pure-admin.github.io/pure-admin-doc -https://pure-admin-utils.netlify.app` + `您好! 欢迎使用 bunny-admin 后台管理 +项目访问地址如下: +http://localhost:8848/` ); const boxenOptions: BoxenOptions = { @@ -42,16 +42,7 @@ export function viteBuildInfo(): Plugin { getPackageSize({ folder: outDir, callback: (size: string) => { - console.log( - boxen( - gradientString("cyan", "magenta").multiline( - `🎉 恭喜打包完成(总用时${dayjs - .duration(endTime.diff(startTime)) - .format("mm分ss秒")},打包后的大小为${size})` - ), - boxenOptions - ) - ); + console.log(boxen(gradientString("cyan", "magenta").multiline(`🎉 恭喜打包完成(总用时${dayjs.duration(endTime.diff(startTime)).format("mm分ss秒")},打包后的大小为${size})`), boxenOptions)); } }); } diff --git a/commitlint.config.js b/commitlint.config.js index eea755d..3871078 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -1,35 +1,73 @@ -// @ts-check +// @see: https://cz-git.qbenben.com/zh/guide +/** @type {import('cz-git').UserConfig} */ -/** @type {import("@commitlint/types").UserConfig} */ export default { ignores: [commit => commit.includes("init")], extends: ["@commitlint/config-conventional"], rules: { + // @see: https://commitlint.js.org/#/reference-rules "body-leading-blank": [2, "always"], "footer-leading-blank": [1, "always"], "header-max-length": [2, "always", 108], "subject-empty": [2, "never"], "type-empty": [2, "never"], - "type-enum": [ - 2, - "always", - [ - "feat", - "fix", - "perf", - "style", - "docs", - "test", - "refactor", - "build", - "ci", - "chore", - "revert", - "wip", - "workflow", - "types", - "release" - ] - ] + "subject-case": [0], + "type-enum": [2, "always", ["feat", "fix", "media", "docs", "style", "refactor", "perf", "test", "build", "ci", "chore", "revert", "wip", "workflow", "types", "release"]] + }, + prompt: { + messages: { + type: "选择你要提交的类型 :", + scope: "选择一个提交范围(可选):", + customScope: "请输入自定义的提交范围 :", + subject: "填写简短精炼的变更描述 :\n", + body: '填写更加详细的变更描述(可选)。使用 "|" 换行 :\n', + breaking: '列举非兼容性重大的变更(可选)。使用 "|" 换行 :\n', + footerPrefixsSelect: "选择关联issue前缀(可选):", + customFooterPrefixs: "输入自定义issue前缀 :", + footer: "列举关联issue (可选) 例如: #31, #I3244 :\n", + confirmCommit: "是否提交或修改commit ?" + }, + types: [ + { value: "feat", name: "特性: 🚀 新增功能", emoji: "🚀" }, + { value: "media", name: "媒体: 🎁 新增媒体资源", emoji: "🎁" }, + { value: "fix", name: "修复: 🧩 修复缺陷", emoji: "🧩" }, + { value: "docs", name: "文档: 📚 文档变更", emoji: "📚" }, + { value: "style", name: "格式: 🎨 代码格式(不影响功能,例如空格、分号等格式修正)", emoji: "🎨" }, + { value: "refactor", name: "重构: ♻️ 代码重构(不包括 bug 修复、功能新增)", emoji: "♻️" }, + { value: "perf", name: "性能: ⚡️ 性能优化", emoji: "⚡️" }, + { value: "test", name: "测试: ✅ 添加疏漏测试或已有测试改动", emoji: "✅" }, + { value: "build", name: "构建: 📦️ 构建流程、外部依赖变更(如升级 npm 包、修改 webpack 配置等)", emoji: "📦️" }, + { value: "ci", name: "集成: 🎡 修改 CI 配置、脚本", emoji: "🎡" }, + { value: "revert", name: "回退: ⏪️ 回滚 commit", emoji: "⏪️" }, + { value: "chore", name: "其他: 🔨 对构建过程或辅助工具和库的更改(不影响源文件、测试用例)", emoji: "🔨" } + ], + useEmoji: true, + themeColorCode: "", + scopes: [], + allowCustomScopes: true, + allowEmptyScopes: true, + customScopesAlign: "bottom", + customScopesAlias: "custom", + emptyScopesAlias: "empty", + upperCaseSubject: false, + allowBreakingChanges: ["feat", "fix"], + breaklineNumber: 100, + breaklineChar: "|", + skipQuestions: [], + issuePrefixs: [{ value: "closed", name: "closed: ISSUES has been processed" }], + customIssuePrefixsAlign: "top", + emptyIssuePrefixsAlias: "skip", + customIssuePrefixsAlias: "custom", + allowCustomIssuePrefixs: true, + allowEmptyIssuePrefixs: true, + confirmColorize: true, + maxHeaderLength: Infinity, + maxSubjectLength: Infinity, + minSubjectLength: 0, + scopeOverrides: undefined, + defaultBody: "", + defaultIssues: "", + defaultScope: "", + defaultSubject: "" } }; diff --git a/index.html b/index.html index 3786884..9659e19 100644 --- a/index.html +++ b/index.html @@ -1,87 +1,87 @@ -
- - - + + + + -