Skip to content

Commit 7ae694e

Browse files
committed
feat: new vitepress website merge docs
1 parent c8bba7d commit 7ae694e

26 files changed

Lines changed: 3664 additions & 6 deletions

.github/workflows/docs-pages.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: docs-pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'docs/**'
9+
- '.github/workflows/docs-pages.yml'
10+
workflow_dispatch:
11+
12+
permissions:
13+
contents: read
14+
pages: write
15+
id-token: write
16+
17+
concurrency:
18+
group: docs-pages
19+
cancel-in-progress: true
20+
21+
jobs:
22+
build:
23+
name: Build VitePress site
24+
runs-on: ubuntu-latest
25+
defaults:
26+
run:
27+
working-directory: docs
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@v4
31+
32+
- name: Setup Node.js
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version: 22
36+
cache: npm
37+
cache-dependency-path: docs/package-lock.json
38+
39+
- name: Configure GitHub Pages
40+
uses: actions/configure-pages@v5
41+
42+
- name: Install dependencies
43+
run: npm ci
44+
45+
- name: Build site
46+
run: npm run build
47+
48+
- name: Upload Pages artifact
49+
uses: actions/upload-pages-artifact@v3
50+
with:
51+
path: docs/.vitepress/dist
52+
53+
deploy:
54+
name: Deploy GitHub Pages site
55+
needs: build
56+
runs-on: ubuntu-latest
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@v4

.github/workflows/main.yml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
name: cjit
22
on:
33
push:
4-
paths-ignore:
5-
- 'docs/**'
6-
- '*.md'
74
branches:
85
- main
6+
paths:
7+
- '**'
8+
- '!docs/**'
9+
- '!**/*.md'
10+
- '!.github/workflows/docs-pages.yml'
911
pull_request:
10-
paths-ignore:
11-
- 'docs/**'
12-
- '*.md'
1312
branches:
1413
- main
14+
paths:
15+
- '**'
16+
- '!docs/**'
17+
- '!**/*.md'
18+
- '!.github/workflows/docs-pages.yml'
1519

1620
concurrency:
1721
group: ${{ github.workflow }}-${{ github.ref_name }}

docs/.vitepress/config.mts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { defineConfig } from 'vitepress'
2+
3+
const repositoryName = process.env.GITHUB_REPOSITORY?.split('/')[1]
4+
const isGitHubActions = process.env.GITHUB_ACTIONS === 'true'
5+
const isUserSite = repositoryName?.endsWith('.github.io')
6+
const base = isGitHubActions && repositoryName && !isUserSite
7+
? `/${repositoryName}/`
8+
: '/'
9+
10+
// https://vitepress.dev/reference/site-config
11+
export default defineConfig({
12+
base,
13+
title: "CJIT",
14+
description: "C, Just in Time!",
15+
themeConfig: {
16+
// https://vitepress.dev/reference/default-theme-config
17+
nav: [
18+
{ text: 'CJIT Tutorial', link: '/' },
19+
{ text: 'About Dyne.org', link: 'https://dyne.org' }
20+
],
21+
22+
sidebar: [
23+
{
24+
text: 'Tutorial',
25+
items: [
26+
{ text: 'Get started', link: '/tutorial' },
27+
{ text: 'Graphics', link: '/graphics' },
28+
{ text: 'Sound', link: '/sound' },
29+
{ text: 'Filesystem', link: '/filesystem' },
30+
{ text: 'Terminal UI', link: '/tui' },
31+
{ text: 'Manpage', link: '/manpage' },
32+
{ text: 'FAQs', link: '/faq' }
33+
]
34+
}
35+
],
36+
37+
socialLinks: [
38+
{ icon: 'github', link: 'https://github.com/dyne/cjit' }
39+
]
40+
}
41+
})
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<template>
2+
<div class="doc-brand">
3+
<DyneBrand variant="doc" />
4+
</div>
5+
</template>
6+
7+
<script setup lang="ts">
8+
import DyneBrand from './DyneBrand.vue'
9+
</script>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<template>
2+
<span class="dyne-brand" :class="variant">
3+
<img class="dyne-brand__mark" src="/dyne-mark.svg" alt="Dyne.org" />
4+
<img class="dyne-brand__mark" src="/dyne-logotype.svg" alt="foundation" />
5+
</span>
6+
</template>
7+
8+
<script setup lang="ts">
9+
defineProps<{
10+
variant?: 'nav' | 'doc'
11+
}>()
12+
</script>

docs/.vitepress/theme/index.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// https://vitepress.dev/guide/custom-theme
2+
import { h } from 'vue'
3+
import type { Theme } from 'vitepress'
4+
import DefaultTheme from 'vitepress/theme'
5+
import DocBrand from './components/DocBrand.vue'
6+
import DyneBrand from './components/DyneBrand.vue'
7+
import './style.css'
8+
9+
export default {
10+
extends: DefaultTheme,
11+
Layout: () => {
12+
return h(DefaultTheme.Layout, null, {
13+
// https://vitepress.dev/guide/extending-default-theme#layout-slots
14+
'nav-bar-title-before': () => h(DyneBrand, { variant: 'nav' }),
15+
// 'doc-before': () => h(DocBrand)
16+
})
17+
},
18+
enhanceApp({ app, router, siteData }) {
19+
// ...
20+
}
21+
} satisfies Theme

0 commit comments

Comments
 (0)