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

Docsify migrates to VitePress #51

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Sample workflow for building and deploying a VitePress site to GitHub Pages
#
name: Deploy VitePress site to Pages

on:
# Runs on pushes targeting the `main` branch. Change this to `master` if you're
# using the `master` branch as the default branch.
push:
branches: [master]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: pages
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Not needed if lastUpdated is not enabled
# - uses: pnpm/action-setup@v3 # Uncomment this if you're using pnpm
# - uses: oven-sh/setup-bun@v1 # Uncomment this if you're using Bun
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm # or pnpm / yarn
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Install dependencies
run: npm ci # or pnpm install / yarn install / bun install
- name: Build with VitePress
run: npm run docs:build # or pnpm docs:build / yarn docs:build / bun run docs:build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/.vitepress/dist

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
node_modules
docs/**/.vitepress/dist
docs/**/.vitepress/cache
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Thanks goes to these wonderful people ([emoji key][emojis]):
Contributions of any kind are welcome! [Join us on Slack](https://join.slack.com/t/bundlewatch/shared_invite/enQtMzUwNjYxNTMwMzcyLWE5NGI4MzZjMjM4MTRlYzllOTMwYzIzZWNjM2MyMjBmMzNjNGM0ZGVhODc2YjFkNzIwMzNkYjk3NzE0MjZkOTc) and start contributing.


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

[bundlewatch]: https://img.shields.io/badge/bundle-watched-blue.svg
[bundlewatch-url]: https://bundlewatch.io
Expand Down
Empty file removed docs/.nojekyll
Empty file.
94 changes: 94 additions & 0 deletions docs/.vitepress/config/en.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import { defineConfig } from "vitepress";

export const en = defineConfig({
lang: "en-US",
description: "Keep watch of your bundle size",

themeConfig: {
nav: nav(),

sidebar: {
"/guide/": { base: "/guide/", items: sidebarGuide() },
"/reference/": {
base: "/reference/",
items: sidebarReference(),
},
},

editLink: {
pattern: "https://github.com/bundlewatch/bundlewatch.io/edit/master/docs/:path",
text: "Edit this page on GitHub",
},

outline: {
level: "deep",
},

footer: {
message: "Released under the MIT License.",
copyright: `Copyright © ${new Date().getFullYear()} bundlewatch`,
},
},
});

function nav() {
return [
{
text: "Guide",
link: "/guide/what-is-it",
activeMatch: "/guide/",
},
{
text: "Reference",
link: "/reference/configuration",
activeMatch: "/reference/",
},
{
text: "0.4.0",
items: [
{
text: "Release Notes",
link: "https://github.com/bundlewatch/bundlewatch/releases/tag/v0.4.0",
target: "_blank",
},
{
text: "Contributing",
link: "https://github.com/bundlewatch/bundlewatch/blob/master/CONTRIBUTING.md",
target: "_blank",
},
],
},
];
}

function sidebarGuide() {
return [
{
text: "introduce",
items: [
{ text: "What is it?", link: "what-is-it" },
{ text: "Getting Started", link: "getting-started" },
{ text: "Using bundlewatch", link: "using-bundlewatch" },
{ text: "Using a config file", link: "using-a-config-file" },
{
text: "Diffing against branches other than master",
link: "diffing-against-branches-other-than-master",
},
{ text: "Using a custom server", link: "using-a-custom-server" },
],
},
];
}

function sidebarReference() {
return [
{
text: "Reference",
items: [
{ text: "Configuration", link: "configuration" },
{ text: "NodeJS API", link: "nodejs" },
{ text: "CLI Params", link: "cli" },
],
},
];
}
20 changes: 20 additions & 0 deletions docs/.vitepress/config/index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { defineConfig } from "vitepress";
import { shared } from "./shared.mjs";
import { zh } from "./zh.mjs";
import { en } from "./en.mjs";



const config = {
...shared,

locales: {
root: { label: "English", ...en },
zh: { label: "简体中文", ...zh },
},
}




export default defineConfig(config);
54 changes: 54 additions & 0 deletions docs/.vitepress/config/shared.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { defineConfig } from "vitepress";
import { tabsMarkdownPlugin } from "vitepress-plugin-tabs";

import { search as zhSearch } from "./zh.mjs";

export const shared = defineConfig({
title: "bundlewatch",

base:'/bundlewatch.io/',

rewrites: {
"en/:rest*": ":rest*",
},

lastUpdated: true,
cleanUrls: true,
metaChunk: true,

markdown: {
image: {
lazyLoading: true,
},
lineNumbers: true,
config(md) {
md.use(tabsMarkdownPlugin);
},
container: {
tipLabel: "提示",
warningLabel: "警告",
dangerLabel: "危险",
infoLabel: "信息",
detailsLabel: "详细信息",
},
},

head: [["link", { rel: "icon", href: "favicon.svg", type: "image/svg+xml" }]],

themeConfig: {
logo: { src: "/logo-mini.svg", width: 24, height: 24 },

socialLinks: [
{ icon: "github", link: "https://github.com/bundlewatch/bundlewatch" },
],

search: {
provider: "local",
options: {
locales: {
...zhSearch,
},
},
},
},
});
Loading