Skip to content

Commit 81fea2a

Browse files
committed
docs: use vitepress
1 parent 0a583d3 commit 81fea2a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1671
-1968
lines changed

.github/CONTRIBUTING.md

+31-5
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Please consider these guidelines when filing a pull request:
3838
_ What you added
3939
_ What you removed
4040

41-
## Coding Rules
41+
### Coding Rules
4242

4343
To keep the code base of commitlint neat and tidy the following rules apply to every change
4444

@@ -48,7 +48,7 @@ To keep the code base of commitlint neat and tidy the following rules apply to e
4848
- Favor micro library over swiss army knives (rimraf, ncp vs. fs-extra)
4949
- Be awesome
5050

51-
## Commit Rules
51+
### Commit Rules
5252

5353
To help everyone with understanding the commit history of commitlint the following commit rules are enforced.
5454
To make your life easier commitlint is commitizen-friendly and provides the npm run-script `commit`.
@@ -61,17 +61,43 @@ To make your life easier commitlint is commitizen-friendly and provides the npm
6161
- maximum of 100 characters
6262
- message format of `$type($scope): $message`
6363

64-
## Testing
64+
### Environment setup
6565

66-
From the project root directory, use the following commands to run the test suite
66+
This project uses `yarn`, so be sure that it is available in your shell environment.
67+
68+
After cloning the repo run
6769

6870
```sh
69-
yarn clean
7071
yarn install
72+
```
73+
74+
### Testing
75+
76+
From the project root directory, use the following commands to run the test suite
77+
78+
```sh
7179
yarn build
7280
yarn test
7381
```
7482

83+
### Documentation updates
84+
85+
Documentation uses `vitepress`.
86+
To run and edit the documentation locally run:
87+
88+
```sh
89+
yarn docs-dev
90+
```
91+
92+
To have a preview of the deployed doc run:
93+
94+
```sh
95+
yarn docs-build
96+
yarn docs-serve
97+
```
98+
99+
For more information refer to [vitepress documentation](https://vitepress.dev).
100+
75101
## Package dependency overview
76102

77103
![commitlint-dependencies](https://user-images.githubusercontent.com/4248851/58385093-34b79780-7feb-11e9-8f27-bffc4aca3eba.png)

.github/workflows/docs-deploy.yml

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Deploy docs site to Pages
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: pages
16+
cancel-in-progress: false
17+
18+
jobs:
19+
# Build job
20+
build:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
28+
- name: Setup Node
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: 18
32+
cache: yarn
33+
34+
- name: Setup Pages
35+
uses: actions/configure-pages@v4
36+
37+
- name: Install dependencies
38+
run: yarn install
39+
40+
- name: Build with VitePress
41+
run: |
42+
yarn docs-build
43+
touch ./docs/.vitepress/dist/.nojekyll
44+
45+
- name: Upload artifact
46+
uses: actions/upload-pages-artifact@v3
47+
with:
48+
path: ./docs/.vitepress/dist
49+
50+
# Deployment job
51+
deploy:
52+
environment:
53+
name: docs
54+
url: ${{ steps.deployment.outputs.page_url }}
55+
needs: build
56+
runs-on: ubuntu-latest
57+
name: Deploy
58+
steps:
59+
- name: Deploy to GitHub Pages
60+
id: deployment
61+
uses: actions/deploy-pages@v4

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@ package.json.lerna_backup
1313
tsconfig.tsbuildinfo
1414
coverage
1515

16+
docs/.vitepress/dist
17+
docs/.vitepress/cache
18+
1619
# For testing nested workspaces does not have the package's dependencies name in the scope
1720
!**/config-lerna-scopes/fixtures/nested-workspaces/**/node_modules

@commitlint/cli/src/cli.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ async function main(args: MainArgs): Promise<void> {
306306
name: 'empty-rules',
307307
message: [
308308
'Please add rules to your `commitlint.config.js`',
309-
' - Getting started guide: https://commitlint.js.org/#/?id=getting-started',
309+
' - Getting started guide: https://commitlint.js.org/guides/getting-started',
310310
' - Example config: https://github.com/conventional-changelog/commitlint/blob/master/%40commitlint/config-conventional/src/index.ts',
311311
].join('\n'),
312312
},

@commitlint/cz-commitlint/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,4 @@ yarn commit
5858

5959
## Related
6060

61-
- [Commitlint Reference Prompt](https://commitlint.js.org/#/reference-prompt) - How to customize prompt information by setting commitlint.config.js
61+
- [Commitlint Reference Prompt](https://commitlint.js.org/reference/prompt) - How to customize prompt information by setting commitlint.config.js

@commitlint/rules/src/index.test.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ test('rules export functions', () => {
2222

2323
test('all rules are present in documentation', () => {
2424
const file = fs.readFileSync(
25-
path.join(__dirname, '../../../docs/reference-rules.md'),
25+
path.join(__dirname, '../../../docs/reference/rules.md'),
2626
'utf-8'
2727
);
2828
const results = file
2929
.split(/(\n|\r)/)
30-
.filter((s) => s.startsWith('####') && !s.includes('`deprecated`'))
31-
.map((s) => s.replace('#### ', ''));
30+
.filter((s) => s.startsWith('##') && !s.includes('`deprecated`'))
31+
.map((s) => s.replace('## ', ''));
3232

3333
expect(Object.keys(rules)).toEqual(expect.arrayContaining(results));
3434
});

docs/.vitepress/config.ts

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
import {defineConfig} from 'vitepress';
2+
import {tabsMarkdownPlugin} from 'vitepress-plugin-tabs';
3+
4+
// https://vitepress.dev/reference/site-config
5+
export default defineConfig({
6+
title: 'commitlint',
7+
description: 'Lint commit messages',
8+
9+
head: [['link', {rel: 'icon', type: 'image/png', href: '/assets/icon.png'}]],
10+
11+
themeConfig: {
12+
// https://vitepress.dev/reference/default-theme-config
13+
logo: '/assets/icon.png',
14+
15+
nav: [
16+
{text: 'Home', link: '/'},
17+
{text: 'Guides', link: '/guides/getting-started'},
18+
{text: 'Reference', link: '/reference/configuration'},
19+
],
20+
21+
sidebar: [
22+
{
23+
text: 'Guides',
24+
base: '/guides',
25+
items: [
26+
{text: 'Getting started', link: '/getting-started'},
27+
{text: 'Local setup', link: '/local-setup'},
28+
{text: 'CI setup', link: '/ci-setup'},
29+
{text: 'Use prompt', link: '/use-prompt'},
30+
],
31+
},
32+
{
33+
text: 'Reference',
34+
base: '/reference',
35+
items: [
36+
{text: 'CLI', link: '/cli'},
37+
{text: 'Configuration', link: '/configuration'},
38+
{text: 'Rules configuration', link: '/rules-configuration'},
39+
{text: 'Rules', link: '/rules'},
40+
{text: 'Plugins', link: '/plugins'},
41+
{text: 'Prompt', link: '/prompt'},
42+
{text: 'Examples', link: '/examples'},
43+
{text: 'Community projects', link: '/community-projects'},
44+
],
45+
},
46+
{
47+
text: 'API',
48+
base: '/api',
49+
collapsed: true,
50+
items: [
51+
{text: '@commitlint/format', link: '/format'},
52+
{text: '@commitlint/lint', link: '/lint'},
53+
{text: '@commitlint/load', link: '/load'},
54+
{text: '@commitlint/read', link: '/read'},
55+
],
56+
},
57+
{
58+
text: 'Concepts',
59+
base: '/concepts',
60+
collapsed: true,
61+
items: [
62+
{text: 'Commit-conventions', link: '/commit-conventions'},
63+
{text: 'Shareable config', link: '/shareable-config'},
64+
],
65+
},
66+
{
67+
text: 'Support',
68+
base: '/support',
69+
collapsed: true,
70+
items: [
71+
{text: 'Releases', link: '/releases'},
72+
{text: 'Upgrade commitlint', link: '/upgrade'},
73+
],
74+
},
75+
{
76+
text: 'Attributions',
77+
link: '/attributions',
78+
},
79+
],
80+
81+
socialLinks: [
82+
{
83+
icon: 'github',
84+
link: 'https://github.com/conventional-changelog/commitlint',
85+
},
86+
],
87+
88+
search: {
89+
provider: 'local',
90+
},
91+
},
92+
93+
markdown: {
94+
config(md) {
95+
md.use(tabsMarkdownPlugin);
96+
},
97+
},
98+
});

docs/.vitepress/theme/index.ts

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// .vitepress/theme/index.ts
2+
import type {Theme} from 'vitepress';
3+
import DefaultTheme from 'vitepress/theme';
4+
import {enhanceAppWithTabs} from 'vitepress-plugin-tabs/client';
5+
6+
export default {
7+
extends: DefaultTheme,
8+
enhanceApp({app}) {
9+
enhanceAppWithTabs(app);
10+
},
11+
} satisfies Theme;

docs/README.md

-70
This file was deleted.

docs/_navbar.md

-7
This file was deleted.

docs/_sidebar.md

-22
This file was deleted.

0 commit comments

Comments
 (0)