Skip to content

Commit 96979e2

Browse files
authored
docs: add Simplified Chinese documentation (#1413)
1 parent c062cf7 commit 96979e2

File tree

8 files changed

+1127
-540
lines changed

8 files changed

+1127
-540
lines changed

docs/.vitepress/config.mts

+51-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,56 @@ export default defineConfig({
2323
{ text: 'How To', link: '/how-to' },
2424
{ text: 'Troubleshoot', link: '/troubleshoot' },
2525
{ text: 'Migrate from v4', link: '/migrate-from-v4' },
26-
],
26+
],
27+
nav: [
28+
{
29+
text: 'v9.0.1',
30+
items: [
31+
{
32+
text: 'Changelog',
33+
link: 'https://github.com/typicode/husky/releases/tag/v9.0.1'
34+
}
35+
]
36+
}
37+
]
38+
},
39+
locales: {
40+
root: {
41+
label: 'English',
42+
lang: 'en-US'
43+
},
44+
zh: {
45+
label: '简体中文',
46+
lang: 'zh-hans',
47+
description: '使 Git hooks 变得简单',
48+
link: '/zh/',
49+
themeConfig: {
50+
sidebar: [
51+
{ text: '简介', link: '/zh/' },
52+
{ text: '快速开始', link: '/zh/get-started' },
53+
{ text: '如何使用', link: '/zh/how-to' },
54+
{ text: '故障排查', link: '/zh/troubleshoot' },
55+
{ text: '从 v4 迁移', link: '/zh/migrate-from-v4' },
56+
],
57+
docFooter: {
58+
prev: '上一页',
59+
next: '下一页'
60+
},
61+
outline: {
62+
label: '页面导航'
63+
},
64+
nav: [
65+
{
66+
text: 'v9.0.1',
67+
items: [
68+
{
69+
text: '更新日志',
70+
link: 'https://github.com/typicode/husky/releases/tag/v9.0.1'
71+
}
72+
]
73+
}
74+
]
75+
}
76+
}
2777
}
2878
})

docs/package-lock.json

+491-537
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
},
66
"devDependencies": {
77
"sponsorkit": "^0.9.1",
8-
"vitepress": "^1.0.0-rc.40"
8+
"vitepress": "^1.0.1"
99
}
10-
}
10+
}

docs/zh/get-started.md

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# 快速开始
2+
3+
## 安装
4+
5+
::: code-group
6+
7+
```shell [npm]
8+
npm install --save-dev husky
9+
```
10+
11+
```shell [pnpm]
12+
pnpm add --save-dev husky
13+
```
14+
15+
```shell [yarn]
16+
yarn add --dev husky
17+
# 如果你的项目不是私有的,那么只需要安装 pinst
18+
yarn add --dev pinst
19+
```
20+
21+
```shell [bun]
22+
bun add --dev husky
23+
```
24+
25+
:::
26+
27+
## `husky init` <Badge type="tip" text="推荐" />
28+
29+
`init` 命令简化了项目中的 husky 设置。它会在 `.husky/` 中创建 `pre-commit` 脚本,并更新 `package.json` 中的 `prepare` 脚本。随后可根据你的工作流进行修改。
30+
31+
::: code-group
32+
33+
```shell [npm]
34+
npx husky init
35+
```
36+
37+
```shell [pnpm]
38+
pnpm exec husky init
39+
```
40+
41+
```shell [yarn]
42+
# 由于特殊的注意事项和与其他包管理器的差异,
43+
# 请参考“如何使用”章节。
44+
```
45+
46+
```shell [bun]
47+
bunx husky init
48+
```
49+
50+
:::
51+
52+
53+
## 试一试
54+
55+
恭喜你!你已经成功地用一个命令设置了你的第一个 Git 钩子 🎉。让我们测试一下:
56+
57+
```shell
58+
git commit -m "Keep calm and commit"
59+
# 测试脚本会在每次提交时运行
60+
```
61+
62+
_有关手动设置和更多信息,请参见 [如何使用](how-to.md) 章节_
63+

0 commit comments

Comments
 (0)