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

docs: refactor docs to use VitePress #1132

Merged
merged 45 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
69ce214
refactor(docs): move to VitePress
brenoepics Apr 27, 2024
5f0b5b4
ci: add docs workflow
brenoepics Apr 27, 2024
13691e7
chore: update pnpm-lock
brenoepics Apr 27, 2024
f03ff8c
ci: fix docs working directory
brenoepics Apr 27, 2024
f9f7fde
ci(docs): fix build command
brenoepics Apr 27, 2024
285bc60
docs: fix dead links
brenoepics Apr 27, 2024
d28ea45
docs: fix github-pages base url
brenoepics Apr 27, 2024
ca63459
docs: show pkg version
brenoepics Apr 27, 2024
45e0728
docs: fix title
brenoepics Apr 27, 2024
bbffd64
docs: json codeblock to jsonc
brenoepics Apr 27, 2024
dc498d2
docs: json codeblock to jsonc
brenoepics Apr 27, 2024
1d9392e
docs: fix hero text
brenoepics Apr 27, 2024
f9d1854
docs: lowercase title
brenoepics Apr 27, 2024
6f5e0ed
docs: lowercase title
brenoepics Apr 27, 2024
66ae4b1
docs: move scripts to above premigrate
brenoepics Apr 27, 2024
b0cc936
chore: lint style
brenoepics Apr 27, 2024
3153082
chore: update pnpm
brenoepics Apr 28, 2024
78cc5aa
fix: resolve json module
brenoepics Apr 28, 2024
b9f9a7a
chore: vitepress 1.1.4
brenoepics Apr 28, 2024
e29c45f
docs: improve styles
brenoepics Apr 28, 2024
631a2af
docs: add features text
brenoepics Apr 28, 2024
e9e7710
docs: update brand colors
brenoepics Apr 28, 2024
7c27c33
docs: last updated, clean urls +
brenoepics Apr 28, 2024
118cc34
docs: refactor api
brenoepics Apr 28, 2024
fb2e80e
docs: refactor cli
brenoepics Apr 28, 2024
7c03e65
docs: minor lang fixes to troubleshooting
brenoepics Apr 28, 2024
9681dc7
docs: fix typo
brenoepics Apr 28, 2024
d6ccdd0
docs: json codeblock to jsonc
brenoepics Apr 28, 2024
5e89be4
docs: fix table
brenoepics Apr 28, 2024
79f16ad
docs: refactor triggers
brenoepics Apr 28, 2024
2d995bc
Merge branch 'patch-2' of https://github.com/brenoepics/node-pg-migra…
brenoepics Apr 28, 2024
dad0059
docs: fix alert
brenoepics Apr 28, 2024
280b199
docs: refactor migration columns
brenoepics Apr 28, 2024
88a2ecb
docs: fix typo
brenoepics Apr 28, 2024
2432f1a
docs: refactor migration constraints
brenoepics Apr 28, 2024
1a89090
docs: refactor migration domains
brenoepics Apr 28, 2024
64d6a2d
docs: refactor migrations extensions
brenoepics Apr 28, 2024
7ab3936
docs: fix inline alert
brenoepics Apr 28, 2024
4abf80b
docs: refactor migrations index
brenoepics Apr 28, 2024
cc09e0e
docs: refactor misc migrations
brenoepics Apr 28, 2024
09b761d
chore: fix styles
brenoepics Apr 28, 2024
1538154
Merge branch 'main' into patch-2
Shinigami92 Apr 29, 2024
6d28b40
ci: adjust docs.yml
Shinigami92 Apr 29, 2024
60c776c
chore: fix official PostgreSQL naming
Shinigami92 Apr 29, 2024
259e5d4
Merge branch 'main' into patch-2
brenoepics Apr 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
65 changes: 65 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Deploy GitHub Pages
on:
workflow_dispatch:
push:
paths:
- 'docs/**'
- '.github/workflows/docs.yml'
- 'package.json'
branches:
- "main"

# 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@v2 # 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

- name: Setup Pages
uses: actions/configure-pages@v4
- name: Install dependencies
run: pnpm install

- name: Build with VitePress
run: pnpm 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
Empty file removed docs/.nojekyll
Empty file.
186 changes: 186 additions & 0 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
import {DefaultTheme, defineConfig} from 'vitepress'
brenoepics marked this conversation as resolved.
Show resolved Hide resolved

const repository = "https://github.com/salsita/node-pg-migrate"
const pkg = require('../../package.json')
brenoepics marked this conversation as resolved.
Show resolved Hide resolved
export default defineConfig({
title: "Node PG Migrate",
brenoepics marked this conversation as resolved.
Show resolved Hide resolved
description: "Postgresql database migration management tool",
base: '/node-pg-migrate/', // for GitHub Pages
srcDir: 'src',
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
nav: navBarItems(),

sidebar: [
{
base: '/',
text: 'Reference',
collapsed: false,
items: sidebarReference()
},
{
base: '/migrations/',
text: 'Defining Migrations',
link: '/',
collapsed: false,
items: sidebarMigrations()
},
{
base: '/faq/',
text: 'FAQ',
collapsed: false,
items: sidebarFAQ()
}
],

search: {
provider: 'local',
},

socialLinks: [
{icon: 'github', link: repository}
],

editLink: {
pattern: repository + '/edit/main/docs/src/:path',
text: 'Edit this page on GitHub'
},

}
})

function navBarItems(): DefaultTheme.NavItem[] {
return [
{text: 'Home', link: '/'},
{text: 'Getting Started', link: '/getting-started'},
{
text: 'Migrations',
link: '/migrations/',
activeMatch: `^/migrations/`
},
{
text: pkg.version,
items: [
{text: 'Changelog', link: repository + '/blob/main/CHANGELOG.md'},
{text: 'Releases', link: repository + '/releases'},
{text: 'License', link: repository + '/blob/main/LICENSE'},
]
},
]
}


function sidebarReference(): DefaultTheme.SidebarItem[] {
return [
{
text: 'Introduction',
link: 'introduction'
},
{
text: 'Getting Started',
link: 'getting-started'
},
{
text: 'CLI',
link: 'cli'
},
{
text: 'Programmatic API',
link: 'api'
},
]
}

function sidebarFAQ(): DefaultTheme.SidebarItem[] {
return [
{
text: 'Transpiling Migrations',
link: 'transpiling'
},
{
text: 'Troubleshooting',
link: 'troubleshooting'
}
]
}

function sidebarMigrations(): DefaultTheme.SidebarItem[] {
return [
{
"text": "Tables",
"link": "tables"
},
{
"text": "Columns",
"link": "columns"
},
{
"text": "Constraints",
"link": "constraints"
},
{
"text": "Indexes",
"link": "indexes"
},
{
"text": "Functions",
"link": "functions"
},
{
"text": "Triggers",
"link": "triggers"
},
{
"text": "Schemas",
"link": "schemas"
},
{
"text": "Sequences",
"link": "sequences"
},
{
"text": "Views",
"link": "views"
},
{
"text": "Materialized Views",
"link": "mViews"
},
{
"text": "Types",
"link": "types"
},
{
"text": "Domains",
"link": "domains"
},
{
"text": "Operators",
"link": "operators"
},
{
"text": "Roles",
"link": "roles"
},
{
"text": "Policies",
"link": "policies"
},
{
"text": "Extensions",
"link": "extensions"
},
{
"text": "Grants",
"link": "grants"
},
{
"text": "Casts",
"link": "casts"
},
{
"text": "Miscellaneous",
"link": "misc"
}
]
}
17 changes: 17 additions & 0 deletions docs/.vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// https://vitepress.dev/guide/custom-theme
import { h } from 'vue'
import type { Theme } from 'vitepress'
import DefaultTheme from 'vitepress/theme'
import './style.css'

export default {
extends: DefaultTheme,
Layout: () => {
return h(DefaultTheme.Layout, null, {
// https://vitepress.dev/guide/extending-default-theme#layout-slots
})
},
enhanceApp({ app, router, siteData }) {
// ...
}
} satisfies Theme