Skip to content

Commit 9d473fa

Browse files
committed
feat: 🚀 新增 commit 校验以及规范相关代码
1 parent 257dd6e commit 9d473fa

File tree

7 files changed

+120
-152
lines changed

7 files changed

+120
-152
lines changed

.versionrc

+55-14
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,59 @@
11
{
22
"types": [
3-
{"type": "feat", "section": "Features", "hidden": false},
4-
{"type": "fix", "section": "Bug Fixes", "hidden": false},
5-
{"type": "perf", "section":"Performance Improvements", "hidden": false},
6-
{"type": "style", "section":"Styling", "hidden": false},
7-
{"type": "docs", "section":"Docs", "hidden": false},
8-
{"type": "test", "section":"Tests", "hidden": false},
9-
{"type": "refactor", "section":"Code Refactoring", "hidden": false},
10-
{"type": "build", "section":"Build System", "hidden": false},
11-
{"type": "ci", "section":"CI", "hidden":false},
12-
{"type": "chore", "section":"Others", "hidden": false},
13-
{"type": "revert", "section":"Reverts", "hidden": false},
14-
{"type": "optimize", "section": "Optimize", "hidden": false},
15-
{"type": "wip", "section": "Development", "hidden": false},
16-
{"type": "types", "section": "TypeScript File", "hidden": false}
3+
{
4+
"type": "feat",
5+
"section": "Features",
6+
"hidden": false
7+
},
8+
{
9+
"type": "fix",
10+
"section": "Bug Fixes",
11+
"hidden": false
12+
},
13+
{
14+
"type": "docs",
15+
"section": "Docs",
16+
"hidden": false
17+
},
18+
{
19+
"type": "style",
20+
"section": "Styling",
21+
"hidden": false
22+
},
23+
{
24+
"type": "refactor",
25+
"section": "Code Refactoring",
26+
"hidden": false
27+
},
28+
{
29+
"type": "perf",
30+
"section": "Performance Improvements",
31+
"hidden": false
32+
},
33+
{
34+
"type": "test",
35+
"section": "Tests",
36+
"hidden": false
37+
},
38+
{
39+
"type": "build",
40+
"section": "Build System",
41+
"hidden": false
42+
},
43+
{
44+
"type": "ci",
45+
"section": "CI",
46+
"hidden": false
47+
},
48+
{
49+
"type": "chore",
50+
"section": "Others",
51+
"hidden": false
52+
},
53+
{
54+
"type": "revert",
55+
"section": "Reverts",
56+
"hidden": false
57+
}
1758
]
1859
}

commitlint.config.js

+52-130
Original file line numberDiff line numberDiff line change
@@ -1,168 +1,90 @@
1-
/* @see: https://cz-git.qbenben.com/zh/guide */
2-
/** @type {import('cz-git').UserConfig} */
3-
/* CHANGELOG.md @see: https://www.5axxw.com/wiki/content/yy4uxs#96t5oseui9?w */
4-
/**
5-
* feat:新特性、新功能
6-
* fix:修改 Bug
7-
* perf:优化相关,比如提升性能、体验
8-
* style:代码格式修改, 注意不是 CSS 修改
9-
* docs:仅文档新增、改动
10-
* test:测试用例修改
11-
* refactor:代码重构
12-
* build:编译相关的修改,例如发布版本、对项目构建或者依赖的改动
13-
* ci:持续集成修改
14-
* chore:其他修改, 比如改变构建流程、或者增加依赖库、工具等
15-
* revert:回滚到上一个版本
16-
* optimize: 优化构建工具或运行时性能
17-
* wip: 开发中
18-
* types: 类型定义文件更改
19-
*/
20-
/**
21-
* git commit -m <type>[optional scope]: <subject>
22-
*
23-
type :用于表明我们这次提交的改动类型,是新增了功能?还是修改了测试代码?又或者是更新了文档
24-
optional scope:一个可选的修改范围。用于标识此次提交主要涉及到代码中哪个模块。
25-
subject:一句话描述此次提交的主要内容,做到言简意赅
26-
如:
27-
* git commit -m 'fix(hooks): 修复 xxx 的 bug'
28-
* git commit -m 'refactor: 重构整个项目'
29-
*/
30-
export default {
1+
// docs:https://cz-git.qbb.sh/zh
2+
import { defineConfig } from "cz-git";
3+
4+
export default defineConfig({
315
ignores: [commit => commit.includes("init")],
326
extends: ["@commitlint/config-conventional"],
337
rules: {
34-
"body-leading-blank": [2, "always"], // body 换行
35-
"footer-leading-blank": [1, "always"], // footer 以空行开头
36-
"header-max-length": [2, "always", 108], // header 最长 108
37-
"subject-empty": [2, "never"], // subject 不能为空
38-
"type-empty": [2, "never"], // type 不能为空
398
"type-enum": [
409
2,
4110
"always",
42-
[
43-
"feat",
44-
"fix",
45-
"perf",
46-
"style",
47-
"docs",
48-
"test",
49-
"refactor",
50-
"build",
51-
"ci",
52-
"chore",
53-
"revert",
54-
"optimize",
55-
"wip",
56-
"types",
57-
],
11+
["feat", "fix", "docs", "style", "refactor", "perf", "test", "build", "ci", "revert", "chore"],
5812
],
5913
},
6014
prompt: {
6115
messages: {
62-
// type: "Select the type of change that you're committing:",
63-
// scope: "Denote the SCOPE of this change (optional):",
64-
// customScope: "Denote the SCOPE of this change:",
65-
// subject: "Write a SHORT, IMPERATIVE tense description of the change:\n",
66-
// body: 'Provide a LONGER description of the change (optional). Use "|" to break new line:\n',
67-
// breaking: 'List any BREAKING CHANGES (optional). Use "|" to break new line:\n',
68-
// footerPrefixsSelect: "Select the ISSUES type of changeList by this change (optional):",
69-
// customFooterPrefixs: "Input ISSUES prefix:",
70-
// footer: "List any ISSUES by this change. E.g.: #31, #34:\n",
71-
// confirmCommit: "Are you sure you want to proceed with the commit above?",
72-
// 中文版
73-
type: "选择你要提交的类型 :",
74-
scope: "选择一个提交范围(可选):",
75-
customScope: "请输入自定义的提交范围 :",
76-
subject: "填写简短精炼的变更描述 :\n",
77-
body: '填写更加详细的变更描述(可选)。使用 "|" 换行 :\n',
78-
breaking: '列举非兼容性重大的变更(可选)。使用 "|" 换行 :\n',
79-
footerPrefixsSelect: "选择关联 issue 前缀(可选):",
80-
customFooterPrefixs: "输入自定义 issue 前缀 :",
81-
footer: "列举关联issue (可选) 例如: #31, #I3244 :\n",
16+
type: "选择你要提交的类型: ",
17+
scope: "选择一个提交范围(可选): ",
18+
customScope: "请输入自定义的提交范围: ",
19+
subject: "填写简短精炼的变更描述:\n",
20+
body: '填写更加详细的变更描述(可选)。使用 "|" 换行:\n',
21+
breaking: '列举非兼容性重大的变更(可选)。使用 "|" 换行:\n',
22+
footerPrefixesSelect: "选择关联 Issue 前缀(可选): ",
23+
customFooterPrefix: "输入自定义 Issue 前缀: ",
24+
footer: "列举关联 Issue (可选) 例如: #31, #I3244:\n",
8225
confirmCommit: "是否提交或修改 commit ?",
8326
},
8427
types: [
85-
// { value: "feat", name: "feat: 🚀 A new feature", emoji: "🚀" },
86-
// { value: "fix", name: "fix: 🐞 A bug fix", emoji: "🐞" },
87-
// { value: "docs", name: "docs: 📚 Documentation only changes", emoji: "📚" },
88-
// { value: "style", name: "style: 🎨 Changes that do not affect the meaning of the code", emoji: "🎨" },
89-
// {
90-
// value: "refactor",
91-
// name: "refactor: ♻️ A code change that neither fixes a bug nor adds a feature",
92-
// emoji: "♻️",
93-
// },
94-
// { value: "perf", name: "perf: ⚡️ A code change that improves performance", emoji: "⚡️" },
95-
// { value: "test", name: "test: ✅ Adding missing tests or correcting existing tests", emoji: "✅" },
96-
// {
97-
// value: "build",
98-
// name: "build: 📦️ Changes that affect the build system or external dependencies",
99-
// emoji: "📦️",
100-
// },
101-
// { value: "ci", name: "ci: 🎡 Changes to our CI configuration files and scripts", emoji: "🎡" },
102-
// { value: "chore", name: "chore: 🔨 Other changes that don't modify src or test files", emoji: "🔨" },
103-
// { value: "revert", name: "revert: ⏪️ Reverts a previous commit", emoji: "⏪️" },
104-
// { value: "wip", name: "wip: 🥗 Code development in progress", emoji: "🥗" },
105-
// { value: "types", name: "types: 💎 TypeScript Definition File Change", emoji: "💎" },
106-
// 中文版
107-
{ value: "feat", name: "feat: 🚀 新增功能", emoji: "🚀" },
108-
{ value: "fix", name: "fix: 🐞 修复缺陷(Bug)", emoji: "🐞" },
109-
{ value: "docs", name: "docs: 📚 文档变更", emoji: "📚" },
110-
{ value: "style", name: "style: 🎨 代码格式(不影响功能,例如空格、分号等格式修正)", emoji: "🎨" },
111-
{ value: "refactor", name: "refactor: ♻️ 代码重构(不包括 bug 修复、功能新增)", emoji: "♻️" },
112-
{ value: "perf", name: "perf: ⚡️ 性能优化", emoji: "⚡️" },
113-
{ value: "test", name: "test: ✅ 添加疏漏测试或已有测试改动", emoji: "✅" },
28+
{ value: "feat", name: "feat: 🚀 新增功能 | A new feature", emoji: "🚀" },
29+
{ value: "fix", name: "fix: 🐞 修复缺陷 | A bug fix", emoji: "🐞" },
30+
{ value: "docs", name: "docs: 📚 文档更新 | Documentation only changes", emoji: "📚" },
31+
{
32+
value: "style",
33+
name: "style: 🎨 代码格式 | Changes that do not affect the meaning of the code",
34+
emoji: "🎨",
35+
},
36+
{
37+
value: "refactor",
38+
name: "refactor: ♻️ 代码重构 | A code change that neither fixes a bug nor adds a feature",
39+
emoji: "♻️",
40+
},
41+
{ value: "perf", name: "perf: ⚡️ 性能优化 | A code change that improves performance", emoji: "⚡️" },
42+
{
43+
value: "test",
44+
name: "test: ✅ 测试相关 | Adding missing tests or correcting existing tests",
45+
emoji: "✅",
46+
},
11447
{
11548
value: "build",
116-
name: "build: 📦️ 构建流程、外部依赖变更(如升级 npm 包、修改 webpack 配置等)",
49+
name: "build: 📦️ 构建相关 | Changes that affect the build system or external dependencies",
11750
emoji: "📦️",
11851
},
119-
{ value: "ci", name: "ci: 🎡 修改 CI 配置、脚本", emoji: "🎡" },
120-
{ value: "chore", name: "chore: 🔨 回滚 commit", emoji: "⏪️" },
121-
{ value: "revert", name: "revert: ⏪️ 对构建过程或辅助工具和库的更改(不影响源文件、测试用例)", emoji: "🔨" },
122-
{ value: "wip", name: "wip: 🥗 代码正在开发中", emoji: "🥗" },
123-
{ value: "types", name: "types: 💎 类型定义文件更改", emoji: "💎" },
124-
// 纯中文版
125-
// { value: "特性", name: "特性: 🚀 新增功能", emoji: "🚀" },
126-
// { value: "修复", name: "修复: 🐞 修复缺陷", emoji: "🐞" },
127-
// { value: "文档", name: "文档: 📚 文档变更", emoji: "📚" },
128-
// { value: "格式", name: "格式: 🎨 代码格式(不影响功能,例如空格、分号等格式修正)", emoji: "🎨" },
129-
// { value: "重构", name: "重构: ♻️ 代码重构(不包括 bug 修复、功能新增)", emoji: "♻️" },
130-
// { value: "性能", name: "性能: ⚡️ 性能优化", emoji: "⚡️" },
131-
// { value: "测试", name: "测试: ✅ 添加疏漏测试或已有测试改动", emoji: "✅" },
132-
// { value: "构建", name: "构建: 📦️ 构建流程、外部依赖变更(如升级 npm 包、修改 webpack 配置等)", emoji: "📦️" },
133-
// { value: "集成", name: "集成: 🎡 修改 CI 配置、脚本", emoji: "🎡" },
134-
// { value: "回退", name: "回退: ⏪️ 回滚 commit", emoji: "⏪️" },
135-
// { value: "其他", name: "其他: 🔨 对构建过程或辅助工具和库的更改(不影响源文件、测试用例)", emoji: "🔨" },
136-
// { value: "开发中", name: "开发中: 🥗 代码正在开发中", emoji: "🥗" },
137-
// { value: "类型", name: "类型: 💎 类型定义文件更改", emoji: "💎" },
52+
{ value: "ci", name: "ci: 🎡 持续集成 | Changes to our CI configuration files and scripts", emoji: "🎡" },
53+
{ value: "revert", name: "revert: ⏪️ 回退代码 | Revert to a commit", emoji: "⏪️" },
54+
{
55+
value: "chore",
56+
name: "chore: 🔨 其他修改 | Other changes that do not modify src or test files",
57+
emoji: "🔨",
58+
},
13859
],
13960
useEmoji: true,
61+
emojiAlign: "center",
14062
themeColorCode: "",
63+
useAI: false,
64+
aiNumber: 1,
14165
scopes: [],
14266
allowCustomScopes: true,
14367
allowEmptyScopes: true,
14468
customScopesAlign: "bottom",
14569
customScopesAlias: "custom",
14670
emptyScopesAlias: "empty",
14771
upperCaseSubject: false,
72+
markBreakingChangeMode: false,
14873
allowBreakingChanges: ["feat", "fix"],
14974
breaklineNumber: 100,
15075
breaklineChar: "|",
15176
skipQuestions: [],
152-
issuePrefixs: [{ value: "closed", name: "closed: ISSUES has been processed" }],
153-
customIssuePrefixsAlign: "top",
154-
emptyIssuePrefixsAlias: "skip",
155-
customIssuePrefixsAlias: "custom",
156-
allowCustomIssuePrefixs: true,
157-
allowEmptyIssuePrefixs: true,
77+
issuePrefixes: [{ value: 'closed', name: 'closed: ISSUES has been processed' }],
78+
customIssuePrefixAlign: "top",
79+
emptyIssuePrefixAlias: "skip",
80+
customIssuePrefixAlias: "custom",
81+
allowCustomIssuePrefix: true,
82+
allowEmptyIssuePrefix: true,
15883
confirmColorize: true,
159-
maxHeaderLength: Infinity,
160-
maxSubjectLength: Infinity,
161-
minSubjectLength: 0,
16284
scopeOverrides: undefined,
16385
defaultBody: "",
16486
defaultIssues: "",
16587
defaultScope: "",
16688
defaultSubject: "",
16789
},
168-
};
90+
});

docs/.vitepress/config.mts

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ const description = ["vitepress-theme-teek 使用文档", "vitepress 主题框
77
const tkConfig = defineTeekConfig({
88
author: { name: "Teeker", link: "https://github.com/Kele-Bingtang" },
99
footerInfo: {
10+
theme: {
11+
name: `Theme By Teek@${version}`,
12+
},
1013
copyright: {
1114
createYear: 2025,
1215
suffix: "Teek",

docs/01.指南/01.简介/10.快速开始.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ npm run docs:dev
175175
- 如果 `.vitepress` 和 Markdown 文档在项目 `src` 目录下,则 `vitepress dev docs` 改为 `vitepress dev src`
176176
- 如果 `.vitepress` 在项目根目录下,Markdown 文档放在 `src` 目录下,则 `vitepress dev docs` 改为 `vitepress dev`,且需要在 `.vitepress/config.ts` 里配置 `srcDir: src``srcDir` 的作用请看 [Vitepress - srcDir](https://vitepress.dev/zh/reference/site-config#srcdir)
177177

178-
总结:Vitepress 以 `.vitepress` 所在的目录层级为参照逐层对 Markdown 文档扫描解析。
178+
总结:Vitepress 以 `.vitepress` 所在的目录层级 + `srcDir` 为参照逐层对 Markdown 文档扫描解析。
179179

180180
## Teek 本地安装(可选)
181181

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"lint:prettier": "prettier --write \"src/**/*.{js,ts,json,tsx,css,less,scss,vue,html,md}\"",
3838
"lint:eslint": "eslint --max-warnings 0 \"{src,mock,build}/**/*.{vue,js,ts,tsx}\" --fix",
3939
"lint": "yarn lint:eslint && yarn lint:prettier",
40+
"prepare": "husky install",
4041
"cs": "pnpm changeset",
4142
"cs:version": "pnpm changeset version",
4243
"cs:release": "pnpm run plugin:build && changeset publish",

vitepress-theme-teek/src/components/Footer/src/index.vue

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { useNamespace } from "../../../hooks";
55
import { themeIcon, copyrightIcon, icpRecordIcon } from "../../../assets/icons";
66
// @ts-ignore
77
import securityRecordImg from "../../../assets/img/securityRecord.png";
8-
import { version } from "../../../version";
98
import Icon from "../../Icon";
109
import type { FooterInfo, Social } from "../../../config/types";
1110
@@ -26,7 +25,7 @@ const footerData = computed(() => {
2625
// 1.主题版权
2726
if (theme.show !== false) {
2827
data.push({
29-
name: `Theme By Teek@${version}`,
28+
name: "Theme By Teek",
3029
icon: themeIcon,
3130
link: "https://teek.tianke99.cn",
3231
// 可覆盖上面的配置项

vitepress-theme-teek/src/styles/var/theme-size.scss

+7-5
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,6 @@ html[theme-size="small"] {
7474
@include set-css-var("home-font-size-sm", 13px);
7575
@include set-css-var("home-font-size-small", 12px);
7676
@include set-css-var("page-width", 800px);
77-
--vp-layout-max-width: 1300px;
78-
--vp-sidebar-width: 290px;
79-
--vp-content-container: 688px;
8077
}
8178

8279
@media (min-width: 768px) {
@@ -102,10 +99,15 @@ html[theme-size="small"] {
10299
html[theme-size="wide"] {
103100
--vp-layout-max-width: 97vw;
104101
--vp-sidebar-width: 290px;
105-
--vp-content-container: 1800px;
102+
--vp-content-container: 100vw;
106103
}
107104
html[theme-size="large"] {
108105
--vp-layout-max-width: 90%;
109-
--vp-content-container: 1200px;
106+
--vp-content-container: 63vw;
107+
}
108+
html[theme-size="small"] {
109+
--vp-layout-max-width: 1300px;
110+
--vp-sidebar-width: 290px;
111+
--vp-content-container: 688px;
110112
}
111113
}

0 commit comments

Comments
 (0)