Skip to content

Commit f1bb844

Browse files
committed
feat: add vitepress
1 parent eb30754 commit f1bb844

File tree

22 files changed

+388
-77
lines changed

22 files changed

+388
-77
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
*.less text
2121
*.styl text
2222
*.js text
23+
*.jsx text
2324
*.ts text
25+
*.tsx text
2426
*.coffee text
2527
*.json text
2628
*.htm text

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ jobs:
2525
- run: yarn build
2626
- run: yarn lint
2727
- run: yarn test
28-
- run: yarn samples
2928
- uses: actions/upload-artifact@v2
3029
if: failure()
3130
with:
3231
name: diff outputs
3332
path: src/**/__diff_output__/*.png
33+
- run: yarn docs:build
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Deploy Website
2+
on:
3+
workflow_dispatch: {}
4+
push:
5+
branches:
6+
- main
7+
jobs:
8+
deploy:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
pages: write
12+
id-token: write
13+
environment:
14+
name: github-pages
15+
url: ${{ steps.deployment.outputs.page_url }}
16+
steps:
17+
- uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0
20+
- uses: actions/setup-node@v3
21+
with:
22+
node-version: 16
23+
cache: npm
24+
- run: npm i -g yarn
25+
- run: yarn config set checksumBehavior ignore
26+
- name: Cache Node.js modules
27+
uses: actions/cache@v3
28+
with:
29+
path: |
30+
./.yarn/cache
31+
./.yarn/unplugged
32+
key: ${{ runner.os }}-yarn2-v5-${{ hashFiles('**/yarn.lock') }}
33+
restore-keys: |
34+
${{ runner.os }}-yarn2-v5
35+
- run: yarn install
36+
- run: yarn docs:build
37+
- uses: actions/configure-pages@v2
38+
- uses: actions/upload-pages-artifact@v1
39+
with:
40+
path: docs/.vitepress/dist
41+
- name: Deploy
42+
id: deployment
43+
uses: actions/deploy-pages@v1

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@ npm-debug.log*
1919

2020
*.tgz
2121
/.vscode/extensions.json
22-
/docs
2322
*.tsbuildinfo
2423
.eslintcache
2524
__diff_output__
2625

27-
/samples/type_test.js
26+
docs/.vitepress/dist
27+
docs/.vitepress/cache
28+
docs/.vitepress/config.ts.timestamp*
29+
docs/api/

.prettierignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
/.yarnrc.yml
33
/.yarn
44
/build
5-
/docs
5+
/docs/.vitepress/cache
6+
/docs/.vitepress/dist
7+
/docs/.vitepress/config.ts.timestamp*
8+
/docs/api
69
/coverage
710
/.gitattributes
811
/.gitignore
@@ -14,4 +17,4 @@
1417
*.tgz
1518
*.tsbuildinfo
1619
.eslintcache
17-
/samples/type_test.js
20+
.nojekyll

.vscode/settings.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
"[yaml]": {
1414
"editor.defaultFormatter": "esbenp.prettier-vscode"
1515
},
16-
"prettier.packageManager": "yarn",
17-
"eslint.packageManager": "yarn",
1816
"npm.packageManager": "yarn",
1917
"eslint.nodePath": ".yarn/sdks",
2018
"prettier.prettierPath": ".yarn/sdks/prettier/index.js",
@@ -23,7 +21,6 @@
2321
"typescript.enablePromptUseWorkspaceTsdk": true,
2422
"editor.detectIndentation": false,
2523
"editor.tabSize": 2,
26-
"liveServer.settings.port": 5504,
2724
"search.exclude": {
2825
"**/.yarn": true,
2926
"**/.pnp.*": true

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019-2022 Samuel Gratzl
3+
Copyright (c) 2019-2023 Samuel Gratzl
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

docs/.vitepress/config.ts

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import { defineConfig } from 'vitepress';
2+
import { name, description, repository, license, author } from '../../package.json';
3+
import typedocSidebar from '../api/typedoc-sidebar.json';
4+
5+
const cleanName = name.replace('@sgratzl/', '');
6+
7+
// https://vitepress.dev/reference/site-config
8+
export default defineConfig({
9+
title: cleanName,
10+
description,
11+
base: `/${cleanName}/`,
12+
useWebFonts: false,
13+
themeConfig: {
14+
// https://vitepress.dev/reference/default-theme-config
15+
nav: [
16+
{ text: 'Home', link: '/' },
17+
{ text: 'Getting Started', link: '/getting-started' },
18+
{ text: 'Examples', link: '/examples/' },
19+
{ text: 'API', link: '/api/' },
20+
{ text: 'Related Plugins', link: '/related' },
21+
],
22+
23+
sidebar: [
24+
{
25+
text: 'Examples',
26+
items: [{ text: 'Basic', link: '/examples/' }],
27+
},
28+
{
29+
text: 'API',
30+
collapsed: true,
31+
items: typedocSidebar,
32+
},
33+
],
34+
35+
socialLinks: [{ icon: 'github', link: repository.url.replace('.git', '') }],
36+
37+
footer: {
38+
message: `Released under the <a href="${repository.url.replace(
39+
'.git',
40+
''
41+
)}/tree/main/LICENSE">${license} license</a>.`,
42+
copyright: `Copyright © 2019-present <a href="${author.url}">${author.name}</a>`,
43+
},
44+
45+
editLink: {
46+
pattern: `${repository.url.replace('.git', '')}/edit/main/docs/:path`,
47+
},
48+
49+
search: {
50+
provider: 'local',
51+
},
52+
},
53+
});

docs/.vitepress/theme/index.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import Theme from 'vitepress/theme';
2+
import { createTypedChart } from 'vue-chartjs';
3+
import { Tooltip, LineElement, PointElement } from 'chart.js';
4+
import { DendrogramController, ForceDirectedGraphController, EdgeLine, TreeController } from '../../../src';
5+
6+
export default {
7+
...Theme,
8+
enhanceApp({ app }) {
9+
const deps = [
10+
Tooltip,
11+
LineElement,
12+
PointElement,
13+
DendrogramController,
14+
ForceDirectedGraphController,
15+
EdgeLine,
16+
TreeController,
17+
];
18+
app.component('DendrogramChart', createTypedChart('dendrogram', deps));
19+
app.component('TreeChart', createTypedChart('tree', deps));
20+
app.component('ForceDirectedGraphChart', createTypedChart('forceDirected', deps));
21+
},
22+
};

docs/examples/force.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: Force Directed Graph
3+
---
4+
5+
# Force Directed Graph
6+
7+
<script setup>
8+
import {config} from './force';
9+
</script>
10+
11+
<ForceDirectedGraphChart
12+
:options="config.options"
13+
:data="config.data"
14+
/>
15+
16+
### Code
17+
18+
:::code-group
19+
20+
<<< ./force.ts#config [config]
21+
22+
<<< ./force.ts#data [data]
23+
24+
:::

0 commit comments

Comments
 (0)