Skip to content

Commit 625a994

Browse files
committed
feat: Docsify migrates to VitePress
Signed-off-by: ajiho <[email protected]>
1 parent 3c11a4d commit 625a994

Some content is hidden

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

50 files changed

+3170
-2162
lines changed

.github/workflows/deploy.yml

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# Sample workflow for building and deploying a VitePress site to GitHub Pages
2+
#
3+
name: Deploy VitePress site to Pages
4+
5+
on:
6+
# Runs on pushes targeting the `main` branch. Change this to `master` if you're
7+
# using the `master` branch as the default branch.
8+
push:
9+
branches: [master]
10+
11+
# Allows you to run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
14+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
15+
permissions:
16+
contents: read
17+
pages: write
18+
id-token: write
19+
20+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
21+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
22+
concurrency:
23+
group: pages
24+
cancel-in-progress: false
25+
26+
jobs:
27+
# Build job
28+
build:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v4
33+
with:
34+
fetch-depth: 0 # Not needed if lastUpdated is not enabled
35+
# - uses: pnpm/action-setup@v3 # Uncomment this if you're using pnpm
36+
# - uses: oven-sh/setup-bun@v1 # Uncomment this if you're using Bun
37+
- name: Setup Node
38+
uses: actions/setup-node@v4
39+
with:
40+
node-version: 20
41+
cache: npm # or pnpm / yarn
42+
- name: Setup Pages
43+
uses: actions/configure-pages@v4
44+
- name: Install dependencies
45+
run: npm ci # or pnpm install / yarn install / bun install
46+
- name: Build with VitePress
47+
run: npm run docs:build # or pnpm docs:build / yarn docs:build / bun run docs:build
48+
- name: Upload artifact
49+
uses: actions/upload-pages-artifact@v3
50+
with:
51+
path: docs/.vitepress/dist
52+
53+
# Deployment job
54+
deploy:
55+
environment:
56+
name: github-pages
57+
url: ${{ steps.deployment.outputs.page_url }}
58+
needs: build
59+
runs-on: ubuntu-latest
60+
name: Deploy
61+
steps:
62+
- name: Deploy to GitHub Pages
63+
id: deployment
64+
uses: actions/deploy-pages@v4

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
node_modules
2+
docs/**/.vitepress/dist
3+
docs/**/.vitepress/cache

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Thanks goes to these wonderful people ([emoji key][emojis]):
5757
Contributions of any kind are welcome! [Join us on Slack](https://join.slack.com/t/bundlewatch/shared_invite/enQtMzUwNjYxNTMwMzcyLWE5NGI4MzZjMjM4MTRlYzllOTMwYzIzZWNjM2MyMjBmMzNjNGM0ZGVhODc2YjFkNzIwMzNkYjk3NzE0MjZkOTc) and start contributing.
5858

5959

60-
Documentation powered by [docsifyJS](https://docsify.js.org/)
60+
Documentation powered by [vitepress](https://vitepress.dev/)
6161

6262
[bundlewatch]: https://img.shields.io/badge/bundle-watched-blue.svg
6363
[bundlewatch-url]: https://bundlewatch.io

docs/.nojekyll

Whitespace-only changes.

docs/.vitepress/config/en.mjs

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
import { defineConfig } from "vitepress";
2+
3+
export const en = defineConfig({
4+
lang: "en-US",
5+
description: "Keep watch of your bundle size",
6+
7+
themeConfig: {
8+
nav: nav(),
9+
10+
sidebar: {
11+
"/guide/": { base: "/guide/", items: sidebarGuide() },
12+
"/reference/": {
13+
base: "/reference/",
14+
items: sidebarReference(),
15+
},
16+
},
17+
18+
editLink: {
19+
pattern: "https://github.com/bundlewatch/bundlewatch.io/edit/master/docs/:path",
20+
text: "Edit this page on GitHub",
21+
},
22+
23+
outline: {
24+
level: "deep",
25+
},
26+
27+
footer: {
28+
message: "Released under the MIT License.",
29+
copyright: `Copyright © ${new Date().getFullYear()} bundlewatch`,
30+
},
31+
},
32+
});
33+
34+
function nav() {
35+
return [
36+
{
37+
text: "Guide",
38+
link: "/guide/what-is-it",
39+
activeMatch: "/guide/",
40+
},
41+
{
42+
text: "Reference",
43+
link: "/reference/configuration",
44+
activeMatch: "/reference/",
45+
},
46+
{
47+
text: "0.4.0",
48+
items: [
49+
{
50+
text: "Release Notes",
51+
link: "https://github.com/bundlewatch/bundlewatch/releases/tag/v0.4.0",
52+
target: "_blank",
53+
},
54+
{
55+
text: "Contributing",
56+
link: "https://github.com/bundlewatch/bundlewatch/blob/master/CONTRIBUTING.md",
57+
target: "_blank",
58+
},
59+
],
60+
},
61+
];
62+
}
63+
64+
function sidebarGuide() {
65+
return [
66+
{
67+
text: "introduce",
68+
items: [
69+
{ text: "What is it?", link: "what-is-it" },
70+
{ text: "Getting Started", link: "getting-started" },
71+
{ text: "Using bundlewatch", link: "using-bundlewatch" },
72+
{ text: "Using a config file", link: "using-a-config-file" },
73+
{
74+
text: "Diffing against branches other than master",
75+
link: "diffing-against-branches-other-than-master",
76+
},
77+
{ text: "Using a custom server", link: "using-a-custom-server" },
78+
],
79+
},
80+
];
81+
}
82+
83+
function sidebarReference() {
84+
return [
85+
{
86+
text: "Reference",
87+
items: [
88+
{ text: "Configuration", link: "configuration" },
89+
{ text: "NodeJS API", link: "nodejs" },
90+
{ text: "CLI Params", link: "cli" },
91+
],
92+
},
93+
];
94+
}

docs/.vitepress/config/index.mjs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { defineConfig } from "vitepress";
2+
import { shared } from "./shared.mjs";
3+
import { zh } from "./zh.mjs";
4+
import { en } from "./en.mjs";
5+
6+
7+
8+
const config = {
9+
...shared,
10+
11+
locales: {
12+
root: { label: "English", ...en },
13+
zh: { label: "简体中文", ...zh },
14+
},
15+
}
16+
17+
18+
19+
20+
export default defineConfig(config);

docs/.vitepress/config/shared.mjs

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import { defineConfig } from "vitepress";
2+
import { tabsMarkdownPlugin } from "vitepress-plugin-tabs";
3+
4+
import { search as zhSearch } from "./zh.mjs";
5+
6+
export const shared = defineConfig({
7+
title: "bundlewatch",
8+
9+
base:'/bundlewatch.io/',
10+
11+
rewrites: {
12+
"en/:rest*": ":rest*",
13+
},
14+
15+
lastUpdated: true,
16+
cleanUrls: true,
17+
metaChunk: true,
18+
19+
markdown: {
20+
image: {
21+
lazyLoading: true,
22+
},
23+
lineNumbers: true,
24+
config(md) {
25+
md.use(tabsMarkdownPlugin);
26+
},
27+
container: {
28+
tipLabel: "提示",
29+
warningLabel: "警告",
30+
dangerLabel: "危险",
31+
infoLabel: "信息",
32+
detailsLabel: "详细信息",
33+
},
34+
},
35+
36+
head: [["link", { rel: "icon", href: "favicon.svg", type: "image/svg+xml" }]],
37+
38+
themeConfig: {
39+
logo: { src: "/logo-mini.svg", width: 24, height: 24 },
40+
41+
socialLinks: [
42+
{ icon: "github", link: "https://github.com/bundlewatch/bundlewatch" },
43+
],
44+
45+
search: {
46+
provider: "local",
47+
options: {
48+
locales: {
49+
...zhSearch,
50+
},
51+
},
52+
},
53+
},
54+
});

0 commit comments

Comments
 (0)