Skip to content

Commit

Permalink
Docs site (#121)
Browse files Browse the repository at this point in the history
* parent dcb3773
author Sam Willis <[email protected]> 1721687437 +0100
committer Sam Willis <[email protected]> 1722326680 +0100

Docs site WIP

WIP Docs

More docs

Add docs site to web deploy

Tweeks

ci

Add docs to pnpm workspace

ci

WIP

WIP

WIP

WIP

Muti tab worker docs

Worker options

* Extension catalog

* ORM docs and uuid-ossp extension docs

* WIP Examples and Benchmarks pages

* More docs

* Edits

* Address feedback

* Format after rebase

* Address feedback
  • Loading branch information
samwillis authored Aug 8, 2024
1 parent a65206c commit ed72b67
Show file tree
Hide file tree
Showing 47 changed files with 6,365 additions and 712 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/build_pglite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,13 @@ jobs:
run: |
bash ./cibuild.sh demo-site
- name: Build docs
working-directory: ./docs
run: |
pnpm install
pnpm run docs:build
cp -r ./.vitepress/dist/* /tmp/web/
- name: Upload Postgres to Github artifacts
id: upload-postgres-wasm
uses: actions/upload-artifact@v4
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.DS_Store
.vscode

/node_modules
node_modules
/packages/pglite/dist
/packages/pglite/pgdata-test
/packages/pglite/package-lock.json
Expand All @@ -11,3 +11,6 @@
/postgresql-16.3.tar.bz2
/postgresql-16.3
/postgresql

docs/.vitepress/dist
docs/.vitepress/cache
29 changes: 9 additions & 20 deletions cibuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -382,29 +382,18 @@ do
;;

demo-site) echo "==================== demo-site =========================="
# Move all existing files to a subfolder
mkdir -p /tmp/web/x-term-repl
mv -r /tmp/web/* /tmp/web/x-term-repl/

echo "<html>
<body>
<ul>
<li><a href=./pglite/examples/repl.html>PGlite REPL (in-memory)</a></li>
<li><a href=./pglite/examples/repl-idb.html>PGlite REPL (indexedDB)</a></li>
<li><a href=./pglite/examples/notify.html>list/notify test</a></li>
<li><a href=./pglite/examples/index.html>All PGlite Examples</a></li>
<li><a href=./benchmark/index.html>Benchmarks</a> / <a href=./benchmark/rtt.html>RTT Benchmarks</a></li>
<li><a href=./postgres.html>Postgres xterm REPL</a></li>
</ul>
</body>
</html>" > /tmp/web/index.html

mkdir -p /tmp/web/pglite
mkdir -p /tmp/web/repl
mkdir -p /tmp/web/benchmarks
mkdir -p /tmp/web/dist
mkdir -p /tmp/web/examples
mkdir -p /tmp/web/benchmark

PGLITE=$(pwd)/packages/pglite
cp -r ${PGLITE}/dist /tmp/web/pglite/
cp -r ${PGLITE}/examples /tmp/web/pglite/
cp -r ${WORKSPACE}/packages/repl/dist-webcomponent /tmp/web/repl/
cp -r ${WORKSPACE}/packages/benchmark/dist/* /tmp/web/benchmarks/
cp -r ${PGLITE}/dist/* /tmp/web/dist/
cp -r ${PGLITE}/examples/* /tmp/web/examples/
cp -r ${WORKSPACE}/packages/benchmark/dist/* /tmp/web/benchmark/
;;
esac
shift
Expand Down
2 changes: 2 additions & 0 deletions docs/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.vitepress/dist
.vitepress/cache
95 changes: 95 additions & 0 deletions docs/.vitepress/config.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import { defineConfig } from 'vitepress'

// https://vitepress.dev/reference/site-config
export default defineConfig({
lang: 'en',
title: 'PGlite',
description: 'Lightweight WASM Postgres',
appearance: 'force-dark',
base: '/',
cleanUrls: true,
ignoreDeadLinks: [
(url) => {
// Ignore links to our example pages
return url.toLowerCase().startsWith('./examples')
},
(url) => {
// Ignore links to the benchmark runners
return url.toLowerCase().startsWith('./benchmark/')
},
],
head: [
[
'link',
{
rel: 'icon',
type: 'image/svg+xml',
href: '/img/brand/icon-light.svg',
},
],
],
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
logo: {
dark: '/img/brand/logo.svg',
light: '/img/brand/logo-light.svg',
},
nav: [
{ text: 'Home', link: '/' },
{ text: 'About', link: '/docs/about' },
{ text: 'Docs', link: '/docs/' },
{ text: 'Extensions', link: '/extensions/' },
{ text: 'ElectricSQL', link: 'https://www.electric-sql.com' },
],
sidebar: [
{
text: 'About',
items: [{ text: 'What is PGlite', link: '/docs/about' }],
},
{
text: 'Docs',
items: [
{ text: 'Getting Started', link: '/docs/' },
{ text: 'PGlite API', link: '/docs/api' },
{ text: 'Live Queries', link: '/docs/live-queries' },
{ text: 'Filesystems', link: '/docs/filesystems' },
{ text: 'Framework Hooks', link: '/docs/framework-hooks' },
{ text: 'Multi-tab Worker', link: '/docs/multi-tab-worker' },
{ text: 'REPL Component', link: '/docs/repl' },
{ text: 'ORM Support', link: '/docs/orm-support' },
],
},
{
text: 'Extensions',
items: [
{ text: 'Extensions Catalog', link: '/extensions/' },
{ text: 'Extension Development', link: '/extensions/development' },
],
},
{
text: 'Reference',
items: [
{ text: 'Examples', link: '/examples.md' },
{ text: 'Benchmarks', link: '/benchmarks.md' },
],
},
],
siteTitle: false,
socialLinks: [
{ icon: 'discord', link: 'https://discord.electric-sql.com' },
{ icon: 'github', link: 'https://github.com/electric-sql/pglite' },
],
footer: {
message:
'Dual-licensed under <a href="https://github.com/electric-sql/pglite/blob/main/LICENSE">Apache 2.0</a> and the <a href="https://github.com/electric-sql/pglite/blob/main/POSTGRES-LICENSE">PostgreSQL License</a>',
copyright: '© <a href="https://electric-sql.com/">ElectricSQL</a>',
},
},
vue: {
template: {
compilerOptions: {
isCustomElement: (tag) => tag.startsWith('pglite-'),
},
},
},
})
125 changes: 125 additions & 0 deletions docs/.vitepress/theme/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
@import url('https://fonts.googleapis.com/css2?family=Inter:[email protected]&display=swap');

:root,
.dark {
--vp-c-indigo-1: #d0bcff;
--vp-c-indigo-2: #998fe7;
--vp-c-indigo-3: #7e78db;

--vp-nav-logo-height: 30px;

--electric-color: #00d2a0;
--ddn-color: #d0bcff;
--pglite-color: #f6f95c;

--vp-c-brand-1: var(--pglite-color);
--vp-c-brand-2: #f1f35e;
--vp-c-brand-3: #d8da53;
}

.dark {
--vp-c-text-1: rgba(255, 255, 245, 0.92);
--vp-c-text-2: rgba(235, 235, 245, 0.75);
--vp-c-text-3: rgba(235, 235, 245, 0.55);
}

.img-row {
display: grid;
grid-template-columns: repeat(1, 1fr);
flex-direction: row;
margin: 20px 0;
gap: 10px;
}
.img-row-2 {
grid-template-columns: repeat(2, 1fr);
}
@media (max-width: 767px) {
.img-row-2 {
grid-template-columns: repeat(1, 1fr);
}
}
.img-border {
border: 1px #ccc solid;
border-radius: 10px;
padding: 10px;
background: rgb(20, 21, 23);
}
figure {
margin: 40px 0;
}
figcaption {
text-align: right;
font-size: 90%;
max-width: 460px;
margin-left: auto;
}

iframe {
color-scheme: auto;
}
.twitter-tweet {
margin: 35px auto -95px !important;
}
.twitter-tweet iframe {
transform: scale(0.8);
transform-origin: top left;
}

.VPHomeHero .VPImage.image-src {
max-width: min(calc(250px + 25vw), 560px);
margin-left: -40px;
margin-top: 10px;
}
@media (max-width: 959px) {
.VPHomeHero .image .image-container {
height: calc(190px + 15vw) !important;
margin-top: -20px;
}
.VPHomeHero .VPImage.image-src {
margin-left: 0px;
}
}

.VPFeatures {
padding-top: 15px !important;
padding-bottom: 45px;
}
.VPFeature .VPImage {
width: 50px;
}
.VPFeature h2.title {
font-size: 20px;
}
.VPFeature.link[href='/product/electric']:hover {
border-color: var(--electric-color);
}
.VPFeature.link[href='/product/pglite']:hover {
border-color: var(--pglite-color);
}

.VPFeature .details {
font-weight: 600 !important;
}

.product-icon {
width: 84px;
margin-bottom: 20px;
}

.about-zap {
max-width: min(calc(150px + 25vw), 420px);
margin: -20px 0 30px;
}
@media (max-width: 767px) {
.about-zap-container {
display: none;
}
}

.vp-doc blockquote {
margin: 25px 10px 30px;
}

.VPButton.brand {
color: var(--vp-c-gray-3) !important;
}
14 changes: 14 additions & 0 deletions docs/.vitepress/theme/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// .vitepress/theme/index.js
import { h } from 'vue'
import DefaultTheme from 'vitepress/theme-without-fonts'
import './custom.css'
import HeroImage from '../../components/HeroImage.vue'

export default {
extends: DefaultTheme,
Layout() {
return h(DefaultTheme.Layout, null, {
'home-hero-image': () => h(HeroImage),
})
},
}
Loading

1 comment on commit ed72b67

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.