create-ardo 1.0.0 → 1.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/LICENSE +21 -0
- package/dist/index.js +61 -171
- package/package.json +9 -8
- package/templates/minimal/.github/workflows/deploy.yml +56 -0
- package/templates/minimal/_gitignore +9 -0
- package/templates/minimal/content/guide/getting-started.md +38 -0
- package/templates/minimal/content/index.md +18 -0
- package/templates/minimal/package.json +24 -0
- package/templates/minimal/src/router.tsx +18 -0
- package/templates/minimal/src/routes/(docs)/_layout.tsx +19 -0
- package/templates/minimal/src/routes/__root.tsx +29 -0
- package/templates/minimal/src/routes/index.tsx +39 -0
- package/templates/minimal/src/vite-env.d.ts +23 -0
- package/templates/minimal/tsconfig.json +18 -0
- package/templates/minimal/vite.config.ts +35 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Sebastian Software GmbH
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import fs2 from "fs";
|
|
5
|
+
import path2 from "path";
|
|
6
6
|
import prompts from "prompts";
|
|
7
7
|
import { blue, cyan, green, red, reset, yellow } from "kolorist";
|
|
8
|
+
|
|
9
|
+
// src/scaffold.ts
|
|
10
|
+
import fs from "fs";
|
|
11
|
+
import path from "path";
|
|
12
|
+
import { fileURLToPath } from "url";
|
|
13
|
+
var __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
14
|
+
var templatesRoot = path.resolve(__dirname, "..", "templates");
|
|
8
15
|
var templates = [
|
|
9
16
|
{
|
|
10
17
|
name: "minimal",
|
|
@@ -12,6 +19,54 @@ var templates = [
|
|
|
12
19
|
description: "Basic setup with essential files only"
|
|
13
20
|
}
|
|
14
21
|
];
|
|
22
|
+
function createProjectStructure(root, template, siteTitle, projectName) {
|
|
23
|
+
const templateDir = path.join(templatesRoot, template);
|
|
24
|
+
const vars = {
|
|
25
|
+
SITE_TITLE: siteTitle,
|
|
26
|
+
PROJECT_NAME: projectName
|
|
27
|
+
};
|
|
28
|
+
copyDir(templateDir, root, vars);
|
|
29
|
+
}
|
|
30
|
+
function copyDir(src, dest, vars) {
|
|
31
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
32
|
+
for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
|
|
33
|
+
const srcPath = path.join(src, entry.name);
|
|
34
|
+
const destName = entry.name === "_gitignore" ? ".gitignore" : entry.name;
|
|
35
|
+
const destPath = path.join(dest, destName);
|
|
36
|
+
if (entry.isDirectory()) {
|
|
37
|
+
copyDir(srcPath, destPath, vars);
|
|
38
|
+
} else {
|
|
39
|
+
let content = fs.readFileSync(srcPath, "utf-8");
|
|
40
|
+
for (const [key, value] of Object.entries(vars)) {
|
|
41
|
+
content = content.replaceAll(`{{${key}}}`, value);
|
|
42
|
+
}
|
|
43
|
+
fs.writeFileSync(destPath, content);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function formatTargetDir(targetDir) {
|
|
48
|
+
return targetDir?.trim().replace(/\/+$/g, "");
|
|
49
|
+
}
|
|
50
|
+
function isEmpty(dirPath) {
|
|
51
|
+
const files = fs.readdirSync(dirPath);
|
|
52
|
+
return files.length === 0 || files.length === 1 && files[0] === ".git";
|
|
53
|
+
}
|
|
54
|
+
function emptyDir(dir) {
|
|
55
|
+
if (!fs.existsSync(dir)) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
for (const file of fs.readdirSync(dir)) {
|
|
59
|
+
if (file === ".git") {
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
fs.rmSync(path.join(dir, file), { recursive: true, force: true });
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
function isValidTemplate(template) {
|
|
66
|
+
return templates.some((t) => t.name === template);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// src/index.ts
|
|
15
70
|
var defaultTargetDir = "my-docs";
|
|
16
71
|
async function main() {
|
|
17
72
|
console.log();
|
|
@@ -33,7 +88,7 @@ async function main() {
|
|
|
33
88
|
}
|
|
34
89
|
},
|
|
35
90
|
{
|
|
36
|
-
type: () => !
|
|
91
|
+
type: () => !fs2.existsSync(targetDir) || isEmpty(targetDir) ? null : "select",
|
|
37
92
|
name: "overwrite",
|
|
38
93
|
message: () => `${targetDir === "." ? "Current directory" : `Target directory "${targetDir}"`} is not empty. How would you like to proceed?`,
|
|
39
94
|
choices: [
|
|
@@ -75,11 +130,11 @@ async function main() {
|
|
|
75
130
|
);
|
|
76
131
|
const { overwrite, template: templateChoice, siteTitle } = response;
|
|
77
132
|
template = templateChoice || template || "minimal";
|
|
78
|
-
const root =
|
|
133
|
+
const root = path2.join(process.cwd(), targetDir);
|
|
79
134
|
if (overwrite === "yes") {
|
|
80
135
|
emptyDir(root);
|
|
81
|
-
} else if (!
|
|
82
|
-
|
|
136
|
+
} else if (!fs2.existsSync(root)) {
|
|
137
|
+
fs2.mkdirSync(root, { recursive: true });
|
|
83
138
|
}
|
|
84
139
|
console.log();
|
|
85
140
|
console.log(` ${cyan("Scaffolding project in")} ${root}...`);
|
|
@@ -94,171 +149,6 @@ async function main() {
|
|
|
94
149
|
console.log(` ${blue("pnpm dev")}`);
|
|
95
150
|
console.log();
|
|
96
151
|
}
|
|
97
|
-
function createProjectStructure(root, _template, siteTitle, projectName) {
|
|
98
|
-
const pkg = {
|
|
99
|
-
name: projectName,
|
|
100
|
-
version: "0.0.0",
|
|
101
|
-
private: true,
|
|
102
|
-
type: "module",
|
|
103
|
-
scripts: {
|
|
104
|
-
dev: "vite",
|
|
105
|
-
build: "vite build",
|
|
106
|
-
preview: "vite preview"
|
|
107
|
-
},
|
|
108
|
-
dependencies: {
|
|
109
|
-
ardo: "^1.0.0",
|
|
110
|
-
react: "^19.0.0",
|
|
111
|
-
"react-dom": "^19.0.0"
|
|
112
|
-
},
|
|
113
|
-
devDependencies: {
|
|
114
|
-
"@types/react": "^19.0.0",
|
|
115
|
-
"@types/react-dom": "^19.0.0",
|
|
116
|
-
typescript: "^5.7.0",
|
|
117
|
-
vite: "^6.0.0"
|
|
118
|
-
}
|
|
119
|
-
};
|
|
120
|
-
fs.writeFileSync(path.join(root, "package.json"), JSON.stringify(pkg, null, 2) + "\n");
|
|
121
|
-
const tsconfig = {
|
|
122
|
-
compilerOptions: {
|
|
123
|
-
target: "ES2022",
|
|
124
|
-
lib: ["ES2022", "DOM", "DOM.Iterable"],
|
|
125
|
-
module: "ESNext",
|
|
126
|
-
moduleResolution: "bundler",
|
|
127
|
-
resolveJsonModule: true,
|
|
128
|
-
allowImportingTsExtensions: true,
|
|
129
|
-
strict: true,
|
|
130
|
-
noEmit: true,
|
|
131
|
-
esModuleInterop: true,
|
|
132
|
-
skipLibCheck: true,
|
|
133
|
-
forceConsistentCasingInFileNames: true,
|
|
134
|
-
jsx: "react-jsx"
|
|
135
|
-
},
|
|
136
|
-
include: ["src/**/*", "*.ts", "*.config.ts"],
|
|
137
|
-
exclude: ["node_modules", "dist"]
|
|
138
|
-
};
|
|
139
|
-
fs.writeFileSync(path.join(root, "tsconfig.json"), JSON.stringify(tsconfig, null, 2) + "\n");
|
|
140
|
-
const viteConfig = `import { defineConfig } from 'vite'
|
|
141
|
-
import { ardo } from 'ardo/vite'
|
|
142
|
-
|
|
143
|
-
export default defineConfig({
|
|
144
|
-
plugins: [
|
|
145
|
-
ardo({
|
|
146
|
-
title: '${siteTitle}',
|
|
147
|
-
description: 'Built with Ardo',
|
|
148
|
-
|
|
149
|
-
themeConfig: {
|
|
150
|
-
siteTitle: '${siteTitle}',
|
|
151
|
-
|
|
152
|
-
nav: [
|
|
153
|
-
{ text: 'Guide', link: '/guide/getting-started' },
|
|
154
|
-
],
|
|
155
|
-
|
|
156
|
-
sidebar: [
|
|
157
|
-
{
|
|
158
|
-
text: 'Guide',
|
|
159
|
-
items: [
|
|
160
|
-
{ text: 'Getting Started', link: '/guide/getting-started' },
|
|
161
|
-
],
|
|
162
|
-
},
|
|
163
|
-
],
|
|
164
|
-
|
|
165
|
-
footer: {
|
|
166
|
-
message: 'Built with Ardo',
|
|
167
|
-
},
|
|
168
|
-
|
|
169
|
-
search: {
|
|
170
|
-
enabled: true,
|
|
171
|
-
},
|
|
172
|
-
},
|
|
173
|
-
}),
|
|
174
|
-
],
|
|
175
|
-
})
|
|
176
|
-
`;
|
|
177
|
-
fs.writeFileSync(path.join(root, "vite.config.ts"), viteConfig);
|
|
178
|
-
const gitignore = `node_modules
|
|
179
|
-
dist
|
|
180
|
-
.DS_Store
|
|
181
|
-
*.local
|
|
182
|
-
`;
|
|
183
|
-
fs.writeFileSync(path.join(root, ".gitignore"), gitignore);
|
|
184
|
-
const contentDir = path.join(root, "content");
|
|
185
|
-
const guideDir = path.join(contentDir, "guide");
|
|
186
|
-
fs.mkdirSync(guideDir, { recursive: true });
|
|
187
|
-
const indexMd = `---
|
|
188
|
-
title: Welcome
|
|
189
|
-
---
|
|
190
|
-
|
|
191
|
-
# Welcome to ${siteTitle}
|
|
192
|
-
|
|
193
|
-
This documentation site is built with [Ardo](https://github.com/sebastian-software/ardo).
|
|
194
|
-
|
|
195
|
-
## Getting Started
|
|
196
|
-
|
|
197
|
-
Check out the [Getting Started](/guide/getting-started) guide to learn more.
|
|
198
|
-
`;
|
|
199
|
-
fs.writeFileSync(path.join(contentDir, "index.md"), indexMd);
|
|
200
|
-
const gettingStartedMd = `---
|
|
201
|
-
title: Getting Started
|
|
202
|
-
---
|
|
203
|
-
|
|
204
|
-
# Getting Started
|
|
205
|
-
|
|
206
|
-
Welcome to your new documentation site!
|
|
207
|
-
|
|
208
|
-
## Development
|
|
209
|
-
|
|
210
|
-
\`\`\`bash
|
|
211
|
-
# Start development server
|
|
212
|
-
pnpm dev
|
|
213
|
-
|
|
214
|
-
# Build for production
|
|
215
|
-
pnpm build
|
|
216
|
-
|
|
217
|
-
# Preview production build
|
|
218
|
-
pnpm preview
|
|
219
|
-
\`\`\`
|
|
220
|
-
|
|
221
|
-
## Adding Content
|
|
222
|
-
|
|
223
|
-
Create \`.md\` or \`.mdx\` files in the \`content/\` directory. They will automatically become pages.
|
|
224
|
-
|
|
225
|
-
## Configuration
|
|
226
|
-
|
|
227
|
-
Edit \`vite.config.ts\` to customize your site:
|
|
228
|
-
|
|
229
|
-
- Navigation links
|
|
230
|
-
- Sidebar structure
|
|
231
|
-
- Site title and description
|
|
232
|
-
- Theme options
|
|
233
|
-
|
|
234
|
-
## Learn More
|
|
235
|
-
|
|
236
|
-
- [Ardo Documentation](https://sebastian-software.github.io/ardo/)
|
|
237
|
-
- [GitHub Repository](https://github.com/sebastian-software/ardo)
|
|
238
|
-
`;
|
|
239
|
-
fs.writeFileSync(path.join(guideDir, "getting-started.md"), gettingStartedMd);
|
|
240
|
-
}
|
|
241
|
-
function formatTargetDir(targetDir) {
|
|
242
|
-
return targetDir?.trim().replace(/\/+$/g, "");
|
|
243
|
-
}
|
|
244
|
-
function isEmpty(dirPath) {
|
|
245
|
-
const files = fs.readdirSync(dirPath);
|
|
246
|
-
return files.length === 0 || files.length === 1 && files[0] === ".git";
|
|
247
|
-
}
|
|
248
|
-
function emptyDir(dir) {
|
|
249
|
-
if (!fs.existsSync(dir)) {
|
|
250
|
-
return;
|
|
251
|
-
}
|
|
252
|
-
for (const file of fs.readdirSync(dir)) {
|
|
253
|
-
if (file === ".git") {
|
|
254
|
-
continue;
|
|
255
|
-
}
|
|
256
|
-
fs.rmSync(path.join(dir, file), { recursive: true, force: true });
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
function isValidTemplate(template) {
|
|
260
|
-
return templates.some((t) => t.name === template);
|
|
261
|
-
}
|
|
262
152
|
main().catch((e) => {
|
|
263
153
|
console.error(e.message);
|
|
264
154
|
process.exit(1);
|
package/package.json
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-ardo",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Scaffolding tool for Ardo documentation projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"create-ardo": "./dist/index.js"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
|
-
"dist"
|
|
10
|
+
"dist",
|
|
11
|
+
"templates"
|
|
11
12
|
],
|
|
12
|
-
"scripts": {
|
|
13
|
-
"build": "tsup",
|
|
14
|
-
"dev": "tsup --watch",
|
|
15
|
-
"typecheck": "tsc --noEmit"
|
|
16
|
-
},
|
|
17
13
|
"keywords": [
|
|
18
14
|
"ardo",
|
|
19
15
|
"create",
|
|
@@ -44,5 +40,10 @@
|
|
|
44
40
|
},
|
|
45
41
|
"engines": {
|
|
46
42
|
"node": ">=18.0.0"
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "tsup",
|
|
46
|
+
"dev": "tsup --watch",
|
|
47
|
+
"typecheck": "tsc --noEmit"
|
|
47
48
|
}
|
|
48
|
-
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
name: Deploy to GitHub Pages
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
permissions:
|
|
9
|
+
contents: read
|
|
10
|
+
pages: write
|
|
11
|
+
id-token: write
|
|
12
|
+
|
|
13
|
+
concurrency:
|
|
14
|
+
group: 'pages'
|
|
15
|
+
cancel-in-progress: false
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
build:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- name: Checkout
|
|
22
|
+
uses: actions/checkout@v4
|
|
23
|
+
|
|
24
|
+
- name: Setup pnpm
|
|
25
|
+
uses: pnpm/action-setup@v4
|
|
26
|
+
|
|
27
|
+
- name: Setup Node.js
|
|
28
|
+
uses: actions/setup-node@v4
|
|
29
|
+
with:
|
|
30
|
+
node-version: '22'
|
|
31
|
+
cache: 'pnpm'
|
|
32
|
+
|
|
33
|
+
- name: Setup Pages
|
|
34
|
+
uses: actions/configure-pages@v5
|
|
35
|
+
|
|
36
|
+
- name: Install dependencies
|
|
37
|
+
run: pnpm install --frozen-lockfile
|
|
38
|
+
|
|
39
|
+
- name: Build
|
|
40
|
+
run: pnpm build
|
|
41
|
+
|
|
42
|
+
- name: Upload artifact
|
|
43
|
+
uses: actions/upload-pages-artifact@v4
|
|
44
|
+
with:
|
|
45
|
+
path: dist/client
|
|
46
|
+
|
|
47
|
+
deploy:
|
|
48
|
+
environment:
|
|
49
|
+
name: github-pages
|
|
50
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
51
|
+
runs-on: ubuntu-latest
|
|
52
|
+
needs: build
|
|
53
|
+
steps:
|
|
54
|
+
- name: Deploy to GitHub Pages
|
|
55
|
+
id: deployment
|
|
56
|
+
uses: actions/deploy-pages@v4
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Getting Started
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Getting Started
|
|
6
|
+
|
|
7
|
+
Welcome to your new documentation site!
|
|
8
|
+
|
|
9
|
+
## Development
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# Start development server
|
|
13
|
+
pnpm dev
|
|
14
|
+
|
|
15
|
+
# Build for production
|
|
16
|
+
pnpm build
|
|
17
|
+
|
|
18
|
+
# Preview production build
|
|
19
|
+
pnpm preview
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Adding Content
|
|
23
|
+
|
|
24
|
+
Create `.md` or `.mdx` files in the `content/` directory. They will automatically become pages.
|
|
25
|
+
|
|
26
|
+
## Configuration
|
|
27
|
+
|
|
28
|
+
Edit `vite.config.ts` to customize your site:
|
|
29
|
+
|
|
30
|
+
- Navigation links
|
|
31
|
+
- Sidebar structure
|
|
32
|
+
- Site title and description
|
|
33
|
+
- Theme options
|
|
34
|
+
|
|
35
|
+
## Learn More
|
|
36
|
+
|
|
37
|
+
- [Ardo Documentation](https://sebastian-software.github.io/ardo/)
|
|
38
|
+
- [GitHub Repository](https://github.com/sebastian-software/ardo)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Welcome
|
|
3
|
+
hero:
|
|
4
|
+
name: '{{SITE_TITLE}}'
|
|
5
|
+
text: Documentation Made Simple
|
|
6
|
+
tagline: Focus on your content, not configuration
|
|
7
|
+
actions:
|
|
8
|
+
- text: Get Started
|
|
9
|
+
link: /guide/getting-started
|
|
10
|
+
theme: brand
|
|
11
|
+
features:
|
|
12
|
+
- title: Zero Config
|
|
13
|
+
details: Just write markdown. No framework knowledge required.
|
|
14
|
+
- title: Fast
|
|
15
|
+
details: Powered by Vite and React 19.
|
|
16
|
+
- title: Beautiful
|
|
17
|
+
details: Clean design out of the box.
|
|
18
|
+
---
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{PROJECT_NAME}}",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite",
|
|
8
|
+
"build": "vite build",
|
|
9
|
+
"preview": "vite preview"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@tanstack/react-router": "*",
|
|
13
|
+
"@tanstack/react-start": "*",
|
|
14
|
+
"ardo": "^1.0.0",
|
|
15
|
+
"react": "*",
|
|
16
|
+
"react-dom": "*"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@types/react": "^19.0.0",
|
|
20
|
+
"@types/react-dom": "^19.0.0",
|
|
21
|
+
"typescript": "^5.7.0",
|
|
22
|
+
"vite": "^8.0.0-beta.0"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { createRouter } from '@tanstack/react-router'
|
|
2
|
+
import { routeTree } from './routeTree.gen'
|
|
3
|
+
|
|
4
|
+
export function getRouter() {
|
|
5
|
+
return createRouter({
|
|
6
|
+
routeTree,
|
|
7
|
+
scrollRestoration: true,
|
|
8
|
+
defaultPreloadStaleTime: 0,
|
|
9
|
+
})
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export type AppRouter = ReturnType<typeof getRouter>
|
|
13
|
+
|
|
14
|
+
declare module '@tanstack/react-router' {
|
|
15
|
+
interface Register {
|
|
16
|
+
router: AppRouter
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createFileRoute, Outlet } from '@tanstack/react-router'
|
|
2
|
+
import { DocLayout } from 'ardo/theme'
|
|
3
|
+
import { PressProvider } from 'ardo/runtime'
|
|
4
|
+
import config from 'virtual:ardo/config'
|
|
5
|
+
import sidebar from 'virtual:ardo/sidebar'
|
|
6
|
+
|
|
7
|
+
export const Route = createFileRoute('/(docs)/_layout')({
|
|
8
|
+
component: DocsLayoutComponent,
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
function DocsLayoutComponent() {
|
|
12
|
+
return (
|
|
13
|
+
<PressProvider config={config} sidebar={sidebar}>
|
|
14
|
+
<DocLayout>
|
|
15
|
+
<Outlet />
|
|
16
|
+
</DocLayout>
|
|
17
|
+
</PressProvider>
|
|
18
|
+
)
|
|
19
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createRootRoute, HeadContent, Scripts } from '@tanstack/react-router'
|
|
2
|
+
import config from 'virtual:ardo/config'
|
|
3
|
+
import 'ardo/theme/styles.css'
|
|
4
|
+
|
|
5
|
+
export const Route = createRootRoute({
|
|
6
|
+
head: () => ({
|
|
7
|
+
meta: [
|
|
8
|
+
{ charSet: 'utf-8' },
|
|
9
|
+
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
|
|
10
|
+
{ title: config.title },
|
|
11
|
+
{ name: 'description', content: config.description },
|
|
12
|
+
],
|
|
13
|
+
}),
|
|
14
|
+
shellComponent: RootDocument,
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
function RootDocument({ children }: { children: React.ReactNode }) {
|
|
18
|
+
return (
|
|
19
|
+
<html lang="en" suppressHydrationWarning>
|
|
20
|
+
<head>
|
|
21
|
+
<HeadContent />
|
|
22
|
+
</head>
|
|
23
|
+
<body suppressHydrationWarning>
|
|
24
|
+
{children}
|
|
25
|
+
<Scripts />
|
|
26
|
+
</body>
|
|
27
|
+
</html>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { createFileRoute } from '@tanstack/react-router'
|
|
2
|
+
import { HomePage } from 'ardo/theme'
|
|
3
|
+
import { PressProvider } from 'ardo/runtime'
|
|
4
|
+
import config from 'virtual:ardo/config'
|
|
5
|
+
import sidebar from 'virtual:ardo/sidebar'
|
|
6
|
+
import { frontmatter, toc } from '../../content/index.md'
|
|
7
|
+
|
|
8
|
+
export const Route = createFileRoute('/')({
|
|
9
|
+
head: () => ({
|
|
10
|
+
meta: [
|
|
11
|
+
{
|
|
12
|
+
title: (frontmatter.title as string)
|
|
13
|
+
? `${frontmatter.title} | ${config.title}`
|
|
14
|
+
: config.title,
|
|
15
|
+
},
|
|
16
|
+
...(frontmatter.description
|
|
17
|
+
? [{ name: 'description', content: frontmatter.description as string }]
|
|
18
|
+
: []),
|
|
19
|
+
],
|
|
20
|
+
}),
|
|
21
|
+
component: HomeComponent,
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
function HomeComponent() {
|
|
25
|
+
const pageData = {
|
|
26
|
+
title: (frontmatter.title as string) || 'Home',
|
|
27
|
+
description: frontmatter.description as string | undefined,
|
|
28
|
+
frontmatter,
|
|
29
|
+
toc,
|
|
30
|
+
filePath: 'index.md',
|
|
31
|
+
relativePath: 'index.md',
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<PressProvider config={config} sidebar={sidebar} currentPage={pageData}>
|
|
36
|
+
<HomePage />
|
|
37
|
+
</PressProvider>
|
|
38
|
+
)
|
|
39
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
|
+
|
|
3
|
+
declare module 'virtual:ardo/config' {
|
|
4
|
+
import type { PressConfig } from 'ardo'
|
|
5
|
+
const config: PressConfig
|
|
6
|
+
export default config
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare module 'virtual:ardo/sidebar' {
|
|
10
|
+
import type { SidebarItem } from 'ardo'
|
|
11
|
+
const sidebar: SidebarItem[]
|
|
12
|
+
export default sidebar
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
declare module '*.md' {
|
|
16
|
+
import type { ComponentType } from 'react'
|
|
17
|
+
import type { PageFrontmatter, TOCItem } from 'ardo'
|
|
18
|
+
|
|
19
|
+
export const frontmatter: PageFrontmatter
|
|
20
|
+
export const toc: TOCItem[]
|
|
21
|
+
const component: ComponentType
|
|
22
|
+
export default component
|
|
23
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"moduleResolution": "bundler",
|
|
7
|
+
"resolveJsonModule": true,
|
|
8
|
+
"allowImportingTsExtensions": true,
|
|
9
|
+
"strict": true,
|
|
10
|
+
"noEmit": true,
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"skipLibCheck": true,
|
|
13
|
+
"forceConsistentCasingInFileNames": true,
|
|
14
|
+
"jsx": "react-jsx"
|
|
15
|
+
},
|
|
16
|
+
"include": ["src/**/*", "*.ts", "*.config.ts"],
|
|
17
|
+
"exclude": ["node_modules", "dist"]
|
|
18
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { defineConfig } from 'vite'
|
|
2
|
+
import { ardo } from 'ardo/vite'
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
// For GitHub Pages subdirectory deployments, uncomment and adjust:
|
|
6
|
+
// base: '/{{PROJECT_NAME}}/',
|
|
7
|
+
|
|
8
|
+
plugins: [
|
|
9
|
+
ardo({
|
|
10
|
+
title: '{{SITE_TITLE}}',
|
|
11
|
+
description: 'Built with Ardo',
|
|
12
|
+
|
|
13
|
+
themeConfig: {
|
|
14
|
+
siteTitle: '{{SITE_TITLE}}',
|
|
15
|
+
|
|
16
|
+
nav: [{ text: 'Guide', link: '/guide/getting-started' }],
|
|
17
|
+
|
|
18
|
+
sidebar: [
|
|
19
|
+
{
|
|
20
|
+
text: 'Guide',
|
|
21
|
+
items: [{ text: 'Getting Started', link: '/guide/getting-started' }],
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
|
|
25
|
+
footer: {
|
|
26
|
+
message: 'Built with Ardo',
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
search: {
|
|
30
|
+
enabled: true,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
}),
|
|
34
|
+
],
|
|
35
|
+
})
|