Skip to content

Commit 5fd6065

Browse files
committed
feat: monorepo and docs
1 parent a93eedb commit 5fd6065

84 files changed

Lines changed: 2224 additions & 3318 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
indent_style = space
6+
indent_size = 2
7+
end_of_line = lf
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**/*.md

.eslintrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"extends": [
3+
"@antfu",
4+
"@unocss"
5+
]
6+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: 构建预览文档并部署到 Netlify
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build:
10+
name: 构建
11+
runs-on: ubuntu-22.04
12+
environment:
13+
name: 预览文档 Preview Docs
14+
url: ${{ steps.netlify-deployment.outputs.NETLIFY_URL }}
15+
steps:
16+
- name: 签出代码
17+
uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0
20+
21+
- name: 安装 Node.js 20.x
22+
uses: actions/setup-node@v3
23+
with:
24+
node-version: 20.x
25+
26+
- name: 安装 pnpm
27+
uses: pnpm/action-setup@v2
28+
with:
29+
run_install: false
30+
version: 8
31+
32+
- name: 获取 pnpm store 目录
33+
shell: bash
34+
run: |
35+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
36+
37+
- name: 配置 pnpm 缓存
38+
uses: actions/cache@v3
39+
with:
40+
path: ${{ env.STORE_PATH }}
41+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
42+
restore-keys: |
43+
${{ runner.os }}-pnpm-store-
44+
45+
- name: 安装依赖
46+
run: pnpm install --frozen-lockfile
47+
48+
- name: 构建
49+
run: pnpm docs:build
50+
51+
- name: 部署到 Netlify
52+
id: netlify-deployment
53+
uses: netlify/actions/cli@master
54+
timeout-minutes: 10
55+
with:
56+
args: deploy --dir=.vitepress/dist --functions=netlify/functions
57+
secrets: '["NETLIFY_AUTH_TOKEN", "NETLIFY_SITE_ID"]'
58+
env:
59+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
60+
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
61+
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: 构建文档并部署到 Netlify
2+
3+
on:
4+
push:
5+
branches:
6+
- 'main'
7+
8+
jobs:
9+
build:
10+
name: 构建
11+
runs-on: ubuntu-22.04
12+
environment:
13+
name: 正式文档 Production Docs
14+
url: https://nolebase-plugins.ayaka.io
15+
steps:
16+
- name: 签出代码
17+
uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0
20+
21+
- name: 安装 Node.js 20.x
22+
uses: actions/setup-node@v3
23+
with:
24+
node-version: 20.x
25+
26+
- name: 安装 pnpm
27+
uses: pnpm/action-setup@v2
28+
with:
29+
run_install: false
30+
version: 8
31+
32+
- name: 获取 pnpm store 目录
33+
shell: bash
34+
run: |
35+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
36+
37+
- name: 配置 pnpm 缓存
38+
uses: actions/cache@v3
39+
with:
40+
path: ${{ env.STORE_PATH }}
41+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
42+
restore-keys: |
43+
${{ runner.os }}-pnpm-store-
44+
45+
- name: 安装依赖
46+
run: pnpm install --frozen-lockfile
47+
48+
- name: 构建
49+
run: pnpm docs:build
50+
51+
- name: 部署到 Netlify
52+
id: netlify-deployment
53+
uses: netlify/actions/cli@master
54+
timeout-minutes: 10
55+
with:
56+
args: deploy --dir=.vitepress/dist --functions=netlify/functions --prod
57+
secrets: '["NETLIFY_AUTH_TOKEN", "NETLIFY_SITE_ID"]'
58+
env:
59+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
60+
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
61+

.vscode/settings.json

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
{
2-
"cSpell.words": [
3-
"easytag"
4-
]
2+
"cSpell.words": [
3+
"easytag"
4+
],
5+
"prettier.enable": false,
6+
"editor.formatOnSave": false,
7+
"editor.codeActionsOnSave": {
8+
"source.fixAll.eslint": true,
9+
"source.organizeImports": false
10+
},
11+
// The following is optional.
12+
// It's better to put under project setting `.vscode/settings.json`
13+
// to avoid conflicts with working with different eslint configs
14+
// that does not support all formats.
15+
"eslint.validate": [
16+
"javascript",
17+
"javascriptreact",
18+
"typescript",
19+
"typescriptreact",
20+
"vue",
21+
"html",
22+
"markdown",
23+
"json",
24+
"jsonc",
25+
"yaml"
26+
]
27+
// "explorer.excludeGitIgnore": true
528
}

docs/.vitepress/config.ts

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import { cwd } from 'node:process'
2+
import { defineConfig } from 'vitepress'
3+
import MarkdownItBiDirectionalLinks from '@nolebase/markdown-it-bi-directional-links'
4+
5+
// https://vitepress.dev/reference/site-config
6+
export default defineConfig({
7+
themeConfig: {
8+
socialLinks: [
9+
{ icon: 'github', link: 'https://github.com/nolebase/plugins' },
10+
],
11+
},
12+
locales: {
13+
'root': {
14+
label: 'English',
15+
lang: 'en',
16+
link: '/pages/en/',
17+
title: 'Nólëbase Plugins',
18+
description: 'Great plugins that made from the creators of Nólëbase',
19+
themeConfig: {
20+
nav: [
21+
{ text: 'Home', link: '/pages/en/' },
22+
],
23+
sidebar: [
24+
{
25+
text: 'Markdown It Plugins',
26+
items: [
27+
{ text: 'Bi-directional Links', link: '/pages/en/plugins/markdown-it-bi-directional-links/' },
28+
],
29+
},
30+
],
31+
},
32+
},
33+
'zh-CN': {
34+
label: '简体中文',
35+
lang: 'zh-CN',
36+
link: '/pages/zh-CN/',
37+
title: 'Nólëbase 插件',
38+
description: '由 Nólëbase 的创作者们制作的优秀插件',
39+
themeConfig: {
40+
nav: [
41+
{ text: '首页', link: '/pages/zh-CN/' },
42+
],
43+
sidebar: [
44+
{
45+
text: 'Markdown It 插件',
46+
items: [
47+
{ text: '双向链接', link: '/pages/zh-CN/plugins/markdown-it-bi-directional-links/' },
48+
],
49+
},
50+
],
51+
},
52+
},
53+
},
54+
markdown: {
55+
config(md) {
56+
md.use(MarkdownItBiDirectionalLinks({
57+
dir: cwd(),
58+
}))
59+
// md.use(MarkdownItTokenTransform({
60+
// transformToken: (token) => {
61+
// switch (token.type) {
62+
// case 'link_open':
63+
// token.tag = 'LinkPreviewPopup'
64+
// break
65+
// case 'link_close':
66+
// token.tag = 'LinkPreviewPopup'
67+
// }
68+
// },
69+
// }))
70+
},
71+
},
72+
})
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// https://vitepress.dev/guide/custom-theme
22
import { h } from 'vue'
33
import Theme from 'vitepress/theme'
4-
import './style.css'
4+
import './styles/vars.css'
5+
import './styles/main.css'
56

67
export default {
78
extends: Theme,
@@ -12,5 +13,5 @@ export default {
1213
},
1314
enhanceApp({ app, router, siteData }) {
1415
// ...
15-
}
16+
},
1617
}

0 commit comments

Comments
 (0)