create-fumadocs-app 16.0.1 → 16.0.3
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/dist/chunk-3VWJJEHU.js +204 -0
- package/dist/chunk-HLHY7KAF.js +181 -0
- package/dist/create-app.d.ts +23 -8
- package/dist/create-app.js +4 -5
- package/dist/index.js +33 -31
- package/dist/orama-cloud-VQUOOEZ2.js +313 -0
- package/package.json +5 -3
- package/template/+next+fuma-docs-mdx/app/(home)/page.tsx +16 -0
- package/template/{+next+tailwindcss → +next+fuma-docs-mdx}/app/layout.tsx +1 -1
- package/template/{+next → +next+fuma-docs-mdx}/example.gitignore +0 -2
- package/template/+next+fuma-docs-mdx/lib/layout.shared.tsx +9 -0
- package/template/+next+fuma-docs-mdx/lib/source.ts +1 -1
- package/template/{+next → +next+fuma-docs-mdx}/mdx-components.tsx +0 -1
- package/template/+next+fuma-docs-mdx/package.json +29 -0
- package/template/+next+fuma-docs-mdx/source.config.ts +1 -0
- package/template/+next+fuma-docs-mdx/tsconfig.json +2 -2
- package/template/+orama-cloud/@app/components/search.tsx +59 -0
- package/template/+orama-cloud/@app/lib/export-static-indexes.ts +14 -0
- package/template/+orama-cloud/@root/.env.example +6 -0
- package/template/react-router/app/docs/page.tsx +4 -4
- package/template/react-router/example.gitignore +0 -1
- package/template/react-router/react-router.config.ts +3 -3
- package/template/react-router-spa/README.md +12 -0
- package/template/react-router-spa/app/app.css +3 -0
- package/template/react-router-spa/app/components/search.tsx +50 -0
- package/template/react-router-spa/app/docs/page.tsx +53 -0
- package/template/react-router-spa/app/docs/search.ts +10 -0
- package/template/react-router-spa/app/lib/layout.shared.tsx +9 -0
- package/template/react-router-spa/app/lib/source.ts +7 -0
- package/template/react-router-spa/app/root.tsx +76 -0
- package/template/react-router-spa/app/routes/home.tsx +30 -0
- package/template/react-router-spa/app/routes.ts +7 -0
- package/template/react-router-spa/content/docs/index.mdx +32 -0
- package/template/react-router-spa/content/docs/test.mdx +24 -0
- package/template/react-router-spa/example.gitignore +7 -0
- package/template/react-router-spa/package.json +36 -0
- package/template/react-router-spa/public/favicon.ico +0 -0
- package/template/react-router-spa/react-router.config.ts +23 -0
- package/template/react-router-spa/serve.json +3 -0
- package/template/react-router-spa/source.config.ts +7 -0
- package/template/react-router-spa/tsconfig.json +28 -0
- package/template/react-router-spa/vite.config.ts +10 -0
- package/template/tanstack-start/example.gitignore +9 -1
- package/template/tanstack-start/package.json +6 -6
- package/template/waku/example.gitignore +3 -1
- package/template/waku/package.json +3 -3
- package/dist/chunk-YVEWA65C.js +0 -370
- package/template/+next/README.md +0 -37
- package/template/+next/app/(home)/page.tsx +0 -42
- package/template/+next/app/layout.tsx +0 -23
- package/template/+next/lib/layout.shared.tsx +0 -30
- package/template/+next+content-collections/app/docs/[[...slug]]/page.tsx +0 -51
- package/template/+next+content-collections/content-collections.ts +0 -26
- package/template/+next+content-collections/lib/source.ts +0 -8
- package/template/+next+content-collections/next.config.mjs +0 -8
- package/template/+next+content-collections/tsconfig.json +0 -35
- package/template/+next+tailwindcss/app/(home)/page.tsx +0 -19
- package/template/{+next → +next+fuma-docs-mdx}/app/(home)/layout.tsx +0 -0
- package/template/{+next → +next+fuma-docs-mdx}/app/api/search/route.ts +0 -0
- package/template/{+next → +next+fuma-docs-mdx}/app/docs/layout.tsx +1 -1
- /package/template/{+next+tailwindcss → +next+fuma-docs-mdx}/app/global.css +0 -0
- /package/template/{+next → +next+fuma-docs-mdx}/content/docs/index.mdx +0 -0
- /package/template/{+next → +next+fuma-docs-mdx}/content/docs/test.mdx +0 -0
- /package/template/{+next+tailwindcss → +next+fuma-docs-mdx}/postcss.config.mjs +0 -0
package/dist/chunk-YVEWA65C.js
DELETED
|
@@ -1,370 +0,0 @@
|
|
|
1
|
-
// src/create-app.ts
|
|
2
|
-
import path from "path";
|
|
3
|
-
import fs2 from "fs/promises";
|
|
4
|
-
|
|
5
|
-
// src/git.ts
|
|
6
|
-
import * as fs from "fs/promises";
|
|
7
|
-
import { join } from "path";
|
|
8
|
-
import { x } from "tinyexec";
|
|
9
|
-
async function isInGitRepository(cwd2) {
|
|
10
|
-
const { exitCode } = await x("git", ["rev-parse", "--is-inside-work-tree"], {
|
|
11
|
-
nodeOptions: { cwd: cwd2 }
|
|
12
|
-
});
|
|
13
|
-
return exitCode === 0;
|
|
14
|
-
}
|
|
15
|
-
async function isDefaultBranchSet(cwd2) {
|
|
16
|
-
const { exitCode } = await x("git", ["config", "init.defaultBranch"], {
|
|
17
|
-
nodeOptions: { cwd: cwd2 }
|
|
18
|
-
});
|
|
19
|
-
return exitCode === 0;
|
|
20
|
-
}
|
|
21
|
-
async function tryGitInit(cwd2) {
|
|
22
|
-
const { exitCode } = await x("git", ["--version"]);
|
|
23
|
-
if (exitCode !== 0) return false;
|
|
24
|
-
if (await isInGitRepository(cwd2)) return false;
|
|
25
|
-
try {
|
|
26
|
-
await x("git", ["init"], {
|
|
27
|
-
throwOnError: true,
|
|
28
|
-
nodeOptions: { cwd: cwd2 }
|
|
29
|
-
});
|
|
30
|
-
if (!await isDefaultBranchSet(cwd2)) {
|
|
31
|
-
await x("git", ["checkout", "-b", "main"], {
|
|
32
|
-
throwOnError: true,
|
|
33
|
-
nodeOptions: {
|
|
34
|
-
cwd: cwd2
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
await x("git", ["add", "-A"], {
|
|
39
|
-
throwOnError: true,
|
|
40
|
-
nodeOptions: {
|
|
41
|
-
cwd: cwd2
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
await x(
|
|
45
|
-
"git",
|
|
46
|
-
["commit", "-m", "Initial commit from Create Fumadocs App"],
|
|
47
|
-
{
|
|
48
|
-
throwOnError: true,
|
|
49
|
-
nodeOptions: {
|
|
50
|
-
cwd: cwd2
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
);
|
|
54
|
-
return true;
|
|
55
|
-
} catch {
|
|
56
|
-
await fs.rmdir(join(cwd2, ".git"), { recursive: true }).catch(() => null);
|
|
57
|
-
return false;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// src/versions.js
|
|
62
|
-
var versions = { "fumadocs-core": "16.0.1", "fumadocs-ui": "16.0.1", "fumadocs-mdx": "13.0.0", "@fumadocs/mdx-remote": "1.4.3", "@fumadocs/content-collections": "1.2.4" };
|
|
63
|
-
|
|
64
|
-
// ../create-app-versions/package.json
|
|
65
|
-
var package_default = {
|
|
66
|
-
name: "example-versions",
|
|
67
|
-
version: "0.0.0",
|
|
68
|
-
private: true,
|
|
69
|
-
description: "Used to track dependency versions in create-fumadocs-app",
|
|
70
|
-
dependencies: {
|
|
71
|
-
"@biomejs/biome": "^2.2.6",
|
|
72
|
-
"@content-collections/core": "^0.11.1",
|
|
73
|
-
"@content-collections/mdx": "^0.2.2",
|
|
74
|
-
"@content-collections/next": "^0.2.8",
|
|
75
|
-
"@react-router/dev": "^7.9.4",
|
|
76
|
-
"@react-router/node": "^7.9.4",
|
|
77
|
-
"@react-router/serve": "^7.9.4",
|
|
78
|
-
"@tailwindcss/postcss": "^4.1.15",
|
|
79
|
-
"@tailwindcss/vite": "^4.1.15",
|
|
80
|
-
"@tanstack/react-router": "^1.133.21",
|
|
81
|
-
"@tanstack/react-start": "^1.133.21",
|
|
82
|
-
"@types/mdx": "^2.0.13",
|
|
83
|
-
"@types/node": "24.9.1",
|
|
84
|
-
"@types/react": "^19.2.2",
|
|
85
|
-
"@types/react-dom": "^19.2.2",
|
|
86
|
-
"@vitejs/plugin-react": "^5.0.4",
|
|
87
|
-
"gray-matter": "^4.0.3",
|
|
88
|
-
isbot: "^5.1.31",
|
|
89
|
-
"lucide-react": "^0.546.0",
|
|
90
|
-
next: "16.0.0",
|
|
91
|
-
postcss: "^8.5.6",
|
|
92
|
-
react: "^19.2.0",
|
|
93
|
-
"react-dom": "^19.2.0",
|
|
94
|
-
"react-router": "^7.9.4",
|
|
95
|
-
"react-router-devtools": "^5.1.3",
|
|
96
|
-
shiki: "^3.13.0",
|
|
97
|
-
tailwindcss: "^4.1.15",
|
|
98
|
-
tinyglobby: "^0.2.15",
|
|
99
|
-
typescript: "^5.9.3",
|
|
100
|
-
vinxi: "^0.5.8",
|
|
101
|
-
vite: "^7.1.11",
|
|
102
|
-
"vite-tsconfig-paths": "^5.1.4"
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
// src/auto-install.ts
|
|
107
|
-
import { x as x2 } from "tinyexec";
|
|
108
|
-
var managers = ["npm", "yarn", "bun", "pnpm"];
|
|
109
|
-
function getPackageManager() {
|
|
110
|
-
const userAgent = process.env.npm_config_user_agent ?? "";
|
|
111
|
-
if (userAgent.startsWith("yarn")) {
|
|
112
|
-
return "yarn";
|
|
113
|
-
}
|
|
114
|
-
if (userAgent.startsWith("pnpm")) {
|
|
115
|
-
return "pnpm";
|
|
116
|
-
}
|
|
117
|
-
if (userAgent.startsWith("bun")) {
|
|
118
|
-
return "bun";
|
|
119
|
-
}
|
|
120
|
-
return "npm";
|
|
121
|
-
}
|
|
122
|
-
async function autoInstall(manager, dest) {
|
|
123
|
-
await x2(manager, ["install"], {
|
|
124
|
-
throwOnError: true,
|
|
125
|
-
nodeOptions: {
|
|
126
|
-
env: {
|
|
127
|
-
...process.env,
|
|
128
|
-
NODE_ENV: "development",
|
|
129
|
-
DISABLE_OPENCOLLECTIVE: "1"
|
|
130
|
-
},
|
|
131
|
-
cwd: dest
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// src/constants.ts
|
|
137
|
-
import { fileURLToPath } from "url";
|
|
138
|
-
var sourceDir = fileURLToPath(new URL(`../`, import.meta.url).href);
|
|
139
|
-
var cwd = process.cwd();
|
|
140
|
-
|
|
141
|
-
// src/create-app.ts
|
|
142
|
-
var templates = [
|
|
143
|
-
"+next+content-collections",
|
|
144
|
-
"+next+fuma-docs-mdx",
|
|
145
|
-
"react-router",
|
|
146
|
-
"tanstack-start",
|
|
147
|
-
"waku"
|
|
148
|
-
];
|
|
149
|
-
function defaults(options) {
|
|
150
|
-
return {
|
|
151
|
-
...options,
|
|
152
|
-
useSrcDir: options.useSrcDir ?? false,
|
|
153
|
-
tailwindcss: options.tailwindcss ?? true,
|
|
154
|
-
lint: options.lint ?? false,
|
|
155
|
-
initializeGit: options.initializeGit ?? false,
|
|
156
|
-
installDeps: options.installDeps ?? false,
|
|
157
|
-
log: console.log
|
|
158
|
-
};
|
|
159
|
-
}
|
|
160
|
-
async function create(createOptions) {
|
|
161
|
-
const options = defaults(createOptions);
|
|
162
|
-
const {
|
|
163
|
-
outputDir,
|
|
164
|
-
useSrcDir,
|
|
165
|
-
log,
|
|
166
|
-
installDeps,
|
|
167
|
-
template,
|
|
168
|
-
lint,
|
|
169
|
-
initializeGit,
|
|
170
|
-
packageManager,
|
|
171
|
-
tailwindcss
|
|
172
|
-
} = options;
|
|
173
|
-
const projectName = path.basename(outputDir);
|
|
174
|
-
const dest = path.resolve(cwd, outputDir);
|
|
175
|
-
const isNext = options.template.startsWith("+next");
|
|
176
|
-
function isRelative(dir, file) {
|
|
177
|
-
return !path.relative(path.join(dest, dir), file).startsWith(`..${path.sep}`);
|
|
178
|
-
}
|
|
179
|
-
function defaultRename(file) {
|
|
180
|
-
file = file.replace("example.gitignore", ".gitignore");
|
|
181
|
-
if (!useSrcDir || !isNext) {
|
|
182
|
-
return file;
|
|
183
|
-
}
|
|
184
|
-
if (path.basename(file) === "mdx-components.tsx" || isRelative("app", file) || isRelative("lib", file)) {
|
|
185
|
-
return path.join(dest, "src", path.relative(dest, file));
|
|
186
|
-
}
|
|
187
|
-
return file;
|
|
188
|
-
}
|
|
189
|
-
if (isNext) {
|
|
190
|
-
await copy(path.join(sourceDir, `template/+next`), dest, defaultRename);
|
|
191
|
-
await copy(
|
|
192
|
-
path.join(sourceDir, `template/${template}`),
|
|
193
|
-
dest,
|
|
194
|
-
defaultRename
|
|
195
|
-
);
|
|
196
|
-
if (tailwindcss) {
|
|
197
|
-
await copy(
|
|
198
|
-
path.join(sourceDir, `template/+next+tailwindcss`),
|
|
199
|
-
dest,
|
|
200
|
-
defaultRename
|
|
201
|
-
);
|
|
202
|
-
log("Configured Tailwind CSS");
|
|
203
|
-
}
|
|
204
|
-
if (lint) {
|
|
205
|
-
await copy(
|
|
206
|
-
path.join(sourceDir, `template/+next+${lint}`),
|
|
207
|
-
dest,
|
|
208
|
-
defaultRename
|
|
209
|
-
);
|
|
210
|
-
log("Configured Linter");
|
|
211
|
-
}
|
|
212
|
-
if (useSrcDir) {
|
|
213
|
-
const tsconfigPath = path.join(dest, "tsconfig.json");
|
|
214
|
-
const content = (await fs2.readFile(tsconfigPath)).toString();
|
|
215
|
-
const config = JSON.parse(content);
|
|
216
|
-
if (config.compilerOptions?.paths) {
|
|
217
|
-
Object.assign(config.compilerOptions.paths, {
|
|
218
|
-
"@/*": ["./src/*"]
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
|
-
await fs2.writeFile(tsconfigPath, JSON.stringify(config, null, 2));
|
|
222
|
-
}
|
|
223
|
-
} else {
|
|
224
|
-
await copy(
|
|
225
|
-
path.join(sourceDir, `template/${template}`),
|
|
226
|
-
dest,
|
|
227
|
-
defaultRename
|
|
228
|
-
);
|
|
229
|
-
}
|
|
230
|
-
const packageJson = isNext ? await createNextPackageJson(projectName, options) : await createPackageJson(projectName, dest);
|
|
231
|
-
await fs2.writeFile(
|
|
232
|
-
path.join(dest, "package.json"),
|
|
233
|
-
JSON.stringify(packageJson, null, 2)
|
|
234
|
-
);
|
|
235
|
-
const readMe = await getReadme(dest, projectName);
|
|
236
|
-
await fs2.writeFile(path.join(dest, "README.md"), readMe);
|
|
237
|
-
if (installDeps) {
|
|
238
|
-
try {
|
|
239
|
-
await autoInstall(packageManager, dest);
|
|
240
|
-
log("Installed dependencies");
|
|
241
|
-
} catch (err) {
|
|
242
|
-
log(`Failed to install dependencies: ${err}`);
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
if (initializeGit && await tryGitInit(dest)) {
|
|
246
|
-
log("Initialized Git repository");
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
async function getReadme(dest, projectName) {
|
|
250
|
-
const template = await fs2.readFile(path.join(dest, "README.md")).then((res) => res.toString());
|
|
251
|
-
return `# ${projectName}
|
|
252
|
-
|
|
253
|
-
${template}`;
|
|
254
|
-
}
|
|
255
|
-
async function copy(from, to, rename = (s) => s) {
|
|
256
|
-
const stats = await fs2.stat(from);
|
|
257
|
-
if (stats.isDirectory()) {
|
|
258
|
-
const files = await fs2.readdir(from);
|
|
259
|
-
await Promise.all(
|
|
260
|
-
files.map(
|
|
261
|
-
(file) => copy(path.join(from, file), rename(path.join(to, file)))
|
|
262
|
-
)
|
|
263
|
-
);
|
|
264
|
-
} else {
|
|
265
|
-
await fs2.mkdir(path.dirname(to), { recursive: true });
|
|
266
|
-
await fs2.copyFile(from, to);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
async function createNextPackageJson(projectName, { template, lint, tailwindcss }) {
|
|
270
|
-
return {
|
|
271
|
-
name: projectName,
|
|
272
|
-
version: "0.0.0",
|
|
273
|
-
private: true,
|
|
274
|
-
scripts: {
|
|
275
|
-
build: "next build",
|
|
276
|
-
dev: "next dev --turbo",
|
|
277
|
-
start: "next start",
|
|
278
|
-
...template === "+next+fuma-docs-mdx" && {
|
|
279
|
-
postinstall: "fumadocs-mdx"
|
|
280
|
-
},
|
|
281
|
-
...lint && {
|
|
282
|
-
eslint: {
|
|
283
|
-
lint: "eslint"
|
|
284
|
-
},
|
|
285
|
-
biome: { lint: "biome check", format: "biome format --write" }
|
|
286
|
-
}[lint]
|
|
287
|
-
},
|
|
288
|
-
dependencies: {
|
|
289
|
-
...pick(package_default.dependencies, [
|
|
290
|
-
"next",
|
|
291
|
-
"react",
|
|
292
|
-
"react-dom",
|
|
293
|
-
"lucide-react"
|
|
294
|
-
]),
|
|
295
|
-
...pick(versions, ["fumadocs-ui", "fumadocs-core"]),
|
|
296
|
-
...{
|
|
297
|
-
"+next+content-collections": {
|
|
298
|
-
...pick(package_default.dependencies, [
|
|
299
|
-
"@content-collections/mdx",
|
|
300
|
-
"@content-collections/core",
|
|
301
|
-
"@content-collections/next"
|
|
302
|
-
]),
|
|
303
|
-
...pick(versions, ["@fumadocs/content-collections"])
|
|
304
|
-
},
|
|
305
|
-
"+next+fuma-docs-mdx": pick(versions, ["fumadocs-mdx"]),
|
|
306
|
-
waku: null,
|
|
307
|
-
"tanstack-start": null,
|
|
308
|
-
"react-router": null
|
|
309
|
-
}[template]
|
|
310
|
-
},
|
|
311
|
-
devDependencies: {
|
|
312
|
-
...pick(package_default.dependencies, [
|
|
313
|
-
"@types/node",
|
|
314
|
-
"@types/react",
|
|
315
|
-
"@types/react-dom",
|
|
316
|
-
"typescript",
|
|
317
|
-
"@types/mdx"
|
|
318
|
-
]),
|
|
319
|
-
...tailwindcss && pick(package_default.dependencies, [
|
|
320
|
-
"@tailwindcss/postcss",
|
|
321
|
-
"tailwindcss",
|
|
322
|
-
"postcss"
|
|
323
|
-
]),
|
|
324
|
-
...lint && {
|
|
325
|
-
eslint: {
|
|
326
|
-
eslint: "^9",
|
|
327
|
-
"eslint-config-next": package_default.dependencies.next,
|
|
328
|
-
"@eslint/eslintrc": "^3"
|
|
329
|
-
},
|
|
330
|
-
biome: pick(package_default.dependencies, ["@biomejs/biome"])
|
|
331
|
-
}[lint]
|
|
332
|
-
}
|
|
333
|
-
};
|
|
334
|
-
}
|
|
335
|
-
async function createPackageJson(projectName, dir) {
|
|
336
|
-
function replaceWorkspaceDeps(deps) {
|
|
337
|
-
for (const k in deps) {
|
|
338
|
-
if (deps[k].startsWith("workspace:") && k in versions) {
|
|
339
|
-
deps[k] = versions[k];
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
return deps;
|
|
343
|
-
}
|
|
344
|
-
const packageJson = JSON.parse(
|
|
345
|
-
await fs2.readFile(path.join(dir, "package.json")).then((res) => res.toString())
|
|
346
|
-
);
|
|
347
|
-
return {
|
|
348
|
-
name: projectName,
|
|
349
|
-
...packageJson,
|
|
350
|
-
dependencies: replaceWorkspaceDeps(packageJson.dependencies),
|
|
351
|
-
devDependencies: replaceWorkspaceDeps(packageJson.devDependencies)
|
|
352
|
-
};
|
|
353
|
-
}
|
|
354
|
-
function pick(obj, keys) {
|
|
355
|
-
const result = {};
|
|
356
|
-
for (const key of keys) {
|
|
357
|
-
if (key in obj) {
|
|
358
|
-
result[key] = obj[key];
|
|
359
|
-
}
|
|
360
|
-
}
|
|
361
|
-
return result;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
export {
|
|
365
|
-
managers,
|
|
366
|
-
getPackageManager,
|
|
367
|
-
cwd,
|
|
368
|
-
templates,
|
|
369
|
-
create
|
|
370
|
-
};
|
package/template/+next/README.md
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
This is a Next.js application generated with
|
|
2
|
-
[Create Fumadocs](https://github.com/fuma-nama/fumadocs).
|
|
3
|
-
|
|
4
|
-
Run development server:
|
|
5
|
-
|
|
6
|
-
```bash
|
|
7
|
-
npm run dev
|
|
8
|
-
# or
|
|
9
|
-
pnpm dev
|
|
10
|
-
# or
|
|
11
|
-
yarn dev
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
Open http://localhost:3000 with your browser to see the result.
|
|
15
|
-
|
|
16
|
-
## Explore
|
|
17
|
-
|
|
18
|
-
In the project, you can see:
|
|
19
|
-
|
|
20
|
-
- `lib/source.ts`: Code for content source adapter, [`loader()`](https://fumadocs.dev/docs/headless/source-api) provides the interface to access your content.
|
|
21
|
-
- `lib/layout.shared.tsx`: Shared options for layouts, optional but preferred to keep.
|
|
22
|
-
|
|
23
|
-
| Route | Description |
|
|
24
|
-
| ------------------------- | ------------------------------------------------------ |
|
|
25
|
-
| `app/(home)` | The route group for your landing page and other pages. |
|
|
26
|
-
| `app/docs` | The documentation layout and pages. |
|
|
27
|
-
| `app/api/search/route.ts` | The Route Handler for search. |
|
|
28
|
-
|
|
29
|
-
## Learn More
|
|
30
|
-
|
|
31
|
-
To learn more about Next.js and Fumadocs, take a look at the following
|
|
32
|
-
resources:
|
|
33
|
-
|
|
34
|
-
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js
|
|
35
|
-
features and API.
|
|
36
|
-
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
|
37
|
-
- [Fumadocs](https://fumadocs.dev) - learn about Fumadocs
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import Link from 'next/link';
|
|
2
|
-
|
|
3
|
-
export const metadata = {
|
|
4
|
-
title: 'My App',
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export default function HomePage() {
|
|
8
|
-
return (
|
|
9
|
-
<main
|
|
10
|
-
style={{
|
|
11
|
-
flex: 1,
|
|
12
|
-
display: 'flex',
|
|
13
|
-
flexDirection: 'column',
|
|
14
|
-
textAlign: 'center',
|
|
15
|
-
justifyContent: 'center',
|
|
16
|
-
}}
|
|
17
|
-
>
|
|
18
|
-
<h1
|
|
19
|
-
style={{
|
|
20
|
-
fontSize: '2rem',
|
|
21
|
-
fontWeight: 'bold',
|
|
22
|
-
marginBottom: '1rem',
|
|
23
|
-
}}
|
|
24
|
-
>
|
|
25
|
-
Hello World
|
|
26
|
-
</h1>
|
|
27
|
-
<p>
|
|
28
|
-
You can open{' '}
|
|
29
|
-
<Link
|
|
30
|
-
href="/docs"
|
|
31
|
-
style={{
|
|
32
|
-
fontWeight: '600',
|
|
33
|
-
textDecoration: 'underline',
|
|
34
|
-
}}
|
|
35
|
-
>
|
|
36
|
-
/docs
|
|
37
|
-
</Link>{' '}
|
|
38
|
-
and see the documentation.
|
|
39
|
-
</p>
|
|
40
|
-
</main>
|
|
41
|
-
);
|
|
42
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { RootProvider } from 'fumadocs-ui/provider/next';
|
|
2
|
-
import 'fumadocs-ui/style.css';
|
|
3
|
-
import { Inter } from 'next/font/google';
|
|
4
|
-
|
|
5
|
-
const inter = Inter({
|
|
6
|
-
subsets: ['latin'],
|
|
7
|
-
});
|
|
8
|
-
|
|
9
|
-
export default function Layout({ children }: LayoutProps<'/'>) {
|
|
10
|
-
return (
|
|
11
|
-
<html lang="en" className={inter.className} suppressHydrationWarning>
|
|
12
|
-
<body
|
|
13
|
-
style={{
|
|
14
|
-
display: 'flex',
|
|
15
|
-
flexDirection: 'column',
|
|
16
|
-
minHeight: '100vh',
|
|
17
|
-
}}
|
|
18
|
-
>
|
|
19
|
-
<RootProvider>{children}</RootProvider>
|
|
20
|
-
</body>
|
|
21
|
-
</html>
|
|
22
|
-
);
|
|
23
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { BaseLayoutProps } from 'fumadocs-ui/layouts/shared';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Shared layout configurations
|
|
5
|
-
*
|
|
6
|
-
* you can customise layouts individually from:
|
|
7
|
-
* Home Layout: app/(home)/layout.tsx
|
|
8
|
-
* Docs Layout: app/docs/layout.tsx
|
|
9
|
-
*/
|
|
10
|
-
export function baseOptions(): BaseLayoutProps {
|
|
11
|
-
return {
|
|
12
|
-
nav: {
|
|
13
|
-
title: (
|
|
14
|
-
<>
|
|
15
|
-
<svg
|
|
16
|
-
width="24"
|
|
17
|
-
height="24"
|
|
18
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
19
|
-
aria-label="Logo"
|
|
20
|
-
>
|
|
21
|
-
<circle cx={12} cy={12} r={12} fill="currentColor" />
|
|
22
|
-
</svg>
|
|
23
|
-
My App
|
|
24
|
-
</>
|
|
25
|
-
),
|
|
26
|
-
},
|
|
27
|
-
// see https://fumadocs.dev/docs/ui/navigation/links
|
|
28
|
-
links: [],
|
|
29
|
-
};
|
|
30
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { source } from '@/lib/source';
|
|
2
|
-
import type { Metadata } from 'next';
|
|
3
|
-
import {
|
|
4
|
-
DocsBody,
|
|
5
|
-
DocsDescription,
|
|
6
|
-
DocsPage,
|
|
7
|
-
DocsTitle,
|
|
8
|
-
} from 'fumadocs-ui/page';
|
|
9
|
-
import { notFound } from 'next/navigation';
|
|
10
|
-
import { MDXContent } from '@content-collections/mdx/react';
|
|
11
|
-
import { createRelativeLink } from 'fumadocs-ui/mdx';
|
|
12
|
-
import { getMDXComponents } from '@/mdx-components';
|
|
13
|
-
|
|
14
|
-
export default async function Page(props: PageProps<'/docs/[[...slug]]'>) {
|
|
15
|
-
const params = await props.params;
|
|
16
|
-
const page = source.getPage(params.slug);
|
|
17
|
-
if (!page) notFound();
|
|
18
|
-
|
|
19
|
-
return (
|
|
20
|
-
<DocsPage toc={page.data.toc} full={page.data.full}>
|
|
21
|
-
<DocsTitle>{page.data.title}</DocsTitle>
|
|
22
|
-
<DocsDescription>{page.data.description}</DocsDescription>
|
|
23
|
-
<DocsBody>
|
|
24
|
-
<MDXContent
|
|
25
|
-
code={page.data.body}
|
|
26
|
-
components={getMDXComponents({
|
|
27
|
-
// this allows you to link to other pages with relative file paths
|
|
28
|
-
a: createRelativeLink(source, page),
|
|
29
|
-
})}
|
|
30
|
-
/>
|
|
31
|
-
</DocsBody>
|
|
32
|
-
</DocsPage>
|
|
33
|
-
);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export function generateStaticParams() {
|
|
37
|
-
return source.generateParams();
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export async function generateMetadata(
|
|
41
|
-
props: PageProps<'/docs/[[...slug]]'>,
|
|
42
|
-
): Promise<Metadata> {
|
|
43
|
-
const params = await props.params;
|
|
44
|
-
const page = source.getPage(params.slug);
|
|
45
|
-
if (!page) notFound();
|
|
46
|
-
|
|
47
|
-
return {
|
|
48
|
-
title: page.data.title,
|
|
49
|
-
description: page.data.description,
|
|
50
|
-
};
|
|
51
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { defineCollection, defineConfig } from '@content-collections/core';
|
|
2
|
-
import {
|
|
3
|
-
frontmatterSchema,
|
|
4
|
-
metaSchema,
|
|
5
|
-
transformMDX,
|
|
6
|
-
} from '@fumadocs/content-collections/configuration';
|
|
7
|
-
|
|
8
|
-
const docs = defineCollection({
|
|
9
|
-
name: 'docs',
|
|
10
|
-
directory: 'content/docs',
|
|
11
|
-
include: '**/*.mdx',
|
|
12
|
-
schema: frontmatterSchema,
|
|
13
|
-
transform: transformMDX,
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
const metas = defineCollection({
|
|
17
|
-
name: 'meta',
|
|
18
|
-
directory: 'content/docs',
|
|
19
|
-
include: '**/meta.json',
|
|
20
|
-
parser: 'json',
|
|
21
|
-
schema: metaSchema,
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
export default defineConfig({
|
|
25
|
-
collections: [docs, metas],
|
|
26
|
-
});
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { allDocs, allMetas } from 'content-collections';
|
|
2
|
-
import { loader } from 'fumadocs-core/source';
|
|
3
|
-
import { createMDXSource } from '@fumadocs/content-collections';
|
|
4
|
-
|
|
5
|
-
export const source = loader({
|
|
6
|
-
baseUrl: '/docs',
|
|
7
|
-
source: createMDXSource(allDocs, allMetas),
|
|
8
|
-
});
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"baseUrl": ".",
|
|
4
|
-
"target": "ESNext",
|
|
5
|
-
"lib": ["dom", "dom.iterable", "esnext"],
|
|
6
|
-
"allowJs": true,
|
|
7
|
-
"skipLibCheck": true,
|
|
8
|
-
"strict": true,
|
|
9
|
-
"noEmit": true,
|
|
10
|
-
"esModuleInterop": true,
|
|
11
|
-
"module": "esnext",
|
|
12
|
-
"moduleResolution": "bundler",
|
|
13
|
-
"resolveJsonModule": true,
|
|
14
|
-
"isolatedModules": true,
|
|
15
|
-
"jsx": "preserve",
|
|
16
|
-
"incremental": true,
|
|
17
|
-
"paths": {
|
|
18
|
-
"@/*": ["./*"],
|
|
19
|
-
"content-collections": ["./.content-collections/generated"]
|
|
20
|
-
},
|
|
21
|
-
"plugins": [
|
|
22
|
-
{
|
|
23
|
-
"name": "next"
|
|
24
|
-
}
|
|
25
|
-
]
|
|
26
|
-
},
|
|
27
|
-
"include": [
|
|
28
|
-
"next-env.d.ts",
|
|
29
|
-
"**/*.ts",
|
|
30
|
-
"**/*.tsx",
|
|
31
|
-
".next/types/**/*.ts",
|
|
32
|
-
".content-collections/generated"
|
|
33
|
-
],
|
|
34
|
-
"exclude": ["node_modules"]
|
|
35
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import Link from 'next/link';
|
|
2
|
-
|
|
3
|
-
export default function HomePage() {
|
|
4
|
-
return (
|
|
5
|
-
<main className="flex flex-1 flex-col justify-center text-center">
|
|
6
|
-
<h1 className="mb-4 text-2xl font-bold">Hello World</h1>
|
|
7
|
-
<p className="text-fd-muted-foreground">
|
|
8
|
-
You can open{' '}
|
|
9
|
-
<Link
|
|
10
|
-
href="/docs"
|
|
11
|
-
className="text-fd-foreground font-semibold underline"
|
|
12
|
-
>
|
|
13
|
-
/docs
|
|
14
|
-
</Link>{' '}
|
|
15
|
-
and see the documentation.
|
|
16
|
-
</p>
|
|
17
|
-
</main>
|
|
18
|
-
);
|
|
19
|
-
}
|
|
File without changes
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { source } from '@/lib/source';
|
|
1
2
|
import { DocsLayout } from 'fumadocs-ui/layouts/docs';
|
|
2
3
|
import { baseOptions } from '@/lib/layout.shared';
|
|
3
|
-
import { source } from '@/lib/source';
|
|
4
4
|
|
|
5
5
|
export default function Layout({ children }: LayoutProps<'/docs'>) {
|
|
6
6
|
return (
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|