Skip to content

Commit 426ccc8

Browse files
committed
Add initial VitePress documentation structure and GitHub Actions for deployment
1 parent e9c061b commit 426ccc8

File tree

7 files changed

+1768
-0
lines changed

7 files changed

+1768
-0
lines changed

.github/workflows/deploy-docs.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Deploy Docs
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
# Allows you to run this workflow manually from the Actions tab
8+
workflow_dispatch:
9+
10+
env:
11+
NODE_VER: 22.11
12+
CI: true
13+
14+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
15+
permissions:
16+
contents: read
17+
pages: write
18+
id-token: write
19+
20+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
21+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
22+
concurrency:
23+
group: pages
24+
cancel-in-progress: false
25+
26+
jobs:
27+
# Build job
28+
build:
29+
runs-on: ubuntu-latest
30+
steps:
31+
- name: Checkout
32+
uses: actions/checkout@v4
33+
with:
34+
fetch-depth: 0 # Required to calculate lastUpdated
35+
36+
- uses: pnpm/action-setup@v4
37+
name: Install pnpm
38+
with:
39+
run_install: false
40+
41+
- name: Use Node.js ${{ env.NODE_VER }}
42+
uses: actions/setup-node@v4
43+
with:
44+
node-version: ${{ env.NODE_VER }}
45+
cache: 'pnpm'
46+
47+
- name: Setup Pages
48+
uses: actions/configure-pages@v4
49+
50+
- name: Install dependencies
51+
run: pnpm i
52+
53+
- name: Build with VitePress
54+
run: pnpm docs:build
55+
56+
- name: Upload artifact
57+
uses: actions/upload-pages-artifact@v3
58+
with:
59+
path: docs/.vitepress/dist
60+
61+
# Deployment job
62+
deploy:
63+
environment:
64+
name: github-pages
65+
url: ${{ steps.deployment.outputs.page_url }}
66+
needs: build
67+
runs-on: ubuntu-latest
68+
name: Deploy
69+
steps:
70+
- name: Deploy to GitHub Pages
71+
id: deployment
72+
uses: actions/deploy-pages@v4

docs/.gitignore

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
## User-specific files
2+
.DS_Store
3+
.idea
4+
5+
## Vite Press related
6+
.vitepress/cache
7+
.vitepress/dist
8+
9+
node_modules
10+
*.iml
11+
*.log*
12+
.nuxt
13+
coverage
14+
dist
15+
sw.*
16+
.env
17+
.output

docs/.vitepress/config.mts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { defineConfig } from 'vitepress'
2+
3+
// https://vitepress.dev/reference/site-config
4+
export default defineConfig({
5+
title: "Krescent",
6+
description: "Kotlin Event Sourcing Library",
7+
base: '/krescent/',
8+
cleanUrls: true,
9+
lang: 'en-US',
10+
appearance: 'dark',
11+
lastUpdated: true,
12+
ignoreDeadLinks: 'localhostLinks',
13+
themeConfig: {
14+
// https://vitepress.dev/reference/default-theme-config
15+
nav: [
16+
{ text: 'Home', link: '/' },
17+
{ text: 'Examples', link: '/markdown-examples' }
18+
],
19+
search: {
20+
provider: "local"
21+
},
22+
23+
footer: {
24+
copyright: "Released under the Apache License 2.0",
25+
},
26+
27+
sidebar: [
28+
{
29+
text: 'Guide',
30+
items: [
31+
{ text: 'Installation', link: '/guide/installation' }
32+
]
33+
}
34+
],
35+
36+
socialLinks: [
37+
{ icon: 'github', link: 'https://github.com/helightdev/krescent' }
38+
]
39+
}
40+
})

docs/guide/installation.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
outline: deep
3+
---
4+
5+
# Runtime API Examples
6+
7+
This page demonstrates usage of some of the runtime APIs provided by VitePress.
8+
9+
The main `useData()` API can be used to access site, theme, and page data for the current page. It works in both `.md` and `.vue` files:
10+
11+
```md
12+
<script setup>
13+
import { useData } from 'vitepress'
14+
15+
const { theme, page, frontmatter } = useData()
16+
</script>
17+
18+
## Results
19+
20+
### Theme Data
21+
<pre>{{ theme }}</pre>
22+
23+
### Page Data
24+
<pre>{{ page }}</pre>
25+
26+
### Page Frontmatter
27+
<pre>{{ frontmatter }}</pre>
28+
```
29+
30+
<script setup>
31+
import { useData } from 'vitepress'
32+
33+
const { site, theme, page, frontmatter } = useData()
34+
</script>
35+
36+
## Results
37+
38+
### Theme Data
39+
<pre>{{ theme }}</pre>
40+
41+
### Page Data
42+
<pre>{{ page }}</pre>
43+
44+
### Page Frontmatter
45+
<pre>{{ frontmatter }}</pre>
46+
47+
## More
48+
49+
Check out the documentation for the [full list of runtime APIs](https://vitepress.dev/reference/runtime-api#usedata).

docs/index.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
# https://vitepress.dev/reference/default-theme-home-page
3+
layout: home
4+
5+
hero:
6+
name: "Krescent"
7+
text: "Simplified Kotlin Event Sourcing Library"
8+
actions:
9+
- theme: brand
10+
text: Getting Started
11+
link: /guide/installation
12+
13+
#features:
14+
# - title: Feature A
15+
# details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
16+
# - title: Feature B
17+
# details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
18+
# - title: Feature C
19+
# details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
20+
---
21+

docs/package.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "docs",
3+
"version": "1.0.0",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"test": "echo \"Error: no test specified\" && exit 1",
8+
"docs:dev": "vitepress dev",
9+
"docs:build": "vitepress build",
10+
"docs:preview": "vitepress preview"
11+
},
12+
"keywords": [],
13+
"author": "",
14+
"license": "ISC",
15+
"packageManager": "[email protected]",
16+
"devDependencies": {
17+
"vitepress": "^1.6.3"
18+
}
19+
}

0 commit comments

Comments
 (0)