Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add Simplified Chinese documentation #1413

Merged
merged 3 commits into from May 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
52 changes: 51 additions & 1 deletion docs/.vitepress/config.mts
Expand Up @@ -23,6 +23,56 @@ export default defineConfig({
{ text: 'How To', link: '/how-to' },
{ text: 'Troubleshoot', link: '/troubleshoot' },
{ text: 'Migrate from v4', link: '/migrate-from-v4' },
],
],
nav: [
{
text: 'v9.0.1',
items: [
{
text: 'Changelog',
link: 'https://github.com/typicode/husky/releases/tag/v9.0.1'
}
]
}
]
},
locales: {
root: {
label: 'English',
lang: 'en-US'
},
zh: {
label: '简体中文',
lang: 'zh-hans',
description: '使 Git hooks 变得简单',
link: '/zh/',
themeConfig: {
sidebar: [
{ text: '简介', link: '/zh/' },
{ text: '快速开始', link: '/zh/get-started' },
{ text: '如何使用', link: '/zh/how-to' },
{ text: '故障排查', link: '/zh/troubleshoot' },
{ text: '从 v4 迁移', link: '/zh/migrate-from-v4' },
],
docFooter: {
prev: '上一页',
next: '下一页'
},
outline: {
label: '页面导航'
},
nav: [
{
text: 'v9.0.1',
items: [
{
text: '更新日志',
link: 'https://github.com/typicode/husky/releases/tag/v9.0.1'
}
]
}
]
}
}
}
})
1,028 changes: 491 additions & 537 deletions docs/package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/package.json
Expand Up @@ -5,6 +5,6 @@
},
"devDependencies": {
"sponsorkit": "^0.9.1",
"vitepress": "^1.0.0-rc.40"
"vitepress": "^1.0.1"
}
}
}
63 changes: 63 additions & 0 deletions docs/zh/get-started.md
@@ -0,0 +1,63 @@
# 快速开始

## 安装

::: code-group

```shell [npm]
npm install --save-dev husky
```

```shell [pnpm]
pnpm add --save-dev husky
```

```shell [yarn]
yarn add --dev husky
# 如果你的项目不是私有的,那么只需要安装 pinst
yarn add --dev pinst
```

```shell [bun]
bun add --dev husky
```

:::

## `husky init` <Badge type="tip" text="推荐" />

`init` 命令简化了项目中的 husky 设置。它会在 `.husky/` 中创建 `pre-commit` 脚本,并更新 `package.json` 中的 `prepare` 脚本。随后可根据你的工作流进行修改。

::: code-group

```shell [npm]
npx husky init
```

```shell [pnpm]
pnpm exec husky init
```

```shell [yarn]
# 由于特殊的注意事项和与其他包管理器的差异,
# 请参考“如何使用”章节。
```

```shell [bun]
bunx husky init
```

:::


## 试一试

恭喜你!你已经成功地用一个命令设置了你的第一个 Git 钩子 🎉。让我们测试一下:

```shell
git commit -m "Keep calm and commit"
# 测试脚本会在每次提交时运行
```

_有关手动设置和更多信息,请参见 [如何使用](how-to.md) 章节_