Skip to content

Commit eeb3a7c

Browse files
authored
feat: integrate rspress (#39)
1 parent 561d171 commit eeb3a7c

22 files changed

+567
-37
lines changed

.prettierrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"singleQuote": true,
3+
"semi": false,
4+
"trailingComma": "all"
5+
}

cli/create-documate/index.js

+17-19
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,7 @@ const fs = require('fs-extra')
44
const path = require('path')
55
const prompts = require('prompts')
66

7-
const {
8-
green,
9-
lightBlue,
10-
red,
11-
reset,
12-
} = require('kolorist')
7+
const { green, lightBlue, red, reset } = require('kolorist')
138

149
function pkgFromUserAgent(userAgent) {
1510
if (!userAgent) return undefined
@@ -42,6 +37,11 @@ const TEMPLATES = [
4237
display: 'Docusaurus',
4338
devCommand: '__PACKAGE_MANAGER__ start',
4439
},
40+
{
41+
name: 'rspress',
42+
display: 'Rspress',
43+
devCommand: '__PACKAGE_MANAGER__ dev',
44+
},
4545
]
4646

4747
const DEFAULT_PROJECT_NAME = 'my-documate-project'
@@ -78,19 +78,15 @@ async function create(name, options) {
7878

7979
if (questions.length > 0) {
8080
try {
81-
result = await prompts(
82-
questions,
83-
{
84-
onCancel: () => {
85-
throw new Error(red('✖') + ' Operation cancelled')
86-
},
81+
result = await prompts(questions, {
82+
onCancel: () => {
83+
throw new Error(red('✖') + ' Operation cancelled')
8784
},
88-
)
85+
})
8986

9087
// user choice associated with prompts
9188
template = template || result.template.name
9289
projectName = projectName || result.projectName
93-
9490
} catch (cancelled) {
9591
console.log(cancelled.message)
9692
return
@@ -110,20 +106,22 @@ async function create(name, options) {
110106
console.log(`\nDone.\n`)
111107

112108
console.log(' cd', projectName)
113-
console.log(` ${pkgManager === 'yarn' ? 'yarn' : `${pkgManager} install`}`)
109+
console.log(
110+
` ${pkgManager === 'yarn' ? 'yarn' : `${pkgManager} install`}`,
111+
)
114112

115-
const selected = TEMPLATES.find(t => t.name === template)
113+
const selected = TEMPLATES.find((t) => t.name === template)
116114
const devCommand = selected
117115
? selected.devCommand.replace('__PACKAGE_MANAGER__', pkgManager)
118116
: `${pkgManager} run dev`
119117
console.log(` ${devCommand}`)
120118

121119
console.log('\nVisit https://documate.site for more information.')
122120
})
123-
.catch(err => console.error('err: '+ err))
121+
.catch((err) => console.error('err: ' + err))
124122
}
125123

126-
async function main () {
124+
async function main() {
127125
program
128126
.name('create-documate')
129127
.argument('[project-name]')
@@ -133,6 +131,6 @@ async function main () {
133131
await program.parseAsync(process.argv)
134132
}
135133

136-
main().catch(err => {
134+
main().catch((err) => {
137135
console.error(err)
138136
})

docs/.vitepress/config.ts

+25-15
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,21 @@ import { tabsMarkdownPlugin } from 'vitepress-plugin-tabs'
55
// https://vitepress.dev/reference/site-config
66
export default defineConfig({
77
title: 'Documate',
8-
description: 'Seamlessly embed AI chat into your doc site. Documate is fully open-source, controllable, and customizable.',
8+
description:
9+
'Seamlessly embed AI chat into your doc site. Documate is fully open-source, controllable, and customizable.',
910
head: [
10-
[ 'link', { rel: 'icon', href: '/favicon.ico' } ],
11-
[ 'meta', { name: 'robots', content: 'index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1' } ],
12-
[ 'meta', { name: 'twitter:card', content: 'summary_large_image' } ],
13-
[ 'meta', { name: 'og:image', content: '/og-image-0916.png' } ],
14-
[ 'meta', { name: 'twitter:image', content: '/og-image-0916.png' } ],
11+
['link', { rel: 'icon', href: '/favicon.ico' }],
12+
[
13+
'meta',
14+
{
15+
name: 'robots',
16+
content:
17+
'index, follow, max-image-preview:large, max-snippet:-1, max-video-preview:-1',
18+
},
19+
],
20+
['meta', { name: 'twitter:card', content: 'summary_large_image' }],
21+
['meta', { name: 'og:image', content: '/og-image-0916.png' }],
22+
['meta', { name: 'twitter:image', content: '/og-image-0916.png' }],
1523
],
1624
cleanUrls: true,
1725
vite: {
@@ -20,8 +28,8 @@ export default defineConfig({
2028
{
2129
find: /^.*\/VPFeature\.vue$/,
2230
replacement: fileURLToPath(
23-
new URL('./theme/components/DocuFeature.vue', import.meta.url)
24-
)
31+
new URL('./theme/components/DocuFeature.vue', import.meta.url),
32+
),
2533
},
2634
],
2735
},
@@ -33,7 +41,7 @@ export default defineConfig({
3341
},
3442
themeConfig: {
3543
// https://vitepress.dev/reference/default-theme-config
36-
logo: {
44+
logo: {
3745
light: '/site-logo-light.svg',
3846
dark: '/site-logo-dark.svg',
3947
height: 24,
@@ -42,12 +50,12 @@ export default defineConfig({
4250
siteTitle: false,
4351

4452
outline: {
45-
level: [ 2, 3 ],
53+
level: [2, 3],
4654
},
4755

4856
nav: [
4957
{ text: 'Quickstart', link: '/getting-started/' },
50-
{ text: 'Reference', link: '/reference/documate-config' }
58+
{ text: 'Reference', link: '/reference/documate-config' },
5159
],
5260

5361
sidebar: [
@@ -59,6 +67,7 @@ export default defineConfig({
5967
{ text: 'Start with VitePress', link: '/integration/vitepress' },
6068
{ text: 'Start with Docusaurus', link: '/integration/docusaurus' },
6169
{ text: 'Start with Docsify', link: '/integration/docsify' },
70+
{ text: 'Start with Rspress', link: '/integration/rspress' },
6271
{ text: 'General Vue Project', link: '/getting-started/general-vue' },
6372
],
6473
},
@@ -69,18 +78,19 @@ export default defineConfig({
6978
{ text: 'CLI', link: '/reference/cli' },
7079
{ text: '@documate/vue', link: '/reference/documate-vue' },
7180
// { text: 'Backend APIs', link: '/reference/backend-apis' },
72-
]
81+
],
7382
},
7483
],
7584

7685
socialLinks: [
7786
{ icon: 'github', link: 'https://github.com/aircodelabs/documate' },
78-
{ icon: 'discord', link: 'https://discord.gg/YhypQrZBu5' }
87+
{ icon: 'discord', link: 'https://discord.gg/YhypQrZBu5' },
7988
],
8089

8190
footer: {
82-
message: 'Made with ❤️ by <a href="https://aircode.io" target="_blank">AirCode</a>',
91+
message:
92+
'Made with ❤️ by <a href="https://aircode.io" target="_blank">AirCode</a>',
8393
copyright: '© 2023 AirCode, Inc. All rights reserved.',
84-
}
94+
},
8595
},
8696
})

docs/getting-started/index.md

+44-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Documate Quickstart
22

3-
Documate is an open-source tool designed to seamlessly __integrate an AI chat dialog into your documentation site__.
3+
Documate is an open-source tool designed to seamlessly **integrate an AI chat dialog into your documentation site**.
44

55
It uses your content to generate real-time answers to user questions, effectively acting as a "ChatGPT" for your platform.
66

@@ -13,6 +13,7 @@ Please choose a framework below to get started:
1313
- [VitePress](/integration/vitepress)
1414
- [Docusaurus](/integration/docusaurus)
1515
- [Docsify](/integration/docsify)
16+
- [Rspress](/integration/rspress)
1617
- [General Vue Project](/getting-started/general-vue)
1718

1819
The following frameworks are coming soon:
@@ -30,7 +31,7 @@ Documate can integrate with popular frameworks you're already familiar with, suc
3031

3132
### Easy to Use
3233

33-
No AI or vector search knowledge required. Simply follow a few steps, and you can integrate Documate into your site in minutes.
34+
No AI or vector search knowledge required. Simply follow a few steps, and you can integrate Documate into your site in minutes.
3435

3536
### Fully Controllable
3637

@@ -52,49 +53,90 @@ These examples can serve as headless templates to kickstart a new documentation
5253

5354
::: tabs key:pm
5455
== npm
56+
5557
```bash
5658
npm create documate@latest --template vitepress
5759
```
60+
5861
== yarn
62+
5963
```bash
6064
yarn create documate --template vitepress
6165
```
66+
6267
== pnpm
68+
6369
```bash
6470
pnpm create documate --template vitepress
6571
```
72+
6673
:::
6774

6875
- Docusaurus ([examples/docusaurus](https://github.com/AirCodeLabs/documate/tree/main/examples/docusaurus))
6976

7077
::: tabs key:pm
7178
== npm
79+
7280
```bash
7381
npm create documate@latest --template docusaurus
7482
```
83+
7584
== yarn
85+
7686
```bash
7787
yarn create documate --template docusaurus
7888
```
89+
7990
== pnpm
91+
8092
```bash
8193
pnpm create documate --template docusaurus
8294
```
95+
8396
:::
8497

8598
- Docsify ([examples/docsify](https://github.com/AirCodeLabs/documate/tree/main/examples/docsify))
8699

87100
::: tabs key:pm
88101
== npm
102+
89103
```bash
90104
npm create documate@latest --template docsify
91105
```
106+
92107
== yarn
108+
93109
```bash
94110
yarn create documate --template docsify
95111
```
112+
96113
== pnpm
114+
97115
```bash
98116
pnpm create documate --template docsify
99117
```
118+
119+
:::
120+
121+
- Rspress ([examples/rspress](https://github.com/AirCodeLabs/documate/tree/main/examples/rspress))
122+
123+
::: tabs key:pm
124+
== npm
125+
126+
```bash
127+
npm create documate@latest --template rspress
128+
```
129+
130+
== yarn
131+
132+
```bash
133+
yarn create documate --template rspress
134+
```
135+
136+
== pnpm
137+
138+
```bash
139+
pnpm create documate --template rspress
140+
```
141+
100142
:::

0 commit comments

Comments
 (0)