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 all 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
63 changes: 63 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Deploy GitHub Pages

on:
workflow_dispatch:
push:
paths:
- 'docs/**'
- '.github/workflows/docs.yml'
- 'package.json'
branches:
- 'main'

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: false

jobs:
build-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@a3252b78c470c02df07e9d59298aecedc3ccdd6d # v3.0.0

- name: Set node version to 20
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: 20
cache: 'pnpm'

- name: Setup Pages
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0

- name: Install deps
run: pnpm install

- name: Build with VitePress
run: pnpm run docs:build

- name: Upload artifact
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
with:
path: ./docs/.vitepress/dist/

deploy-docs:
runs-on: ubuntu-latest
needs: build-docs
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5
Empty file removed docs/.nojekyll
Empty file.
192 changes: 192 additions & 0 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
import { DefaultTheme, defineConfig } from 'vitepress';

import pkg from '../../package.json';

const repository = 'https://github.com/salsita/node-pg-migrate';
export default defineConfig({
title: 'node-pg-migrate',
description: 'PostgreSQL database migration management tool',
base: '/node-pg-migrate/', // for GitHub Pages
srcDir: 'src',
lastUpdated: true,
cleanUrls: true,
metaChunk: true,

themeConfig: {
nav: navBarItems(),
sidebar: sidebar(),

search: {
provider: 'local',
},

socialLinks: [
{ icon: 'github', link: repository },
{ icon: 'npm', link: 'https://www.npmjs.com/package/node-pg-migrate' },
],

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 sidebar(): DefaultTheme.Sidebar {
return [
{
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(),
},
];
}

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 type { Theme } from 'vitepress';
import DefaultTheme from 'vitepress/theme';
import { h } from 'vue';
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;
123 changes: 123 additions & 0 deletions docs/.vitepress/theme/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
/**
* Customize default theme styling by overriding CSS variables:
* https://github.com/vuejs/vitepress/blob/main/src/client/theme-default/styles/vars.css
*/

:root {
--c-brown-1: #d26b38;
--c-brown-2: #e88d54;
--c-brown-3: #c27647;
--c-brown-soft-1: #a0623b;
--c-brown-soft-2: #2a2420;
--vp-c-brand-soft: #fbf6f4;
}

html.dark:root {
--vp-c-brand-soft: #2a2420;
--vp-c-bg-soft: #141414;
--vp-c-bg-alt: #121212;
--vp-c-bg-elv: #1b1b1b;
--vp-c-bg: #181818;
--vp-home-hero-name-background: -webkit-linear-gradient(
78deg,
var(--c-brown-1) 40%,
var(--c-brown-2)
);
}

/**
* Component: Layout
* -------------------------------------------------------------------------- */

:root {
--vp-c-brand-1: var(--c-brown-1);
--vp-c-brand-2: var(--c-brown-2);
--vp-c-brand-3: var(--c-brown-3);

--vp-c-default-1: var(--vp-c-gray-1);
--vp-c-default-2: var(--vp-c-gray-2);
--vp-c-default-3: var(--vp-c-gray-3);
--vp-c-default-soft: var(--vp-c-gray-soft);

--vp-c-tip-1: var(--vp-c-brand-1);
--vp-c-tip-2: var(--vp-c-brand-2);
--vp-c-tip-3: var(--vp-c-brand-3);
--vp-c-tip-soft: var(--vp-c-brand-soft);

--vp-c-warning-1: var(--vp-c-yellow-1);
--vp-c-warning-2: var(--vp-c-yellow-2);
--vp-c-warning-3: var(--vp-c-yellow-3);
--vp-c-warning-soft: var(--vp-c-yellow-soft);

--vp-c-danger-1: var(--vp-c-red-1);
--vp-c-danger-2: var(--vp-c-red-2);
--vp-c-danger-3: var(--vp-c-red-3);
--vp-c-danger-soft: var(--vp-c-red-soft);
}

/**
* Component: Button
* -------------------------------------------------------------------------- */

:root {
--vp-button-brand-border: transparent;
--vp-button-brand-text: var(--vp-c-white);
--vp-button-brand-bg: var(--vp-c-brand-3);
--vp-button-brand-hover-border: transparent;
--vp-button-brand-hover-text: var(--vp-c-white);
--vp-button-brand-hover-bg: var(--vp-c-brand-2);
--vp-button-brand-active-border: transparent;
--vp-button-brand-active-text: var(--vp-c-white);
--vp-button-brand-active-bg: var(--vp-c-brand-1);
}

/**
* Component: Home
* -------------------------------------------------------------------------- */

:root {
--vp-home-hero-name-color: transparent;
--vp-home-hero-name-background: -webkit-linear-gradient(
120deg,
var(--vp-c-brand-1) 30%,
var(--vp-c-brand-3)
);

--vp-home-hero-image-background-image: linear-gradient(
-45deg,
var(--vp-c-brand-1) 50%,
var(--vp-c-brand-3) 50%
);
--vp-home-hero-image-filter: blur(44px);
}

@media (min-width: 640px) {
:root {
--vp-home-hero-image-filter: blur(56px);
}
}

@media (min-width: 960px) {
:root {
--vp-home-hero-image-filter: blur(68px);
}
}

/**
* Component: Custom Block
* -------------------------------------------------------------------------- */

:root {
--vp-custom-block-tip-border: transparent;
--vp-custom-block-tip-text: var(--vp-c-text-1);
--vp-custom-block-tip-bg: var(--vp-c-brand-soft);
--vp-custom-block-tip-code-bg: var(--vp-c-brand-soft);
}

/**
* Component: Algolia
* -------------------------------------------------------------------------- */

.DocSearch {
--docsearch-primary-color: var(--vp-c-brand-1) !important;
}