Skip to content

Commit

Permalink
refactor(site): new website deploy | use vitepress
Browse files Browse the repository at this point in the history
  • Loading branch information
Zhengqbbb committed Jun 16, 2022
1 parent 1fccf21 commit d2a310e
Show file tree
Hide file tree
Showing 121 changed files with 2,284 additions and 3,269 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@
"**/.x-cmd/**": "shellscript",
},
"picgo.picBed.github.path": "cz/",
"unocss.root": "docs-next/.vitepress/build/plugins/unocss.ts"
"unocss.root": "docs/.vitepress/build/plugins/unocss.ts"
}
1 change: 1 addition & 0 deletions docs-zh/.vitepress/components
File renamed without changes.
13 changes: 13 additions & 0 deletions docs-zh/.vitepress/configs/basic.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { LocaleConfig } from "vitepress";
import { name, descriptionCN } from "../meta";

export const base = "/zh/";

export const locales: Record<string, LocaleConfig> = {
"/": {
title: name,
description: descriptionCN,
lang: "zh-CN",
label: "简体中文"
}
};
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions docs-zh/.vitepress/configs/navbar/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./zh";
33 changes: 33 additions & 0 deletions docs-zh/.vitepress/configs/navbar/zh.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import type { DefaultTheme } from "vitepress";
import { version, github, npm } from "../../meta";

export const zh: DefaultTheme.NavItem[] = [
{
text: "指南",
link: "/guide/",
activeMatch: "/guide/"
},
{
text: "配置",
link: "/config/",
activeMatch: "/config/"
},
{
text: "窍门",
link: "/recipes/",
activeMatch: "/recipes/"
},
{
text: `v${version}`,
items: [
{
text: "变更日志",
link: github + "/blob/main/CHANGELOG.md"
},
{
text: "NPM",
link: npm
}
]
}
];
1 change: 1 addition & 0 deletions docs-zh/.vitepress/configs/sidebar/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./zh";
80 changes: 80 additions & 0 deletions docs-zh/.vitepress/configs/sidebar/zh.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import type { DefaultTheme } from "vitepress";

export const zh: DefaultTheme.Sidebar = {
"/": [
{
text: "指南",
collapsible: true,
collapsed: false,
items: [
{
text: "简介",
link: "/guide/introduction"
},
{
text: "动机",
link: "/guide/why"
},
{
text: "快速开始",
link: "/guide/"
}
]
},
{
text: "配置",
collapsible: true,
collapsed: false,
items: [
{
text: "配置模板",
link: "/config/"
},
{
text: "显示相关",
link: "/config/show"
},
{
text: "工程化相关",
link: "/config/engineer"
}
]
},
{
text: "窍门",
collapsible: true,
collapsed: false,
items: [
{
text: "scopes",
link: "/recipes/"
},
{
text: "issuePrefixs",
link: "/recipes/issuePrefixs"
},
{
text: "defaultScope",
link: "/recipes/defaultScope"
},
{
text: "defaultSubject",
link: "/recipes/defaultSubject"
},
{
text: "defaultIssues",
link: "/recipes/defaultIssues"
}
]
},
{
text: "常见问题",
items: [
{
text: "FAQ",
link: "/faq/"
}
]
}
]
};
31 changes: 31 additions & 0 deletions docs-zh/.vitepress/configs/theme.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import type { DefaultTheme } from "vitepress";
import * as nav from "./navbar";
import * as sidebar from "./sidebar";
import { github, site } from "../meta";

/**
* Theme configs let you customize your theme.
* @see https://vitepress.vuejs.org/config/theme-configs.html
*/
export const themeConfig: DefaultTheme.Config = {
logo: "/images/logo.png",
socialLinks: [{ icon: "github", link: github }],
editLink: {
pattern: `${github}/edit/main/docs-zh/:path`,
text: "在 GitHub 上编辑此页"
},
localeLinks: {
text: "简体中文",
items: [{ text: "English", link: site }]
},
algolia: {
appId: "QC8EFXZNC3",
apiKey: "bf9a47e8561e6b8ffdda0bf8595a2f5d",
indexName: "cz-git",
searchParameters: {
facetFilters: ["lang:zh-CN"]
}
},
nav: nav.zh,
sidebar: sidebar.zh
};
1 change: 1 addition & 0 deletions docs-zh/.vitepress/meta.ts
1 change: 1 addition & 0 deletions docs-zh/.vitepress/style
24 changes: 24 additions & 0 deletions docs-zh/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { h } from "vue";
import Theme from "vitepress/theme";
import "../style/main.css";
import "../style/vars.css";
import "uno.css";
import { useMediumZoomProvider, usePageAnalytics } from "../components/composables";
import HomePage from "../components/HomePage.vue";
import { inBrowser } from "vitepress";
import type { EnhanceAppContext } from "vitepress";

if (inBrowser) import("./pwa");

export default {
...Theme,
Layout() {
return h(Theme.Layout, null, {
"home-features-after": () => h(HomePage)
});
},
enhanceApp({ app, router }: EnhanceAppContext) {
useMediumZoomProvider(app, router);
usePageAnalytics("G-K6F2G4G0ZN", "da331747a43e6c97f6ebd1e68ed3dcc8");
}
};
File renamed without changes.
166 changes: 166 additions & 0 deletions docs-zh/config/engineer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
---
title: 工程化相关
sidebarDepth: 1
lastUpdated: true
sitemap:
priority: 0.6
---

# 工程化规范化相关

## scopes

- **描述** : 自定义选择 **模块范围** 命令行显示信息
- **类型** : `string[] | Array<{ name: string, value?: string }>`
- **默认** : `[]`

::: tip
如果你使用 [commitlint](https://github.com/conventional-changelog/commitlint) 规则定义了 `scope-enum`,会自动引入。<br>
[⇒ 更多小窍门](/recipes/#scopes)
:::

## scopeOverrides

- **描述** : 自定义选择了特定**类型****覆盖模块范围** 命令行显示信息
- **类型** : <br>`{ [type: string]: string[] | Array<{ name: string, value?: string }> } | undefined`
- **默认** : `undefined`
- **例子** : `scopeOverrides: { "test": ["e2eTest", "unitTest"] }`
- **使用** : 针对选择 ==特定== 的 commit **类型** `type` 后选择模块范围时显示 自定义的模块范围选择

:::tip
如果定义`scopeOverrides` 就要定义通用的 `scopes`
:::

## scopeFilters

- **描述** : Filter select of prompt to select module scopes by the scope.value
- **描述** : 根据 scope.value 过滤模块范围中的选项
- **类型** : string[]
- **默认** : `[".DS_Store"]`

## enableMultipleScopes

- **描述** : 是否开启在选择 **模块范围** 时使用多选模式
- **类型** : `boolean`
- **默认** : `false`

:::tip
尝试运行 `checkbox=1 cz` **可在当前会话直接开启多选模式**
示例与使用方式 [⇒ 查看小窍门](/recipes/#支持多选-scopes)
:::

## scopeEnumSeparator

- **描述** : 在多选模式下 **模块范围** 之间的分隔符
- **类型** : `string`
- **默认** : `,`

## allowCustomScopes

- **描述** : 是否在选择 **模块范围** 显示自定义选项(custom)
- **类型** : `boolean`
- **默认** : `true`
- **使用** : 没有使用 `commitlint`并且想在选择中关闭自定义选项

:::tip
会自动检测 [commitlint](https://github.com/conventional-changelog/commitlint) 规则 `scope-enum`的定义是否严格,自动不显示。
:::

## allowEmptyScopes

- **描述** : 是否在选择 **模块范围** 显示为空选项(empty)
- **类型** : `boolean`
- **默认** : `true`

:::tip
会自动检测 [commitlint](https://github.com/conventional-changelog/commitlint) 规则 `scope-empty`的定义是否严格,自动不显示。
:::

## allowBreakingChanges

- **描述** : 允许出现 重大变更(BREAKING CHANGES)的特定 **type**
- **类型** : `string[]`
- **默认** : `['feat', 'fix']`

## upperCaseSubject

- **描述** : 是否自动将简短描述(subject)第一个字符进行大写处理
- **类型** : `boolean`
- **默认** : `false`

## breaklineNumber

- **描述** : 详细描述(body)和重大变更(BREAKING CHANGES)中根据字符超过该数值自动换行
- **类型** : `number`
- **默认** : `100`
- **使用** : 当没有使用 commitlint 并要使用规范化时

:::tip
主要根据**单词完整性**进行换行 <br>
如果使用 commitlint 会自动读取 `body-max-line-length` 进行设置
:::

## breaklineChar

- **描述** : 详细描述(body)和重大变更(BREAKING CHANGES)中换行字符
- **类型** : `string`
- **默认** : `"|"`

## skipQuestions

- **描述** : 自定义选择指定的问题不显示
- **类型** : `Array<"scope" | "body" | "breaking" | "footerPrefix" | "footer">`
- **默认** : `[]`

## issuePrefixs

- **描述** : 自定义选择issue前缀
- **类型** : `Array<{ value: string, name: string }>`
- **默认** : `[{ value: "closed", name: "closed: ISSUES has been processed" }]`

:::tip
国内用户如果使用 Gitee 作为项目管理,那么该工具可以很好<br/> ==利用 commit message改变issue状态== [⇒ 查看小窍门](/recipes/issuePrefixs.html)
:::

## allowCustomIssuePrefixs

- **描述** : 是否在选择 **ISSUE 前缀** 显示自定义选项(custom)
- **类型** : `boolean`
- **默认** : `true`

## allowEmptyIssuePrefixs

- **描述** : 是否在选择 **ISSUE 前缀** 显示为跳过选项(skip)
- **类型** : `boolean`
- **默认** : `true`

## maxHeaderLength

- **描述** : 定义commit message中的 header 长度, 给予在命令行中的校验信息
- **类型** : `number`
- **默认** : `Infinity`
- **使用** : 当没有使用 commitlint 并要使用规范化时

:::tip
如果使用 commitlint 会自动读取 `header-max-length` 进行设置给予在命令行中的提示
:::

## maxSubjectLength

- **描述** : 定义commit message中的 subject 长度, 给予在命令行中的校验信息
- **类型** : `number`
- **默认** : `Infinity`
- **使用** : 当没有使用 commitlint,并要使用规范化时
:::tip
如果使用 commitlint 会自动读取 `subject-max-length` 进行设置给予在命令行中的提示
:::

## minSubjectLength

- **描述** : 定义commit message中的 subject 长度, 给予在命令行中的校验信息
- **类型** : `number`
- **默认** : `0`
- **使用** : 当没有使用 commitlint,并要使用规范化时
:::tip
如果使用 commitlint 会自动读取 `subject-min-length` 进行设置给予在命令行中的提示
:::
Loading

0 comments on commit d2a310e

Please sign in to comment.