create-react-docs-ui 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js ADDED
@@ -0,0 +1,131 @@
1
+ #!/usr/bin/env node
2
+
3
+ import fs from 'node:fs'
4
+ import path from 'node:path'
5
+ import { fileURLToPath } from 'node:url'
6
+
7
+ const __dirname = path.dirname(fileURLToPath(import.meta.url))
8
+
9
+ function copy(src, dest) {
10
+ const stat = fs.statSync(src)
11
+ if (stat.isDirectory()) {
12
+ copyDir(src, dest)
13
+ } else {
14
+ const destDir = path.dirname(dest)
15
+ fs.mkdirSync(destDir, { recursive: true })
16
+ fs.copyFileSync(src, dest)
17
+ }
18
+ }
19
+
20
+ function copyDir(srcDir, destDir) {
21
+ fs.mkdirSync(destDir, { recursive: true })
22
+ for (const file of fs.readdirSync(srcDir)) {
23
+ const srcFile = path.resolve(srcDir, file)
24
+ const destFile = path.resolve(destDir, file)
25
+ copy(srcFile, destFile)
26
+ }
27
+ }
28
+
29
+ function isEmpty(dirPath) {
30
+ const files = fs.existsSync(dirPath) ? fs.readdirSync(dirPath) : []
31
+ return files.length === 0 || (files.length === 1 && files[0] === '.git')
32
+ }
33
+
34
+ function emptyDir(dir) {
35
+ if (!fs.existsSync(dir)) return
36
+ for (const file of fs.readdirSync(dir)) {
37
+ if (file === '.git') continue
38
+ fs.rmSync(path.resolve(dir, file), { recursive: true, force: true })
39
+ }
40
+ }
41
+
42
+ function toValidPackageName(projectName) {
43
+ return projectName
44
+ .trim()
45
+ .toLowerCase()
46
+ .replace(/\s+/g, '-')
47
+ .replace(/^[._]/, '')
48
+ .replace(/[^a-z\d\-~]+/g, '-')
49
+ }
50
+
51
+ function findLocalReactLib() {
52
+ // Try to locate the built library in the monorepo for convenience
53
+ const repoRoot = path.resolve(__dirname, '..')
54
+ const reactLibDir = path.resolve(repoRoot, 'react-docs-ui')
55
+ const distEs = path.resolve(reactLibDir, 'dist', 'react-docs-ui.es.js')
56
+ if (fs.existsSync(distEs)) {
57
+ return reactLibDir
58
+ }
59
+ return null
60
+ }
61
+
62
+ async function init() {
63
+ const argTargetDir = process.argv[2]
64
+ let targetDir = argTargetDir || 'my-react-docs-project'
65
+
66
+ const getProjectName = () =>
67
+ targetDir === '.' ? path.basename(path.resolve()) : targetDir
68
+
69
+ const projectName = getProjectName()
70
+ const packageName = toValidPackageName(projectName)
71
+
72
+ console.log(`\nšŸš€ Creating React Docs UI project in ${targetDir}...`)
73
+
74
+ const root = path.join(process.cwd(), targetDir)
75
+ if (fs.existsSync(root)) {
76
+ if (!isEmpty(root)) {
77
+ console.log(`\nāŒ Error: Target directory "${targetDir}" is not empty.`)
78
+ process.exit(1)
79
+ } else {
80
+ emptyDir(root)
81
+ }
82
+ }
83
+
84
+ console.log(`\nšŸ“ Scaffolding project in ${root}...`)
85
+
86
+ const templateDir = path.resolve(__dirname, 'template')
87
+ const write = (file, content) => {
88
+ const targetPath = path.join(root, file)
89
+ if (content !== undefined) {
90
+ fs.mkdirSync(path.dirname(targetPath), { recursive: true })
91
+ fs.writeFileSync(targetPath, content)
92
+ } else {
93
+ copy(path.join(templateDir, file), targetPath)
94
+ }
95
+ }
96
+
97
+ // Copy static template except package.json for injection
98
+ const files = fs.readdirSync(templateDir)
99
+ for (const file of files.filter((f) => f !== 'package.json')) {
100
+ write(file)
101
+ }
102
+
103
+ // Prepare package.json
104
+ const pkg = JSON.parse(
105
+ fs.readFileSync(path.join(templateDir, 'package.json'), 'utf-8')
106
+ )
107
+ pkg.name = packageName
108
+
109
+ // If local lib exists, link it via file: for quick testing
110
+ const localLib = findLocalReactLib()
111
+ if (localLib) {
112
+ pkg.dependencies['react-docs-ui'] = `file:${path.relative(root, localLib).replace(/\\/g, '/')}`
113
+ console.log(`\nšŸ”— Using local react-docs-ui from: ${localLib}`)
114
+ }
115
+
116
+ write('package.json', JSON.stringify(pkg, null, 2) + '\n')
117
+
118
+ console.log(`\nāœ… Done! Created ${projectName} at ${root}`)
119
+ console.log('\nšŸ“š Get started with:')
120
+ console.log(`\n cd ${targetDir}`)
121
+ console.log(' npm install')
122
+ console.log(' npm run dev')
123
+ console.log('\nšŸŽ‰ Your React Docs UI project is ready!')
124
+ }
125
+
126
+ init().catch((e) => {
127
+ console.error(e)
128
+ process.exit(1)
129
+ })
130
+
131
+
package/package.json ADDED
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "create-react-docs-ui",
3
+ "version": "0.1.0",
4
+ "private": false,
5
+ "type": "module",
6
+ "bin": {
7
+ "create-react-docs-ui": "./index.js"
8
+ },
9
+ "description": "Scaffold a React Docs UI project powered by @react-docs-ui/core",
10
+ "license": "MIT"
11
+ }
12
+
13
+
@@ -0,0 +1,14 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>React Docs UI</title>
7
+ </head>
8
+ <body>
9
+ <div id="root"></div>
10
+ <script type="module" src="/src/main.tsx"></script>
11
+ </body>
12
+ </html>
13
+
14
+
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "my-react-docs-project",
3
+ "version": "0.0.0",
4
+ "private": true,
5
+ "type": "module",
6
+ "scripts": {
7
+ "dev": "vite",
8
+ "build": "tsc -b && vite build",
9
+ "preview": "vite preview"
10
+ },
11
+ "dependencies": {
12
+ "react-docs-ui": "^0.1.0",
13
+ "buffer": "^6.0.3",
14
+ "react": ">=18",
15
+ "react-dom": ">=18",
16
+ "react-router-dom": "^7.8.0"
17
+ },
18
+ "devDependencies": {
19
+ "@types/react": "^19.1.9",
20
+ "@types/react-dom": "^19.1.7",
21
+ "@vitejs/plugin-react": "^4.7.0",
22
+ "typescript": "~5.8.3",
23
+ "vite": "^7.1.0"
24
+ }
25
+ }
@@ -0,0 +1,60 @@
1
+ {
2
+ "enabled": true,
3
+ "provider": "openai",
4
+ "systemPrompt": "ä½ ę˜Æäø€äøŖäø“äøšēš„ę–‡ę”£åŠ©ę‰‹ļ¼ŒčÆ·ę ¹ę®ē”Øęˆ·ēš„é—®é¢˜ļ¼Œęä¾›å‡†ē”®ēš„ē­”ę”ˆć€‚",
5
+ "models": {
6
+ "openai": {
7
+ "modelId": "gpt-3.5-turbo",
8
+ "apiKey": "",
9
+ "baseUrl": "https://api.openai.com/v1",
10
+ "maxTokens": 4000,
11
+ "temperature": 0.7
12
+ },
13
+ "claude": {
14
+ "modelId": "claude-3-sonnet-20240229",
15
+ "apiKey": "",
16
+ "baseUrl": "https://api.anthropic.com",
17
+ "maxTokens": 4000,
18
+ "temperature": 0.7
19
+ },
20
+ "gemini": {
21
+ "modelId": "gemini-pro",
22
+ "apiKey": "",
23
+ "baseUrl": "https://generativelanguage.googleapis.com/v1",
24
+ "maxTokens": 4000,
25
+ "temperature": 0.7
26
+ },
27
+ "deepseek-v3": {
28
+ "modelId": "deepseek-chat",
29
+ "apiKey": "",
30
+ "baseUrl": "https://api.deepseek.com",
31
+ "maxTokens": 4000,
32
+ "temperature": 0.7
33
+ },
34
+ "deepseek-reasoner": {
35
+ "modelId": "deepseek-reasoner",
36
+ "apiKey": "",
37
+ "baseUrl": "https://api.deepseek.com",
38
+ "maxTokens": 4000,
39
+ "temperature": 0.7
40
+ },
41
+ "custom": {
42
+ "modelId": "",
43
+ "apiKey": "",
44
+ "baseUrl": "",
45
+ "maxTokens": 4000,
46
+ "temperature": 0.7
47
+ }
48
+ },
49
+ "features": {
50
+ "chatAssistant": true,
51
+ "documentSummary": true,
52
+ "codeExplanation": true,
53
+ "searchEnhancement": false
54
+ },
55
+ "ui": {
56
+ "position": "bottom-right",
57
+ "theme": "auto",
58
+ "size": "medium"
59
+ }
60
+ }
@@ -0,0 +1,137 @@
1
+ # Website Configuration
2
+ site:
3
+ title: "Vue Docs UI Example"
4
+ description: "Example documentation website built with Vue Docs UI"
5
+ # Logo formats supported:
6
+ # 1. emoji: "šŸ¤–"
7
+ # 2. image URL: "https://example.com/logo.png"
8
+ # 3. local image: "/images/logo.png"
9
+ # 4. relative path: "./assets/logo.svg"
10
+ logo:
11
+ light: "/images/favicon.svg"
12
+ dark: "/images/favicon-dark.svg"
13
+ author: "Vue Docs UI Team"
14
+
15
+ # Navigation Bar Configuration
16
+ navbar:
17
+ showLogo: true
18
+ showTitle: true
19
+ showLanguageSwitcher: true
20
+ items:
21
+ - title: "Home"
22
+ link: "/"
23
+ active: true
24
+ - title: "Guide"
25
+ link: "/guide"
26
+ actions:
27
+ - type: "github"
28
+ link: "https://github.com/shenjianZ/vue-docs-ui"
29
+ enabled: true
30
+
31
+ # Sidebar Navigation Configuration
32
+ sidebar:
33
+ enabled: true
34
+ collections:
35
+ guide:
36
+ sections:
37
+ - title: "Getting Started"
38
+ path: "/guide"
39
+ children:
40
+ - title: "Introduction"
41
+ path: "/guide/introduction"
42
+ - title: "Installation"
43
+ path: "/guide/installation"
44
+ - title: "Quick Start"
45
+ path: "/guide/quick-start"
46
+ - title: "Configuration"
47
+ path: "/guide/configuration"
48
+
49
+
50
+ # Theme Configuration
51
+ theme:
52
+ # Default theme mode: 'light' | 'dark' | 'auto'
53
+ # light: Force light mode
54
+ # dark: Force dark mode
55
+ # auto: Follow system preference (default)
56
+ defaultMode: "auto"
57
+
58
+ # Allow users to toggle theme (show theme toggle button)
59
+ allowToggle: true
60
+
61
+
62
+ # Table of Contents Configuration
63
+ toc:
64
+ # Maximum heading level to display in TOC (1-6)
65
+ maxLevel: 3
66
+
67
+ # Enable table of contents
68
+ enabled: true
69
+
70
+ # TOC title
71
+ title: "On This Page"
72
+
73
+ # Footer Configuration
74
+ footer:
75
+ enabled: true
76
+ copyright: "Ā© 2024 Vue Docs UI. All rights reserved."
77
+ repository:
78
+ url: "https://github.com/your_github_id/your_repo_name"
79
+ branch: "master"
80
+ lastUpdated: "2024-12-19"
81
+ links:
82
+ - title: "Documentation"
83
+ link: "/guide/introduction"
84
+ - title: "GitHub"
85
+ link: "https://github.com/your_github_id/your_repo_name"
86
+ external: true
87
+ - title: "License"
88
+ link: "/license"
89
+ social:
90
+ - name: "email"
91
+ url: "mailto:contact@example.com"
92
+ icon: "mail"
93
+ - name: "github"
94
+ url: "https://github.com/your_github_id"
95
+ icon: "github"
96
+ # - name: "youtube"
97
+ # url: "https://youtube.com/@yourhandle"
98
+ # icon: "youtube"
99
+ # - name: "twitter"
100
+ # url: "https://twitter.com/yourhandle"
101
+ # icon: "twitter"
102
+ # - name: "discord"
103
+ # url: "https://discord.gg/yourinvite"
104
+ # icon: "discord"
105
+ # - name: "telegram"
106
+ # url: "https://t.me/yourhandle"
107
+ # icon: "telegram"
108
+ # - name: "tiktok"
109
+ # url: "https://tiktok.com/@yourhandle"
110
+ # icon: "tiktok"
111
+ - name: "bilibili"
112
+ url: "https://space.bilibili.com/your_bilibili_id"
113
+ icon: "bilibili"
114
+ - name: "qq"
115
+ url: "mqqapi://card/show_pslcard?src_type=internal&version=1&uin=your_qq_id&card_type=person&source=qrcode"
116
+ icon: "qq"
117
+ - name: "wechat"
118
+ url: "weixin://dl/add?your_wechat_id"
119
+ icon: "wechat"
120
+ # - name: "weibo"
121
+ # url: "https://weibo.com/yourhandle"
122
+ # icon: "weibo"
123
+ # - name: "douyin"
124
+ # url: "https://www.douyin.com/user/yourhandle"
125
+ # icon: "douyin"
126
+ # - name: "zhihu"
127
+ # url: "https://www.zhihu.com/people/yourhandle"
128
+ # icon: "zhihu"
129
+
130
+ # PWA Configuration
131
+ pwa:
132
+ enabled: false
133
+ name: "Vue Docs UI"
134
+ shortName: "VueDocsUI"
135
+ description: "Beautiful documentation websites made simple"
136
+ themeColor: "#ffffff"
137
+ backgroundColor: "#ffffff"
@@ -0,0 +1,137 @@
1
+ # ē½‘ē«™åŸŗęœ¬é…ē½®
2
+ site:
3
+ title: "Vue Docs UI 示例锹目"
4
+ description: "åŸŗäŗŽ Vue Docs UI ęž„å»ŗēš„ę–‡ę”£ē½‘ē«™ē¤ŗä¾‹"
5
+ # logoę”ÆęŒä»„äø‹ę ¼å¼ļ¼š
6
+ # 1. emoji: "šŸ¤–"
7
+ # 2. 图片URL: "https://example.com/logo.png"
8
+ # 3. ęœ¬åœ°å›¾ē‰‡: "/images/logo.png"
9
+ # 4. 相对路径: "./assets/logo.svg"
10
+ logo:
11
+ light: "/images/favicon.svg"
12
+ dark: "/images/favicon-dark.svg"
13
+ author: "Vue Docs UI Team"
14
+
15
+ # é”¶éƒØåÆ¼čˆŖé…ē½®
16
+ navbar:
17
+ showLogo: true
18
+ showTitle: true
19
+ showLanguageSwitcher: true
20
+ items:
21
+ - title: "首锵"
22
+ link: "/"
23
+ active: true
24
+ - title: "ęŒ‡å—"
25
+ link: "/guide"
26
+ actions:
27
+ - type: "github"
28
+ link: "https://github.com/shenjianZ/vue-docs-ui"
29
+ enabled: true
30
+
31
+ # ä¾§č¾¹ę åÆ¼čˆŖé…ē½®
32
+ sidebar:
33
+ enabled: true
34
+ collections:
35
+ guide:
36
+ sections:
37
+ - title: "åæ«é€Ÿå¼€å§‹"
38
+ path: "/guide"
39
+ children:
40
+ - title: "ä»‹ē»"
41
+ path: "/guide/introduction"
42
+ - title: "安装"
43
+ path: "/guide/installation"
44
+ - title: "åæ«é€ŸäøŠę‰‹"
45
+ path: "/guide/quick-start"
46
+ - title: "é…ē½®čÆ“ę˜Ž"
47
+ path: "/guide/configuration"
48
+
49
+
50
+ # Theme Configuration
51
+ theme:
52
+ # Default theme mode: 'light' | 'dark' | 'auto'
53
+ # light: Force light mode
54
+ # dark: Force dark mode
55
+ # auto: Follow system preference (default)
56
+ defaultMode: "auto"
57
+
58
+ # Allow users to toggle theme (show theme toggle button)
59
+ allowToggle: true
60
+
61
+
62
+ # Table of Contents Configuration
63
+ toc:
64
+ # Maximum heading level to display in TOC (1-6)
65
+ maxLevel: 3
66
+
67
+ # Enable table of contents
68
+ enabled: true
69
+
70
+ # TOC title
71
+ title: "ęœ¬é”µē›®å½•"
72
+
73
+ # Footer Configuration
74
+ footer:
75
+ enabled: true
76
+ copyright: "Ā© 2024 Vue Docs UI. All rights reserved."
77
+ repository:
78
+ url: "https://github.com/your_github_id/your_repo_name"
79
+ branch: "master"
80
+ lastUpdated: "2024-12-19"
81
+ links:
82
+ - title: "Documentation"
83
+ link: "/guide/introduction"
84
+ - title: "GitHub"
85
+ link: "https://github.com/your_github_id/your_repo_name"
86
+ external: true
87
+ - title: "License"
88
+ link: "/license"
89
+ social:
90
+ - name: "email"
91
+ url: "mailto:contact@example.com"
92
+ icon: "mail"
93
+ - name: "github"
94
+ url: "https://github.com/your_github_id"
95
+ icon: "github"
96
+ # - name: "youtube"
97
+ # url: "https://youtube.com/@yourhandle"
98
+ # icon: "youtube"
99
+ # - name: "twitter"
100
+ # url: "https://twitter.com/yourhandle"
101
+ # icon: "twitter"
102
+ # - name: "discord"
103
+ # url: "https://discord.gg/yourinvite"
104
+ # icon: "discord"
105
+ # - name: "telegram"
106
+ # url: "https://t.me/yourhandle"
107
+ # icon: "telegram"
108
+ # - name: "tiktok"
109
+ # url: "https://tiktok.com/@yourhandle"
110
+ # icon: "tiktok"
111
+ - name: "bilibili"
112
+ url: "https://space.bilibili.com/your_bilibili_id"
113
+ icon: "bilibili"
114
+ - name: "qq"
115
+ url: "mqqapi://card/show_pslcard?src_type=internal&version=1&uin=your_qq_id&card_type=person&source=qrcode"
116
+ icon: "qq"
117
+ - name: "wechat"
118
+ url: "weixin://dl/add?your_wechat_id"
119
+ icon: "wechat"
120
+ # - name: "weibo"
121
+ # url: "https://weibo.com/yourhandle"
122
+ # icon: "weibo"
123
+ # - name: "douyin"
124
+ # url: "https://www.douyin.com/user/yourhandle"
125
+ # icon: "douyin"
126
+ # - name: "zhihu"
127
+ # url: "https://www.zhihu.com/people/yourhandle"
128
+ # icon: "zhihu"
129
+
130
+ # PWA Configuration
131
+ pwa:
132
+ enabled: true
133
+ name: "Vue Docs UI"
134
+ shortName: "VueDocsUI"
135
+ description: "Beautiful documentation websites made simple"
136
+ themeColor: "#ffffff"
137
+ backgroundColor: "#ffffff"
@@ -0,0 +1,69 @@
1
+ # Configuration
2
+
3
+ ## Configuration Overview
4
+
5
+ Vue Docs UI provides flexible configuration options that allow you to customize the appearance and behavior of your documentation website.
6
+
7
+ ## Basic Configuration
8
+
9
+ ### site.yaml File
10
+
11
+ The configuration file is located at `public/config/site.yaml` and contains the following main sections:
12
+
13
+ ```yaml
14
+ # Website Configuration
15
+ site:
16
+ title: "Vue Docs UI"
17
+ description: "Beautiful documentation websites made simple"
18
+ logo: "šŸ“š"
19
+ author: "Vue Docs UI Team"
20
+ ```
21
+
22
+ ### Navigation Bar Configuration
23
+
24
+ ```yaml
25
+ navbar:
26
+ items:
27
+ - title: "Home"
28
+ link: "/"
29
+ active: true
30
+ - title: "Documentation"
31
+ link: "/guide"
32
+ ```
33
+
34
+ ### Sidebar Configuration
35
+
36
+ ```yaml
37
+ sidebar:
38
+ sections:
39
+ - title: "Getting Started"
40
+ path: "/guide"
41
+ children:
42
+ - title: "Introduction"
43
+ path: "/guide/introduction"
44
+ ```
45
+
46
+ ## Theme Configuration
47
+
48
+ ### Color Customization
49
+
50
+ ```yaml
51
+ theme:
52
+ colors:
53
+ primary: "#3b82f6"
54
+ secondary: "#64748b"
55
+ accent: "#06b6d4"
56
+ ```
57
+
58
+ ### Font Configuration
59
+
60
+ ```yaml
61
+ theme:
62
+ fonts:
63
+ primary: "Inter, -apple-system, BlinkMacSystemFont, sans-serif"
64
+ mono: "JetBrains Mono, Consolas, monospace"
65
+ ```
66
+
67
+ ## Advanced Configuration
68
+
69
+ For more advanced configuration options, please refer to the related documentation.