Skip to content

Commit 247d159

Browse files
authored
Merge pull request #4 from robertpitt/feature/docs
Feature/docs
2 parents 620c6c1 + 1d74224 commit 247d159

37 files changed

Lines changed: 12458 additions & 139 deletions

.github/workflows/docs.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Deploy Documentation
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
contents: read
9+
pages: write
10+
id-token: write
11+
12+
concurrency:
13+
group: pages
14+
cancel-in-progress: false
15+
16+
jobs:
17+
build-and-deploy:
18+
environment:
19+
name: github-pages
20+
url: ${{ steps.deployment.outputs.page_url }}
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Setup pnpm
27+
uses: pnpm/action-setup@v4
28+
with:
29+
version: 9
30+
31+
- name: Setup Node.js
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version: 20
35+
cache: "pnpm"
36+
37+
- name: Install dependencies
38+
run: pnpm install --frozen-lockfile
39+
40+
- name: Build documentation
41+
run: pnpm run docs:build
42+
43+
- name: Setup Pages
44+
uses: actions/configure-pages@v5
45+
46+
- name: Upload artifact
47+
uses: actions/upload-pages-artifact@v3
48+
with:
49+
path: docs-site/.vitepress/dist
50+
51+
- name: Deploy to GitHub Pages
52+
id: deployment
53+
uses: actions/deploy-pages@v4
54+

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ node_modules/
33

44
# Build output
55
dist/
6+
docs-site/.vitepress/dist/
7+
docs-site/.vitepress/cache/
68

79
# Test output
810
coverage/

docs-site/.vitepress/config.ts

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
import { defineConfig } from 'vitepress';
2+
import { withMermaid } from 'vitepress-plugin-mermaid';
3+
4+
export default withMermaid(
5+
defineConfig({
6+
title: 'itty-spec',
7+
description: 'Contract-first, type-safe API definitions for itty-router',
8+
base: '/itty-spec/',
9+
lastUpdated: true,
10+
ignoreDeadLinks: true,
11+
cleanUrls: true,
12+
markdown: {
13+
theme: {
14+
light: 'github-light',
15+
dark: 'github-dark',
16+
},
17+
},
18+
themeConfig: {
19+
nav: [
20+
{ text: 'Guide', link: '/guide/getting-started' },
21+
{ text: 'API', link: '/api/' },
22+
{ text: 'Examples', link: '/examples/' },
23+
],
24+
sidebar: {
25+
'/guide/': [
26+
{
27+
text: 'Getting Started',
28+
items: [
29+
{ text: 'Introduction', link: '/guide/getting-started' },
30+
{ text: 'Core Concepts', link: '/guide/core-concepts' },
31+
],
32+
},
33+
{
34+
text: 'Guides',
35+
items: [
36+
{ text: 'Contracts', link: '/guide/contracts' },
37+
{ text: 'Router Configuration', link: '/guide/router-configuration' },
38+
{ text: 'Validation', link: '/guide/validation' },
39+
{ text: 'Type Safety', link: '/guide/type-safety' },
40+
{ text: 'Content Types', link: '/guide/content-types' },
41+
{ text: 'Middleware', link: '/guide/middleware' },
42+
{ text: 'Error Handling', link: '/guide/error-handling' },
43+
{ text: 'OpenAPI Integration', link: '/guide/openapi' },
44+
{ text: 'Schema Libraries', link: '/guide/schema-libraries' },
45+
{ text: 'Best Practices', link: '/guide/best-practices' },
46+
{ text: 'Advanced Patterns', link: '/guide/advanced-patterns' },
47+
],
48+
},
49+
{
50+
text: 'Additional',
51+
items: [
52+
{ text: 'Migration Guide', link: '/guide/migration' },
53+
{ text: 'Troubleshooting', link: '/guide/troubleshooting' },
54+
{ text: 'FAQ', link: '/guide/faq' },
55+
],
56+
},
57+
],
58+
'/api/': [
59+
{
60+
text: 'API Reference',
61+
items: [
62+
{ text: 'Overview', link: '/api/' },
63+
{ text: 'createContract', link: '/api/create-contract' },
64+
{ text: 'createRouter', link: '/api/create-router' },
65+
{ text: 'createOpenApiSpecification', link: '/api/create-openapi-specification' },
66+
{ text: 'Types', link: '/api/types' },
67+
{ text: 'Middleware API', link: '/api/middleware-api' },
68+
],
69+
},
70+
],
71+
'/examples/': [
72+
{
73+
text: 'Examples',
74+
items: [
75+
{ text: 'Overview', link: '/examples/' },
76+
{ text: 'Simple Example', link: '/examples/simple' },
77+
{ text: 'Complex Example', link: '/examples/complex' },
78+
{ text: 'Valibot Example', link: '/examples/valibot' },
79+
{ text: 'Content Types', link: '/examples/content-types' },
80+
{ text: 'Authentication', link: '/examples/authentication' },
81+
{ text: 'File Upload', link: '/examples/file-upload' },
82+
],
83+
},
84+
],
85+
},
86+
socialLinks: [
87+
{
88+
icon: 'github',
89+
link: 'https://github.com/robertpitt/itty-spec',
90+
},
91+
],
92+
footer: {
93+
message: 'Released under the MIT License.',
94+
copyright: 'Copyright © 2024',
95+
},
96+
},
97+
})
98+
);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// https://vitepress.dev/guide/custom-theme
2+
import type { Theme } from 'vitepress';
3+
import DefaultTheme from 'vitepress/theme';
4+
import './style.scss';
5+
6+
export default {
7+
extends: DefaultTheme,
8+
} satisfies Theme;

0 commit comments

Comments
 (0)