Skip to content

Commit 3610b92

Browse files
author
kyvg
committed
migrate docs from vuepress to vitepress
1 parent d075160 commit 3610b92

18 files changed

+2338
-2839
lines changed

.github/workflows/docs.yml

+53-31
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,66 @@
1-
name: docs
1+
# Sample workflow for building and deploying a VitePress site to GitHub Pages
2+
#
3+
name: Deploy VitePress site to Pages
24

35
on:
4-
# trigger deployment on every push to main branch
6+
# Runs on pushes targeting the `main` branch. Change this to `master` if you're
7+
# using the `master` branch as the default branch.
58
push:
69
branches: [master]
7-
# trigger deployment manually
10+
11+
# Allows you to run this workflow manually from the Actions tab
812
workflow_dispatch:
913

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+
1026
jobs:
11-
docs:
27+
# Build job
28+
build:
1229
runs-on: ubuntu-latest
13-
1430
steps:
15-
- uses: actions/checkout@v3
31+
- name: Checkout
32+
uses: actions/checkout@v4
1633
with:
17-
# fetch all commits to get last updated time or other git log info
18-
fetch-depth: 0
19-
20-
- name: Setup Node.js
21-
uses: actions/setup-node@v3
34+
fetch-depth: 0 # Not needed if lastUpdated is not enabled
35+
# - uses: pnpm/action-setup@v2 # 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
2239
with:
23-
# choose node.js version to use
24-
node-version: 18
25-
# cache deps for pnpm
26-
cache: npm
27-
28-
# run build script
29-
- run: npm ci
30-
- run: npm run build --if-present
31-
- run: npm run docs:build
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: |
48+
npm run docs:build # or pnpm docs:build / yarn docs:build / bun run docs:build
49+
touch docs/.vitepress/dist/.nojekyll
50+
- name: Upload artifact
51+
uses: actions/upload-pages-artifact@v3
52+
with:
53+
path: docs/.vitepress/dist
3254

33-
# please check out the docs of the workflow for more details
34-
# @see https://github.com/crazy-max/ghaction-github-pages
55+
# Deployment job
56+
deploy:
57+
environment:
58+
name: github-pages
59+
url: ${{ steps.deployment.outputs.page_url }}
60+
needs: build
61+
runs-on: ubuntu-latest
62+
name: Deploy
63+
steps:
3564
- name: Deploy to GitHub Pages
36-
uses: crazy-max/ghaction-github-pages@v2
37-
with:
38-
# deploy to gh-pages branch
39-
target_branch: gh-pages
40-
# deploy the default output dir of VuePress
41-
build_dir: docs/.vuepress/dist
42-
env:
43-
# @see https://docs.github.com/en/actions/reference/authentication-in-a-workflow#about-the-github_token-secret
44-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
id: deployment
66+
uses: actions/deploy-pages@v4

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
node_modules/
33
npm-debug.log
44
yarn-error.log
5-
demo/dist
65
test/unit/coverage
76
*.map
87
.vscode
98
temp/
109
dist/src/
1110
.temp
12-
.cache
11+
docs/.vitepress/dist
12+
docs/.vitepress/cache

docs/.vitepress/config.mts

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { defineConfig } from 'vitepress'
2+
3+
// https://vitepress.dev/reference/site-config
4+
export default defineConfig({
5+
title: "Vue.js Notification",
6+
themeConfig: {
7+
nav: [
8+
{ text: 'Demo', link: '/' },
9+
{ text: 'Get started', link: '/guide/installation' },
10+
{ text: "API Reference", link: "/api/" },
11+
],
12+
sidebar: {
13+
'/guide/': [
14+
{ text: 'Get started', items: [
15+
{ text: 'Installation', link: '/guide/installation' },
16+
{ text: 'Usage', link: '/guide/usage' },
17+
{ text: 'Customization', link: '/guide/customization' },
18+
{ text: 'TypeScript Support', link: '/guide/typescript'}
19+
]},
20+
]
21+
},
22+
socialLinks: [
23+
{ icon: 'github', link: 'https://github.com/kyvg/vue3-notification' }
24+
],
25+
editLink: {
26+
pattern: 'https://github.com/kyvg/vue3-notification/edit/master/docs/:path',
27+
text: 'Edit this page on GitHub'
28+
}
29+
}
30+
})

docs/.vitepress/theme/index.mts

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import type { Theme } from 'vitepress'
2+
import DefaultTheme from 'vitepress/theme'
3+
import Demo from "../../components/Demo.vue"
4+
import Notification from "../../../dist/index.es"
5+
6+
export default {
7+
extends: DefaultTheme,
8+
enhanceApp({ app }) {
9+
app.use(Notification);
10+
app.component('Demo', Demo)
11+
}
12+
} satisfies Theme

docs/.vuepress/client.ts

-10
This file was deleted.

0 commit comments

Comments
 (0)