Skip to content

Commit 357c911

Browse files
docs: refactor docs to use VitePress (#1132)
Co-authored-by: Shinigami <[email protected]>
1 parent b9cf8e9 commit 357c911

Some content is hidden

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

49 files changed

+2272
-2099
lines changed

.github/workflows/docs.yml

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Deploy GitHub Pages
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
paths:
7+
- 'docs/**'
8+
- '.github/workflows/docs.yml'
9+
- 'package.json'
10+
branches:
11+
- 'main'
12+
13+
permissions:
14+
contents: read
15+
pages: write
16+
id-token: write
17+
18+
concurrency:
19+
group: pages
20+
cancel-in-progress: false
21+
22+
jobs:
23+
build-docs:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
28+
with:
29+
fetch-depth: 0
30+
31+
- name: Install pnpm
32+
uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0
33+
34+
- name: Set node version to 20
35+
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
36+
with:
37+
node-version: 20
38+
cache: 'pnpm'
39+
40+
- name: Setup Pages
41+
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0
42+
43+
- name: Install deps
44+
run: pnpm install
45+
46+
- name: Build with VitePress
47+
run: pnpm run docs:build
48+
49+
- name: Upload artifact
50+
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
51+
with:
52+
path: ./docs/.vitepress/dist/
53+
54+
deploy-docs:
55+
runs-on: ubuntu-latest
56+
needs: build-docs
57+
environment:
58+
name: github-pages
59+
url: ${{ steps.deployment.outputs.page_url }}
60+
steps:
61+
- name: Deploy to GitHub Pages
62+
id: deployment
63+
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5

docs/.nojekyll

Whitespace-only changes.

docs/.vitepress/config.mts

+192
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
import { DefaultTheme, defineConfig } from 'vitepress';
2+
3+
import pkg from '../../package.json';
4+
5+
const repository = 'https://github.com/salsita/node-pg-migrate';
6+
export default defineConfig({
7+
title: 'node-pg-migrate',
8+
description: 'PostgreSQL database migration management tool',
9+
base: '/node-pg-migrate/', // for GitHub Pages
10+
srcDir: 'src',
11+
lastUpdated: true,
12+
cleanUrls: true,
13+
metaChunk: true,
14+
15+
themeConfig: {
16+
nav: navBarItems(),
17+
sidebar: sidebar(),
18+
19+
search: {
20+
provider: 'local',
21+
},
22+
23+
socialLinks: [
24+
{ icon: 'github', link: repository },
25+
{ icon: 'npm', link: 'https://www.npmjs.com/package/node-pg-migrate' },
26+
],
27+
28+
editLink: {
29+
pattern: repository + '/edit/main/docs/src/:path',
30+
text: 'Edit this page on GitHub',
31+
},
32+
},
33+
});
34+
35+
function navBarItems(): DefaultTheme.NavItem[] {
36+
return [
37+
{ text: 'Home', link: '/' },
38+
{ text: 'Getting Started', link: '/getting-started' },
39+
{
40+
text: 'Migrations',
41+
link: '/migrations/',
42+
activeMatch: `^/migrations/`,
43+
},
44+
{
45+
text: pkg.version,
46+
items: [
47+
{ text: 'Changelog', link: repository + '/blob/main/CHANGELOG.md' },
48+
{ text: 'Releases', link: repository + '/releases' },
49+
{ text: 'License', link: repository + '/blob/main/LICENSE' },
50+
],
51+
},
52+
];
53+
}
54+
55+
function sidebar(): DefaultTheme.Sidebar {
56+
return [
57+
{
58+
base: '/',
59+
text: 'Reference',
60+
collapsed: false,
61+
items: sidebarReference(),
62+
},
63+
{
64+
base: '/migrations/',
65+
text: 'Defining Migrations',
66+
link: '/',
67+
collapsed: false,
68+
items: sidebarMigrations(),
69+
},
70+
{
71+
base: '/faq/',
72+
text: 'FAQ',
73+
collapsed: false,
74+
items: sidebarFAQ(),
75+
},
76+
];
77+
}
78+
79+
function sidebarReference(): DefaultTheme.SidebarItem[] {
80+
return [
81+
{
82+
text: 'Introduction',
83+
link: 'introduction',
84+
},
85+
{
86+
text: 'Getting Started',
87+
link: 'getting-started',
88+
},
89+
{
90+
text: 'CLI',
91+
link: 'cli',
92+
},
93+
{
94+
text: 'Programmatic API',
95+
link: 'api',
96+
},
97+
];
98+
}
99+
100+
function sidebarFAQ(): DefaultTheme.SidebarItem[] {
101+
return [
102+
{
103+
text: 'Transpiling Migrations',
104+
link: 'transpiling',
105+
},
106+
{
107+
text: 'Troubleshooting',
108+
link: 'troubleshooting',
109+
},
110+
];
111+
}
112+
113+
function sidebarMigrations(): DefaultTheme.SidebarItem[] {
114+
return [
115+
{
116+
text: 'Tables',
117+
link: 'tables',
118+
},
119+
{
120+
text: 'Columns',
121+
link: 'columns',
122+
},
123+
{
124+
text: 'Constraints',
125+
link: 'constraints',
126+
},
127+
{
128+
text: 'Indexes',
129+
link: 'indexes',
130+
},
131+
{
132+
text: 'Functions',
133+
link: 'functions',
134+
},
135+
{
136+
text: 'Triggers',
137+
link: 'triggers',
138+
},
139+
{
140+
text: 'Schemas',
141+
link: 'schemas',
142+
},
143+
{
144+
text: 'Sequences',
145+
link: 'sequences',
146+
},
147+
{
148+
text: 'Views',
149+
link: 'views',
150+
},
151+
{
152+
text: 'Materialized Views',
153+
link: 'mViews',
154+
},
155+
{
156+
text: 'Types',
157+
link: 'types',
158+
},
159+
{
160+
text: 'Domains',
161+
link: 'domains',
162+
},
163+
{
164+
text: 'Operators',
165+
link: 'operators',
166+
},
167+
{
168+
text: 'Roles',
169+
link: 'roles',
170+
},
171+
{
172+
text: 'Policies',
173+
link: 'policies',
174+
},
175+
{
176+
text: 'Extensions',
177+
link: 'extensions',
178+
},
179+
{
180+
text: 'Grants',
181+
link: 'grants',
182+
},
183+
{
184+
text: 'Casts',
185+
link: 'casts',
186+
},
187+
{
188+
text: 'Miscellaneous',
189+
link: 'misc',
190+
},
191+
];
192+
}

docs/.vitepress/theme/index.ts

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// https://vitepress.dev/guide/custom-theme
2+
import type { Theme } from 'vitepress';
3+
import DefaultTheme from 'vitepress/theme';
4+
import { h } from 'vue';
5+
import './style.css';
6+
7+
export default {
8+
extends: DefaultTheme,
9+
Layout: () => {
10+
return h(DefaultTheme.Layout, null, {
11+
// https://vitepress.dev/guide/extending-default-theme#layout-slots
12+
});
13+
},
14+
enhanceApp({ app, router, siteData }) {
15+
// ...
16+
},
17+
} satisfies Theme;

docs/.vitepress/theme/style.css

+123
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
/**
2+
* Customize default theme styling by overriding CSS variables:
3+
* https://github.com/vuejs/vitepress/blob/main/src/client/theme-default/styles/vars.css
4+
*/
5+
6+
:root {
7+
--c-brown-1: #d26b38;
8+
--c-brown-2: #e88d54;
9+
--c-brown-3: #c27647;
10+
--c-brown-soft-1: #a0623b;
11+
--c-brown-soft-2: #2a2420;
12+
--vp-c-brand-soft: #fbf6f4;
13+
}
14+
15+
html.dark:root {
16+
--vp-c-brand-soft: #2a2420;
17+
--vp-c-bg-soft: #141414;
18+
--vp-c-bg-alt: #121212;
19+
--vp-c-bg-elv: #1b1b1b;
20+
--vp-c-bg: #181818;
21+
--vp-home-hero-name-background: -webkit-linear-gradient(
22+
78deg,
23+
var(--c-brown-1) 40%,
24+
var(--c-brown-2)
25+
);
26+
}
27+
28+
/**
29+
* Component: Layout
30+
* -------------------------------------------------------------------------- */
31+
32+
:root {
33+
--vp-c-brand-1: var(--c-brown-1);
34+
--vp-c-brand-2: var(--c-brown-2);
35+
--vp-c-brand-3: var(--c-brown-3);
36+
37+
--vp-c-default-1: var(--vp-c-gray-1);
38+
--vp-c-default-2: var(--vp-c-gray-2);
39+
--vp-c-default-3: var(--vp-c-gray-3);
40+
--vp-c-default-soft: var(--vp-c-gray-soft);
41+
42+
--vp-c-tip-1: var(--vp-c-brand-1);
43+
--vp-c-tip-2: var(--vp-c-brand-2);
44+
--vp-c-tip-3: var(--vp-c-brand-3);
45+
--vp-c-tip-soft: var(--vp-c-brand-soft);
46+
47+
--vp-c-warning-1: var(--vp-c-yellow-1);
48+
--vp-c-warning-2: var(--vp-c-yellow-2);
49+
--vp-c-warning-3: var(--vp-c-yellow-3);
50+
--vp-c-warning-soft: var(--vp-c-yellow-soft);
51+
52+
--vp-c-danger-1: var(--vp-c-red-1);
53+
--vp-c-danger-2: var(--vp-c-red-2);
54+
--vp-c-danger-3: var(--vp-c-red-3);
55+
--vp-c-danger-soft: var(--vp-c-red-soft);
56+
}
57+
58+
/**
59+
* Component: Button
60+
* -------------------------------------------------------------------------- */
61+
62+
:root {
63+
--vp-button-brand-border: transparent;
64+
--vp-button-brand-text: var(--vp-c-white);
65+
--vp-button-brand-bg: var(--vp-c-brand-3);
66+
--vp-button-brand-hover-border: transparent;
67+
--vp-button-brand-hover-text: var(--vp-c-white);
68+
--vp-button-brand-hover-bg: var(--vp-c-brand-2);
69+
--vp-button-brand-active-border: transparent;
70+
--vp-button-brand-active-text: var(--vp-c-white);
71+
--vp-button-brand-active-bg: var(--vp-c-brand-1);
72+
}
73+
74+
/**
75+
* Component: Home
76+
* -------------------------------------------------------------------------- */
77+
78+
:root {
79+
--vp-home-hero-name-color: transparent;
80+
--vp-home-hero-name-background: -webkit-linear-gradient(
81+
120deg,
82+
var(--vp-c-brand-1) 30%,
83+
var(--vp-c-brand-3)
84+
);
85+
86+
--vp-home-hero-image-background-image: linear-gradient(
87+
-45deg,
88+
var(--vp-c-brand-1) 50%,
89+
var(--vp-c-brand-3) 50%
90+
);
91+
--vp-home-hero-image-filter: blur(44px);
92+
}
93+
94+
@media (min-width: 640px) {
95+
:root {
96+
--vp-home-hero-image-filter: blur(56px);
97+
}
98+
}
99+
100+
@media (min-width: 960px) {
101+
:root {
102+
--vp-home-hero-image-filter: blur(68px);
103+
}
104+
}
105+
106+
/**
107+
* Component: Custom Block
108+
* -------------------------------------------------------------------------- */
109+
110+
:root {
111+
--vp-custom-block-tip-border: transparent;
112+
--vp-custom-block-tip-text: var(--vp-c-text-1);
113+
--vp-custom-block-tip-bg: var(--vp-c-brand-soft);
114+
--vp-custom-block-tip-code-bg: var(--vp-c-brand-soft);
115+
}
116+
117+
/**
118+
* Component: Algolia
119+
* -------------------------------------------------------------------------- */
120+
121+
.DocSearch {
122+
--docsearch-primary-color: var(--vp-c-brand-1) !important;
123+
}

0 commit comments

Comments
 (0)