Skip to content

Commit 545c2fb

Browse files
DaZuiZuicursoragent
andcommitted
fix(ci): 修复 CI 失败的机制性问题
- package.json: 补回 docs-zh-hk 自己的 scripts (lint/clean/sync) 与 devDependencies (zhlint/commander/open/simple-git) - ci.yml: pnpm-action 升级到 v4 + version 10 (与 packageManager 字段对齐),pull_request branches 由 master 改为 main,pnpm install 改为 --frozen-lockfile - pnpm-lock.yaml: 配合上面依赖变更重新生成(pnpm 10 格式) - patches/zhlint@0.8.1.patch: 修补 case-abbrs.js 递归调用时 abbr[0] 为 undefined 触发 toLowerCase crash 的 bug - guide/essentials/event-handling.md: 顺手把两处 i.e. 英文注释翻译成繁中 Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent be2776e commit 545c2fb

5 files changed

Lines changed: 998 additions & 25 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ on:
44
push:
55
branches-ignore: ['gh-pages']
66
pull_request:
7-
branches: [master]
7+
branches: [main]
88

99
jobs:
1010
build:
1111
runs-on: ubuntu-latest
1212

1313
steps:
1414
- uses: actions/checkout@v4
15-
- uses: pnpm/action-setup@v2
15+
- uses: pnpm/action-setup@v4
1616
with:
17-
version: 8
17+
version: 10
1818
- uses: actions/setup-node@v4
1919
with:
2020
node-version: 20
2121
cache: 'pnpm'
2222
- run: |
23-
pnpm install
23+
pnpm install --frozen-lockfile
2424
pnpm lint

package.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
"dev": "vitepress",
66
"build": "vitepress build",
77
"preview": "vitepress preview",
8+
"lint": "zhlint 'src/{api,about,guide,sponsor,translations,tutorial}/**/*.md'",
9+
"clean": "rm -rf .vitepress/dist",
10+
"sync": "node scripts/sync.js",
811
"preinstall": "npx only-allow pnpm",
912
"type": "vue-tsc --noEmit"
1013
},
@@ -20,11 +23,15 @@
2023
"@types/body-scroll-lock": "^3.1.2",
2124
"@types/markdown-it": "^14.1.2",
2225
"@types/node": "^25.5.2",
26+
"commander": "^9.5.0",
27+
"open": "^10.1.0",
2328
"oxc-minify": "^0.124.0",
29+
"simple-git": "^3.27.0",
2430
"typescript": "^5.9.3",
2531
"vitepress-plugin-group-icons": "^1.7.3",
2632
"vitepress-plugin-llms": "^1.12.0",
27-
"vue-tsc": "^3.2.6"
33+
"vue-tsc": "^3.2.6",
34+
"zhlint": "0.8.1"
2835
},
2936
"engines": {
3037
"node": ">=20"
@@ -37,6 +44,9 @@
3744
"onlyBuiltDependencies": [
3845
"esbuild",
3946
"vue-demi"
40-
]
47+
],
48+
"patchedDependencies": {
49+
"zhlint@0.8.1": "patches/zhlint@0.8.1.patch"
50+
}
4151
}
4252
}

patches/zhlint@0.8.1.patch

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
diff --git a/lib/rules/case-abbrs.js b/lib/rules/case-abbrs.js
2+
index 3a7b720f7c809d7571a6ae39bf5b8354177a7fb9..3342164087b9c64b6f404d3aad2429599672c800 100644
3+
--- a/lib/rules/case-abbrs.js
4+
+++ b/lib/rules/case-abbrs.js
5+
@@ -27,10 +27,10 @@ const reverseAbbrsIntoChars = (abbrs) => {
6+
const matchAbbr = (token, group, reversedAbbrChars) => {
7+
// find previous token
8+
const tokenBefore = findTokenBefore(group, token);
9+
- if (tokenBefore && !tokenBefore.spaceAfter) {
10+
+ if (tokenBefore && !tokenBefore.spaceAfter && tokenBefore.value !== undefined) {
11+
// get the next matching abbr chars by removing the last char and filtering
12+
const matchedAbbrChars = reversedAbbrChars
13+
- .filter((abbr) => abbr[0].toLowerCase() === tokenBefore.value.toLowerCase())
14+
+ .filter((abbr) => abbr.length > 0 && typeof abbr[0] === 'string' && abbr[0].toLowerCase() === String(tokenBefore.value).toLowerCase())
15+
.map((abbr) => abbr.slice(1));
16+
// keep matching until any abbr chars fully matched
17+
// then return true

0 commit comments

Comments
 (0)