Skip to content

Commit a545890

Browse files
sjaghorisajaghoribenjaminstrasser
authored
(feat) adds docs template (#76)
* adds docs template setup * include vitepress config in tsconfig.json * change ci to trigger docs deploy * add base path * correct base path * remove on pull request docs deploy * unbumped versions Signed-off-by: Benjamin Strasser <bp.strasser@gmail.com> --------- Signed-off-by: Benjamin Strasser <bp.strasser@gmail.com> Co-authored-by: Sasan Jaghori <sasan.jaghori@iteratec.com> Co-authored-by: Benjamin Strasser <bp.strasser@gmail.com>
1 parent 0d4b109 commit a545890

File tree

10 files changed

+925
-3
lines changed

10 files changed

+925
-3
lines changed

.github/workflows/docs.yaml

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

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,7 @@ db.sqlite
3333
/package
3434

3535
vite.config.js.timestamp-*
36-
vite.config.ts.timestamp-*
36+
vite.config.ts.timestamp-*
37+
38+
docs/.vitepress/cache
39+
docs/.vitepress/dist

docs/.vitepress/config.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { defineConfig } from 'vitepress'
2+
3+
// https://vitepress.dev/reference/site-config
4+
export default defineConfig({
5+
base: '/tiny-tms/',
6+
title: 'Tiny TMS',
7+
description:
8+
'A Translation Management System to cover the needs of most people. Not for everyone, but for most.',
9+
themeConfig: {
10+
// https://vitepress.dev/reference/default-theme-config
11+
nav: [
12+
{ text: 'Home', link: '/' },
13+
{ text: 'Examples', link: '/markdown-examples' }
14+
],
15+
16+
sidebar: [
17+
{
18+
text: 'Examples',
19+
items: [
20+
{ text: 'Markdown Examples', link: '/markdown-examples' },
21+
{ text: 'Runtime API Examples', link: '/api-examples' }
22+
]
23+
}
24+
],
25+
26+
socialLinks: [{ icon: 'github', link: 'https://github.com/codingcommons/tiny-tms' }]
27+
}
28+
})

docs/api-examples.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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+
22+
<pre>{{ theme }}</pre>
23+
24+
### Page Data
25+
26+
<pre>{{ page }}</pre>
27+
28+
### Page Frontmatter
29+
30+
<pre>{{ frontmatter }}</pre>
31+
```
32+
33+
<script setup>
34+
import { useData } from 'vitepress'
35+
36+
const { site, theme, page, frontmatter } = useData()
37+
</script>
38+
39+
## Results
40+
41+
### Theme Data
42+
43+
<pre>{{ theme }}</pre>
44+
45+
### Page Data
46+
47+
<pre>{{ page }}</pre>
48+
49+
### Page Frontmatter
50+
51+
<pre>{{ frontmatter }}</pre>
52+
53+
## More
54+
55+
Check out the documentation for the [full list of runtime APIs](https://vitepress.dev/reference/runtime-api#usedata).

docs/index.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
# https://vitepress.dev/reference/default-theme-home-page
3+
layout: home
4+
5+
hero:
6+
name: 'Tiny TMS'
7+
text: 'Open Source Translation Management System'
8+
tagline: A Translation Management System to cover the needs of most people. Not for everyone, but for most.
9+
actions:
10+
- theme: brand
11+
text: Getting Started
12+
link: /markdown-examples
13+
- theme: alt
14+
text: API Examples
15+
link: /api-examples
16+
17+
features:
18+
- title: Feature A
19+
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
20+
- title: Feature B
21+
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
22+
- title: Feature C
23+
details: Lorem ipsum dolor sit amet, consectetur adipiscing elit
24+
---

docs/markdown-examples.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Markdown Extension Examples
2+
3+
This page demonstrates some of the built-in markdown extensions provided by VitePress.
4+
5+
## Syntax Highlighting
6+
7+
VitePress provides Syntax Highlighting powered by [Shiki](https://github.com/shikijs/shiki), with additional features like line-highlighting:
8+
9+
**Input**
10+
11+
````md
12+
```js{4}
13+
export default {
14+
data () {
15+
return {
16+
msg: 'Highlighted!'
17+
}
18+
}
19+
}
20+
```
21+
````
22+
23+
**Output**
24+
25+
```js{4}
26+
export default {
27+
data () {
28+
return {
29+
msg: 'Highlighted!'
30+
}
31+
}
32+
}
33+
```
34+
35+
## Custom Containers
36+
37+
**Input**
38+
39+
```md
40+
::: info
41+
This is an info box.
42+
:::
43+
44+
::: tip
45+
This is a tip.
46+
:::
47+
48+
::: warning
49+
This is a warning.
50+
:::
51+
52+
::: danger
53+
This is a dangerous warning.
54+
:::
55+
56+
::: details
57+
This is a details block.
58+
:::
59+
```
60+
61+
**Output**
62+
63+
::: info
64+
This is an info box.
65+
:::
66+
67+
::: tip
68+
This is a tip.
69+
:::
70+
71+
::: warning
72+
This is a warning.
73+
:::
74+
75+
::: danger
76+
This is a dangerous warning.
77+
:::
78+
79+
::: details
80+
This is a details block.
81+
:::
82+
83+
## More
84+
85+
Check out the documentation for the [full list of markdown extensions](https://vitepress.dev/guide/markdown).

package.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@
2323
"migrate:up": "pnpm run migrate -- up",
2424
"migrate:down": "pnpm run migrate -- down",
2525
"db-types": "cross-env DATABASE_URL=db.sqlite kysely-codegen",
26+
"---- DOCS ----------------------------------------------------------": "",
27+
"docs:dev": "vitepress dev docs",
28+
"docs:build": "vitepress build docs",
29+
"docs:preview": "vitepress preview docs --port 8080",
30+
"---- MISC ----------------------------------------------------------": "",
2631
"prepare": "husky || true"
2732
},
2833
"dependencies": {
@@ -46,6 +51,7 @@
4651
"zod": "^3.23.5"
4752
},
4853
"devDependencies": {
54+
"vitepress": "^1.2.3",
4955
"@eslint/js": "^9.2.0",
5056
"@playwright/test": "^1.44.0",
5157
"@sveltejs/adapter-node": "^5.0.1",

0 commit comments

Comments
 (0)