create-fumadocs-app 8.0.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/README.md +11 -0
- package/dist/chunk-QD4OISDK.js +542 -0
- package/dist/create-app.js +6 -0
- package/dist/index.js +101 -0
- package/package.json +46 -0
- package/template/+content/README.md +24 -0
- package/template/+content/content/docs/index.mdx +13 -0
- package/template/+content/content/docs/test.mdx +17 -0
- package/template/+content/example.gitignore +27 -0
- package/template/+tailwindcss/app/global.css +3 -0
- package/template/+tailwindcss/app/layout.tsx +18 -0
- package/template/+tailwindcss/app/page.tsx +16 -0
- package/template/+tailwindcss/postcss.config.js +6 -0
- package/template/+tailwindcss/tailwind.config.js +13 -0
- package/template/contentlayer/app/api/search/route.ts +11 -0
- package/template/contentlayer/app/docs/[[...slug]]/content.tsx +14 -0
- package/template/contentlayer/app/docs/[[...slug]]/page.tsx +43 -0
- package/template/contentlayer/app/docs/layout.tsx +11 -0
- package/template/contentlayer/app/layout.tsx +18 -0
- package/template/contentlayer/app/page.tsx +38 -0
- package/template/contentlayer/app/source.ts +9 -0
- package/template/contentlayer/contentlayer.config.ts +4 -0
- package/template/contentlayer/next.config.js +8 -0
- package/template/contentlayer/tsconfig.json +35 -0
- package/template/fuma-docs-mdx/app/api/search/route.ts +11 -0
- package/template/fuma-docs-mdx/app/docs/[[...slug]]/page.tsx +44 -0
- package/template/fuma-docs-mdx/app/docs/layout.tsx +11 -0
- package/template/fuma-docs-mdx/app/layout.tsx +18 -0
- package/template/fuma-docs-mdx/app/page.tsx +38 -0
- package/template/fuma-docs-mdx/app/source.ts +9 -0
- package/template/fuma-docs-mdx/mdx-components.tsx +9 -0
- package/template/fuma-docs-mdx/next.config.mjs +10 -0
- package/template/fuma-docs-mdx/tsconfig.json +29 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Fuma
|
|
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/README.md
ADDED
|
@@ -0,0 +1,542 @@
|
|
|
1
|
+
// src/create-app.ts
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import fs from "node:fs/promises";
|
|
4
|
+
|
|
5
|
+
// ../core/package.json
|
|
6
|
+
var package_default = {
|
|
7
|
+
name: "fumadocs-core",
|
|
8
|
+
version: "8.0.0",
|
|
9
|
+
description: "The library for building a documentation website in Next.js",
|
|
10
|
+
keywords: [
|
|
11
|
+
"NextJs",
|
|
12
|
+
"Docs"
|
|
13
|
+
],
|
|
14
|
+
homepage: "https://fumadocs.vercel.app",
|
|
15
|
+
repository: "github:fuma-nama/next-docs",
|
|
16
|
+
license: "MIT",
|
|
17
|
+
author: "Fuma Nama",
|
|
18
|
+
type: "module",
|
|
19
|
+
exports: {
|
|
20
|
+
"./sidebar": {
|
|
21
|
+
import: "./dist/sidebar.js",
|
|
22
|
+
types: "./dist/sidebar.d.ts"
|
|
23
|
+
},
|
|
24
|
+
"./breadcrumb": {
|
|
25
|
+
import: "./dist/breadcrumb.js",
|
|
26
|
+
types: "./dist/breadcrumb.d.ts"
|
|
27
|
+
},
|
|
28
|
+
"./toc": {
|
|
29
|
+
import: "./dist/toc.js",
|
|
30
|
+
types: "./dist/toc.d.ts"
|
|
31
|
+
},
|
|
32
|
+
"./search/client": {
|
|
33
|
+
import: "./dist/search/client.js",
|
|
34
|
+
types: "./dist/search/client.d.ts"
|
|
35
|
+
},
|
|
36
|
+
"./search/server": {
|
|
37
|
+
import: "./dist/search/server.js",
|
|
38
|
+
types: "./dist/search/server.d.ts"
|
|
39
|
+
},
|
|
40
|
+
"./server": {
|
|
41
|
+
import: "./dist/server/index.js",
|
|
42
|
+
types: "./dist/server/index.d.ts"
|
|
43
|
+
},
|
|
44
|
+
"./source": {
|
|
45
|
+
import: "./dist/source/index.js",
|
|
46
|
+
types: "./dist/source/index.d.ts"
|
|
47
|
+
},
|
|
48
|
+
"./link": {
|
|
49
|
+
import: "./dist/link.js",
|
|
50
|
+
types: "./dist/link.d.ts"
|
|
51
|
+
},
|
|
52
|
+
"./middleware": {
|
|
53
|
+
import: "./dist/middleware.js",
|
|
54
|
+
types: "./dist/middleware.d.ts"
|
|
55
|
+
},
|
|
56
|
+
"./mdx-plugins": {
|
|
57
|
+
import: "./dist/mdx-plugins/index.js",
|
|
58
|
+
types: "./dist/mdx-plugins/index.d.ts"
|
|
59
|
+
},
|
|
60
|
+
"./search-algolia/client": {
|
|
61
|
+
import: "./dist/search-algolia/client.js",
|
|
62
|
+
types: "./dist/search-algolia/client.d.ts"
|
|
63
|
+
},
|
|
64
|
+
"./search-algolia/server": {
|
|
65
|
+
import: "./dist/search-algolia/server.js",
|
|
66
|
+
types: "./dist/search-algolia/server.d.ts"
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
typesVersions: {
|
|
70
|
+
"*": {
|
|
71
|
+
sidebar: [
|
|
72
|
+
"./dist/sidebar.d.ts"
|
|
73
|
+
],
|
|
74
|
+
breadcrumb: [
|
|
75
|
+
"./dist/breadcrumb.d.ts"
|
|
76
|
+
],
|
|
77
|
+
toc: [
|
|
78
|
+
"./dist/toc.d.ts"
|
|
79
|
+
],
|
|
80
|
+
"search/client": [
|
|
81
|
+
"./dist/search/client.d.ts"
|
|
82
|
+
],
|
|
83
|
+
"search/shared": [
|
|
84
|
+
"./dist/search/shared.d.ts"
|
|
85
|
+
],
|
|
86
|
+
"search/server": [
|
|
87
|
+
"./dist/search/server.d.ts"
|
|
88
|
+
],
|
|
89
|
+
server: [
|
|
90
|
+
"./dist/server/index.d.ts"
|
|
91
|
+
],
|
|
92
|
+
source: [
|
|
93
|
+
"./dist/source/index.d.ts"
|
|
94
|
+
],
|
|
95
|
+
link: [
|
|
96
|
+
"./dist/link.d.ts"
|
|
97
|
+
],
|
|
98
|
+
middleware: [
|
|
99
|
+
"./dist/middleware.d.ts"
|
|
100
|
+
],
|
|
101
|
+
"mdx-plugins": [
|
|
102
|
+
"./dist/mdx-plugins/index.d.ts"
|
|
103
|
+
],
|
|
104
|
+
"search-algolia/client": [
|
|
105
|
+
"./dist/search-algolia/client.d.ts"
|
|
106
|
+
],
|
|
107
|
+
"search-algolia/server": [
|
|
108
|
+
"./dist/search-algolia/server.d.ts"
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
files: [
|
|
113
|
+
"dist/*"
|
|
114
|
+
],
|
|
115
|
+
scripts: {
|
|
116
|
+
build: "tsup",
|
|
117
|
+
clean: "rimraf dist",
|
|
118
|
+
dev: "tsup --watch",
|
|
119
|
+
lint: "eslint .",
|
|
120
|
+
test: "vitest",
|
|
121
|
+
"types:check": "tsc --noEmit"
|
|
122
|
+
},
|
|
123
|
+
dependencies: {
|
|
124
|
+
"@formatjs/intl-localematcher": "^0.5.0",
|
|
125
|
+
flexsearch: "0.7.21",
|
|
126
|
+
"github-slugger": "^2.0.0",
|
|
127
|
+
negotiator: "^0.6.3",
|
|
128
|
+
"react-remove-scroll": "^2.5.6",
|
|
129
|
+
"rehype-shikiji": "^0.10.0",
|
|
130
|
+
remark: "^15.0.0",
|
|
131
|
+
"remark-gfm": "^4.0.0",
|
|
132
|
+
"remark-mdx": "^3.0.0",
|
|
133
|
+
"scroll-into-view-if-needed": "^3.1.0",
|
|
134
|
+
shikiji: "^0.10.0",
|
|
135
|
+
"shikiji-transformers": "^0.10.0",
|
|
136
|
+
swr: "^2.2.2",
|
|
137
|
+
"unist-util-visit": "^5.0.0"
|
|
138
|
+
},
|
|
139
|
+
devDependencies: {
|
|
140
|
+
"@algolia/client-search": "^4.20.0",
|
|
141
|
+
"@next/eslint-plugin-next": "^14.0.0",
|
|
142
|
+
"@types/flexsearch": "0.7.6",
|
|
143
|
+
"@types/hast": "^3.0.3",
|
|
144
|
+
"@types/mdast": "^4.0.3",
|
|
145
|
+
"@types/negotiator": "^0.6.1",
|
|
146
|
+
"@types/node": "18.17.5",
|
|
147
|
+
"@types/react": "18.2.0",
|
|
148
|
+
"@types/react-dom": "18.2.1",
|
|
149
|
+
algoliasearch: "^4.20.0",
|
|
150
|
+
"eslint-config-custom": "workspace:*",
|
|
151
|
+
next: "14.1.0",
|
|
152
|
+
tsconfig: "workspace:*",
|
|
153
|
+
unified: "^11.0.4"
|
|
154
|
+
},
|
|
155
|
+
peerDependencies: {
|
|
156
|
+
next: ">= 13.4",
|
|
157
|
+
react: ">= 18",
|
|
158
|
+
"react-dom": ">= 18"
|
|
159
|
+
},
|
|
160
|
+
publishConfig: {
|
|
161
|
+
access: "public"
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
// ../ui/package.json
|
|
166
|
+
var package_default2 = {
|
|
167
|
+
name: "fumadocs-ui",
|
|
168
|
+
version: "8.0.0",
|
|
169
|
+
description: "The framework for building a documentation website in Next.js",
|
|
170
|
+
keywords: [
|
|
171
|
+
"NextJs",
|
|
172
|
+
"Docs"
|
|
173
|
+
],
|
|
174
|
+
homepage: "https://fumadocs.vercel.app",
|
|
175
|
+
repository: "github:fuma-nama/next-docs",
|
|
176
|
+
license: "MIT",
|
|
177
|
+
author: "Fuma Nama",
|
|
178
|
+
exports: {
|
|
179
|
+
"./style.css": "./dist/style.css",
|
|
180
|
+
"./tailwind-plugin": {
|
|
181
|
+
import: "./dist/tailwind-plugin.js",
|
|
182
|
+
require: "./dist/tailwind-plugin.js",
|
|
183
|
+
types: "./dist/tailwind-plugin.d.ts"
|
|
184
|
+
},
|
|
185
|
+
"./components/*": {
|
|
186
|
+
import: "./dist/components/*.js",
|
|
187
|
+
types: "./dist/components/*.d.mts"
|
|
188
|
+
},
|
|
189
|
+
"./*": {
|
|
190
|
+
import: "./dist/*.js",
|
|
191
|
+
types: "./dist/*.d.mts"
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
typesVersions: {
|
|
195
|
+
"*": {
|
|
196
|
+
"tailwind-plugin": [
|
|
197
|
+
"./dist/tailwind-plugin.d.ts"
|
|
198
|
+
],
|
|
199
|
+
"components/*": [
|
|
200
|
+
"./dist/components/*.d.mts"
|
|
201
|
+
],
|
|
202
|
+
"mdx/*": [
|
|
203
|
+
"./dist/mdx/*.d.mts"
|
|
204
|
+
],
|
|
205
|
+
"*": [
|
|
206
|
+
"./dist/*.d.mts"
|
|
207
|
+
]
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
files: [
|
|
211
|
+
"dist/*"
|
|
212
|
+
],
|
|
213
|
+
scripts: {
|
|
214
|
+
build: "tsup && postcss css/styles.css -o ./dist/style.css",
|
|
215
|
+
clean: "rimraf dist",
|
|
216
|
+
dev: 'concurrently "pnpm dev:layout" "pnpm dev:tailwind"',
|
|
217
|
+
"dev:layout": "tsup --watch",
|
|
218
|
+
"dev:tailwind": "postcss css/styles.css -o ./dist/style.css --watch",
|
|
219
|
+
lint: "eslint .",
|
|
220
|
+
"types:check": "tsc --noEmit"
|
|
221
|
+
},
|
|
222
|
+
dependencies: {
|
|
223
|
+
"@radix-ui/react-accordion": "^1.1.2",
|
|
224
|
+
"@radix-ui/react-collapsible": "^1.0.3",
|
|
225
|
+
"@radix-ui/react-dialog": "^1.0.4",
|
|
226
|
+
"@radix-ui/react-popover": "^1.0.6",
|
|
227
|
+
"@radix-ui/react-scroll-area": "^1.0.4",
|
|
228
|
+
"@radix-ui/react-select": "^2.0.0",
|
|
229
|
+
"@radix-ui/react-tabs": "^1.0.4",
|
|
230
|
+
"@tailwindcss/typography": "^0.5.10",
|
|
231
|
+
"class-variance-authority": "^0.7.0",
|
|
232
|
+
clsx: "^2.0.0",
|
|
233
|
+
cmdk: "^0.2.0",
|
|
234
|
+
"fumadocs-core": "workspace:*",
|
|
235
|
+
"lucide-react": "^0.298.0",
|
|
236
|
+
"next-themes": "^0.2.1",
|
|
237
|
+
"react-medium-image-zoom": "^5.1.8",
|
|
238
|
+
"tailwind-merge": "^2.0.0",
|
|
239
|
+
tailwindcss: "^3.4.1"
|
|
240
|
+
},
|
|
241
|
+
devDependencies: {
|
|
242
|
+
"@algolia/client-search": "^4.20.0",
|
|
243
|
+
"@next/eslint-plugin-next": "^14.0.0",
|
|
244
|
+
"@types/react": "18.2.0",
|
|
245
|
+
"@types/react-dom": "18.2.1",
|
|
246
|
+
algoliasearch: "^4.20.0",
|
|
247
|
+
"eslint-config-custom": "workspace:*",
|
|
248
|
+
next: "14.1.0",
|
|
249
|
+
postcss: "8.4.33",
|
|
250
|
+
"postcss-cli": "^11.0.0",
|
|
251
|
+
"postcss-lightningcss": "^1.0.0",
|
|
252
|
+
tsconfig: "workspace:*"
|
|
253
|
+
},
|
|
254
|
+
peerDependencies: {
|
|
255
|
+
next: ">= 13",
|
|
256
|
+
react: ">= 18",
|
|
257
|
+
"react-dom": ">= 18"
|
|
258
|
+
},
|
|
259
|
+
publishConfig: {
|
|
260
|
+
access: "public"
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
// ../mdx/package.json
|
|
265
|
+
var package_default3 = {
|
|
266
|
+
name: "fumadocs-mdx",
|
|
267
|
+
version: "8.0.0",
|
|
268
|
+
description: "The built-in source for Fumadocs",
|
|
269
|
+
keywords: [
|
|
270
|
+
"NextJs",
|
|
271
|
+
"Docs"
|
|
272
|
+
],
|
|
273
|
+
homepage: "https://fumadocs.vercel.app",
|
|
274
|
+
repository: "github:fuma-nama/next-docs",
|
|
275
|
+
license: "MIT",
|
|
276
|
+
author: "Fuma Nama",
|
|
277
|
+
exports: {
|
|
278
|
+
"./loader": "./loader.js",
|
|
279
|
+
"./loader-mdx": "./loader-mdx.js",
|
|
280
|
+
"./config": {
|
|
281
|
+
import: "./dist/config.mjs",
|
|
282
|
+
types: "./dist/config.d.mts"
|
|
283
|
+
},
|
|
284
|
+
".": {
|
|
285
|
+
import: "./dist/index.mjs",
|
|
286
|
+
types: "./dist/index.mts"
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
main: "./dist/index.mjs",
|
|
290
|
+
types: "./dist/index.mts",
|
|
291
|
+
typesVersions: {
|
|
292
|
+
"*": {
|
|
293
|
+
config: [
|
|
294
|
+
"./dist/config.d.mts"
|
|
295
|
+
]
|
|
296
|
+
}
|
|
297
|
+
},
|
|
298
|
+
files: [
|
|
299
|
+
"dist/*",
|
|
300
|
+
"loader-mdx.js",
|
|
301
|
+
"loader.js"
|
|
302
|
+
],
|
|
303
|
+
scripts: {
|
|
304
|
+
build: "tsup",
|
|
305
|
+
clean: "rimraf dist",
|
|
306
|
+
dev: "tsup --watch",
|
|
307
|
+
lint: "eslint .",
|
|
308
|
+
"types:check": "tsc --noEmit"
|
|
309
|
+
},
|
|
310
|
+
dependencies: {
|
|
311
|
+
"@mdx-js/mdx": "^3.0.0",
|
|
312
|
+
"cross-spawn": "^7.0.3",
|
|
313
|
+
"estree-util-value-to-estree": "^3.0.1",
|
|
314
|
+
"fast-glob": "^3.3.1",
|
|
315
|
+
"fumadocs-core": "workspace:*",
|
|
316
|
+
"gray-matter": "^4.0.3",
|
|
317
|
+
zod: "^3.22.4"
|
|
318
|
+
},
|
|
319
|
+
devDependencies: {
|
|
320
|
+
"@types/cross-spawn": "^6.0.4",
|
|
321
|
+
"@types/mdast": "^4.0.3",
|
|
322
|
+
"@types/mdx": "^2.0.8",
|
|
323
|
+
"@types/react": "18.2.0",
|
|
324
|
+
"eslint-config-custom": "workspace:*",
|
|
325
|
+
next: "14.1.0",
|
|
326
|
+
tsconfig: "workspace:*",
|
|
327
|
+
unified: "^11.0.4",
|
|
328
|
+
webpack: "^5.89.0"
|
|
329
|
+
},
|
|
330
|
+
peerDependencies: {
|
|
331
|
+
next: ">= 13.4"
|
|
332
|
+
},
|
|
333
|
+
publishConfig: {
|
|
334
|
+
access: "public"
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
// ../contentlayer/package.json
|
|
339
|
+
var package_default4 = {
|
|
340
|
+
name: "fumadocs-contentlayer",
|
|
341
|
+
version: "1.0.1",
|
|
342
|
+
description: "The Contentlayer adapter for Fumadocs",
|
|
343
|
+
keywords: [
|
|
344
|
+
"NextJs",
|
|
345
|
+
"Docs"
|
|
346
|
+
],
|
|
347
|
+
homepage: "https://fumadocs.vercel.app",
|
|
348
|
+
repository: "github:fuma-nama/next-docs",
|
|
349
|
+
license: "MIT",
|
|
350
|
+
author: "Fuma Nama",
|
|
351
|
+
type: "module",
|
|
352
|
+
exports: {
|
|
353
|
+
".": {
|
|
354
|
+
import: "./dist/index.js",
|
|
355
|
+
types: "./dist/index.d.ts"
|
|
356
|
+
},
|
|
357
|
+
"./configuration": {
|
|
358
|
+
import: "./dist/configuration.js",
|
|
359
|
+
types: "./dist/configuration.d.ts"
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
main: "./dist/index.js",
|
|
363
|
+
types: "./dist/index.d.ts",
|
|
364
|
+
typesVersions: {
|
|
365
|
+
"*": {
|
|
366
|
+
".": [
|
|
367
|
+
"./dist/index.d.ts"
|
|
368
|
+
],
|
|
369
|
+
configuration: [
|
|
370
|
+
"./dist/configuration.d.ts"
|
|
371
|
+
]
|
|
372
|
+
}
|
|
373
|
+
},
|
|
374
|
+
files: [
|
|
375
|
+
"dist/*"
|
|
376
|
+
],
|
|
377
|
+
scripts: {
|
|
378
|
+
build: "tsup",
|
|
379
|
+
clean: "rimraf dist",
|
|
380
|
+
dev: "tsup --watch",
|
|
381
|
+
lint: "eslint .",
|
|
382
|
+
"types:check": "tsc --noEmit"
|
|
383
|
+
},
|
|
384
|
+
dependencies: {
|
|
385
|
+
"fumadocs-core": "workspace:*",
|
|
386
|
+
"rehype-img-size": "^1.0.1"
|
|
387
|
+
},
|
|
388
|
+
devDependencies: {
|
|
389
|
+
contentlayer: "^0.3.4",
|
|
390
|
+
"eslint-config-custom": "workspace:*",
|
|
391
|
+
tsconfig: "workspace:*",
|
|
392
|
+
unified: "^11.0.4"
|
|
393
|
+
},
|
|
394
|
+
publishConfig: {
|
|
395
|
+
access: "public"
|
|
396
|
+
}
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
// src/auto-install.ts
|
|
400
|
+
import { spawn } from "cross-spawn";
|
|
401
|
+
function getPackageManager() {
|
|
402
|
+
const userAgent = process.env.npm_config_user_agent || "";
|
|
403
|
+
if (userAgent.startsWith("yarn")) {
|
|
404
|
+
return "yarn";
|
|
405
|
+
}
|
|
406
|
+
if (userAgent.startsWith("pnpm")) {
|
|
407
|
+
return "pnpm";
|
|
408
|
+
}
|
|
409
|
+
if (userAgent.startsWith("bun")) {
|
|
410
|
+
return "bun";
|
|
411
|
+
}
|
|
412
|
+
return "npm";
|
|
413
|
+
}
|
|
414
|
+
function autoInstall(manager, dest) {
|
|
415
|
+
return new Promise((res, reject) => {
|
|
416
|
+
const installProcess = spawn(manager, ["install"], {
|
|
417
|
+
stdio: "inherit",
|
|
418
|
+
env: {
|
|
419
|
+
...process.env,
|
|
420
|
+
NODE_ENV: "development",
|
|
421
|
+
DISABLE_OPENCOLLECTIVE: "1"
|
|
422
|
+
},
|
|
423
|
+
cwd: dest
|
|
424
|
+
});
|
|
425
|
+
installProcess.on("close", (code) => {
|
|
426
|
+
if (code !== 0) {
|
|
427
|
+
reject(new Error("Install failed"));
|
|
428
|
+
} else {
|
|
429
|
+
res();
|
|
430
|
+
}
|
|
431
|
+
});
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
// src/constants.ts
|
|
436
|
+
import { fileURLToPath } from "node:url";
|
|
437
|
+
var sourceDir = fileURLToPath(new URL(`../`, import.meta.url).href);
|
|
438
|
+
var cwd = process.cwd();
|
|
439
|
+
|
|
440
|
+
// src/create-app.ts
|
|
441
|
+
async function create(options) {
|
|
442
|
+
const projectName = path.basename(options.outputDir);
|
|
443
|
+
const dest = path.resolve(cwd, options.outputDir);
|
|
444
|
+
await copy(path.join(sourceDir, `template/${options.template}`), dest);
|
|
445
|
+
await copy(path.join(sourceDir, `template/+content`), dest, (name) => {
|
|
446
|
+
switch (name) {
|
|
447
|
+
case "example.gitignore":
|
|
448
|
+
return ".gitignore";
|
|
449
|
+
default:
|
|
450
|
+
return name;
|
|
451
|
+
}
|
|
452
|
+
});
|
|
453
|
+
if (options.tailwindcss) {
|
|
454
|
+
await copy(path.join(sourceDir, `template/+tailwindcss`), dest);
|
|
455
|
+
}
|
|
456
|
+
const packageJson = createPackageJson(projectName, options);
|
|
457
|
+
await fs.writeFile(path.join(dest, "package.json"), packageJson);
|
|
458
|
+
const readMe = await getReadme(dest, projectName);
|
|
459
|
+
await fs.writeFile(path.join(dest, "README.md"), readMe);
|
|
460
|
+
if (options.installDeps) {
|
|
461
|
+
await autoInstall(options.packageManager, dest);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
async function getReadme(dest, projectName) {
|
|
465
|
+
const template = await fs.readFile(path.join(dest, "README.md")).then((res) => res.toString());
|
|
466
|
+
return `# ${projectName}
|
|
467
|
+
|
|
468
|
+
${template}`;
|
|
469
|
+
}
|
|
470
|
+
async function copy(from, to, rename = (s) => s) {
|
|
471
|
+
const stats = await fs.stat(from);
|
|
472
|
+
if (stats.isDirectory()) {
|
|
473
|
+
const files = await fs.readdir(from);
|
|
474
|
+
await Promise.all(
|
|
475
|
+
files.map(
|
|
476
|
+
(file) => copy(path.join(from, file), path.join(to, rename(file)))
|
|
477
|
+
)
|
|
478
|
+
);
|
|
479
|
+
} else {
|
|
480
|
+
await fs.mkdir(path.dirname(to), { recursive: true });
|
|
481
|
+
await fs.copyFile(from, to);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
function createPackageJson(projectName, { template, tailwindcss }) {
|
|
485
|
+
const packageJson = {
|
|
486
|
+
name: projectName,
|
|
487
|
+
version: "0.0.0",
|
|
488
|
+
private: true,
|
|
489
|
+
scripts: {
|
|
490
|
+
build: "next build",
|
|
491
|
+
dev: "next dev",
|
|
492
|
+
start: "next start"
|
|
493
|
+
},
|
|
494
|
+
dependencies: {
|
|
495
|
+
next: "14.0.4",
|
|
496
|
+
"fumadocs-ui": package_default2.version,
|
|
497
|
+
"fumadocs-core": package_default.version,
|
|
498
|
+
react: "18.2.0",
|
|
499
|
+
"react-dom": "18.2.0"
|
|
500
|
+
},
|
|
501
|
+
devDependencies: {
|
|
502
|
+
"@types/react": "18.2.0",
|
|
503
|
+
"@types/react-dom": "18.2.1",
|
|
504
|
+
typescript: "5.3.3"
|
|
505
|
+
}
|
|
506
|
+
};
|
|
507
|
+
if (template === "contentlayer") {
|
|
508
|
+
Object.assign(packageJson.dependencies, {
|
|
509
|
+
"fuamdocs-contentlayer": package_default4.version,
|
|
510
|
+
contentlayer: "0.3.4",
|
|
511
|
+
"next-contentlayer": "0.3.4"
|
|
512
|
+
});
|
|
513
|
+
Object.assign(packageJson, {
|
|
514
|
+
overrides: {
|
|
515
|
+
unified: "^11.0.4",
|
|
516
|
+
"mdx-bundler": "^10.0.1"
|
|
517
|
+
}
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
if (template === "fuma-docs-mdx") {
|
|
521
|
+
Object.assign(packageJson.dependencies, {
|
|
522
|
+
"fumadocs-mdx": package_default3.version
|
|
523
|
+
});
|
|
524
|
+
Object.assign(packageJson.devDependencies, {
|
|
525
|
+
"@types/mdx": "2.0.10"
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
if (tailwindcss) {
|
|
529
|
+
Object.assign(packageJson.devDependencies, {
|
|
530
|
+
autoprefixer: "10.4.16",
|
|
531
|
+
postcss: "8.4.32",
|
|
532
|
+
tailwindcss: "3.4.1"
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
return JSON.stringify(packageJson, void 0, 2);
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
export {
|
|
539
|
+
getPackageManager,
|
|
540
|
+
cwd,
|
|
541
|
+
create
|
|
542
|
+
};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
create,
|
|
4
|
+
cwd,
|
|
5
|
+
getPackageManager
|
|
6
|
+
} from "./chunk-QD4OISDK.js";
|
|
7
|
+
|
|
8
|
+
// src/index.ts
|
|
9
|
+
import { existsSync } from "node:fs";
|
|
10
|
+
import fs from "node:fs/promises";
|
|
11
|
+
import path from "node:path";
|
|
12
|
+
import {
|
|
13
|
+
cancel,
|
|
14
|
+
confirm,
|
|
15
|
+
group,
|
|
16
|
+
intro,
|
|
17
|
+
isCancel,
|
|
18
|
+
outro,
|
|
19
|
+
select,
|
|
20
|
+
spinner,
|
|
21
|
+
text
|
|
22
|
+
} from "@clack/prompts";
|
|
23
|
+
import pc from "picocolors";
|
|
24
|
+
var manager = getPackageManager();
|
|
25
|
+
async function main() {
|
|
26
|
+
intro(pc.bgCyan(pc.bold("Create Fumadocs App")));
|
|
27
|
+
const options = await group(
|
|
28
|
+
{
|
|
29
|
+
name: () => text({
|
|
30
|
+
message: "Project name",
|
|
31
|
+
placeholder: "my-app",
|
|
32
|
+
defaultValue: "my-app"
|
|
33
|
+
}),
|
|
34
|
+
template: () => select({
|
|
35
|
+
message: "Choose a content source",
|
|
36
|
+
initialValue: "fuma-docs-mdx",
|
|
37
|
+
options: [
|
|
38
|
+
{ value: "fuma-docs-mdx", label: "Fumadocs MDX" },
|
|
39
|
+
{ value: "contentlayer", label: "Contentlayer" }
|
|
40
|
+
]
|
|
41
|
+
}),
|
|
42
|
+
tailwindcss: () => confirm({ message: "Use Tailwind CSS for styling?" }),
|
|
43
|
+
installDeps: () => confirm({
|
|
44
|
+
message: `Do you want to install packages automatically? (detected as ${manager})`
|
|
45
|
+
})
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
onCancel: () => {
|
|
49
|
+
cancel("Installation Stopped.");
|
|
50
|
+
process.exit(0);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
const projectName = options.name.toLowerCase().replace(/\s/, "-");
|
|
55
|
+
const dest = path.resolve(cwd, projectName);
|
|
56
|
+
if (existsSync(dest)) {
|
|
57
|
+
const del = await confirm({
|
|
58
|
+
message: `${projectName} already exists, do you want to delete it?`
|
|
59
|
+
});
|
|
60
|
+
if (isCancel(del)) {
|
|
61
|
+
cancel();
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
if (del) {
|
|
65
|
+
const info2 = spinner();
|
|
66
|
+
info2.start(`Deleting ${projectName}`);
|
|
67
|
+
await fs.rm(dest, {
|
|
68
|
+
recursive: true,
|
|
69
|
+
force: true
|
|
70
|
+
});
|
|
71
|
+
info2.stop(`Deleted ${projectName}`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
const info = spinner();
|
|
75
|
+
info.start(`Generating Project`);
|
|
76
|
+
await create({
|
|
77
|
+
packageManager: manager,
|
|
78
|
+
tailwindcss: options.tailwindcss,
|
|
79
|
+
template: options.template,
|
|
80
|
+
outputDir: dest,
|
|
81
|
+
installDeps: options.installDeps
|
|
82
|
+
});
|
|
83
|
+
info.stop("Project Generated");
|
|
84
|
+
outro(pc.bgGreen(pc.bold("Done")));
|
|
85
|
+
if (options.tailwindcss) {
|
|
86
|
+
console.log("\u2714 Tailwind CSS");
|
|
87
|
+
}
|
|
88
|
+
console.log("\u2714 Typescript");
|
|
89
|
+
console.log(pc.bold("\nOpen the project"));
|
|
90
|
+
console.log(pc.cyan(`cd ${projectName}`));
|
|
91
|
+
console.log(pc.bold("\nRun Development Server"));
|
|
92
|
+
console.log(pc.cyan("npm run dev | pnpm run dev | yarn dev"));
|
|
93
|
+
console.log(
|
|
94
|
+
pc.bold("\nYou can now open the project and start writing documents")
|
|
95
|
+
);
|
|
96
|
+
process.exit(0);
|
|
97
|
+
}
|
|
98
|
+
main().catch((e) => {
|
|
99
|
+
console.error(e);
|
|
100
|
+
throw e;
|
|
101
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-fumadocs-app",
|
|
3
|
+
"version": "8.0.0",
|
|
4
|
+
"description": "Create a new documentation site with Fumadocs",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"NextJs",
|
|
7
|
+
"next",
|
|
8
|
+
"react",
|
|
9
|
+
"Docs"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://fumadocs.vercel.app",
|
|
12
|
+
"repository": "github:fuma-nama/next-docs",
|
|
13
|
+
"license": "MIT",
|
|
14
|
+
"author": "Fuma Nama",
|
|
15
|
+
"type": "module",
|
|
16
|
+
"bin": "./dist/index.js",
|
|
17
|
+
"files": [
|
|
18
|
+
"template/*",
|
|
19
|
+
"dist/*"
|
|
20
|
+
],
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"@clack/prompts": "^0.7.0",
|
|
23
|
+
"cross-spawn": "^7.0.3",
|
|
24
|
+
"picocolors": "^1.0.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@types/cross-spawn": "^6.0.4",
|
|
28
|
+
"@types/node": "18.17.5",
|
|
29
|
+
"fast-glob": "^3.3.1",
|
|
30
|
+
"eslint-config-custom": "0.0.0",
|
|
31
|
+
"tsconfig": "0.0.0"
|
|
32
|
+
},
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=18.17.0"
|
|
35
|
+
},
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"build": "tsup",
|
|
41
|
+
"clean": "rimraf dist",
|
|
42
|
+
"dev": "tsup --watch",
|
|
43
|
+
"lint": "eslint .",
|
|
44
|
+
"types:check": "tsc --noEmit"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
This is a Next.js application generated with
|
|
2
|
+
[Create Fumadocs](https://github.com/fuma-nama/next-docs).
|
|
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
|
+
## Learn More
|
|
17
|
+
|
|
18
|
+
To learn more about Next.js and Fumadocs, take a look at the following
|
|
19
|
+
resources:
|
|
20
|
+
|
|
21
|
+
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js
|
|
22
|
+
features and API.
|
|
23
|
+
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
|
|
24
|
+
- [Fumadocs](https://fumadocs.vercel.app) - learn about Fumadocs
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Hello World
|
|
3
|
+
description: Your first document
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Welcome to the docs! You can start writing documents in `/content/docs`.
|
|
7
|
+
|
|
8
|
+
## What is Next?
|
|
9
|
+
|
|
10
|
+
<Cards>
|
|
11
|
+
<Card title="Learn more about Next.js" href="https://nextjs.org/docs" />
|
|
12
|
+
<Card title="Learn more about Fumadocs" href="https://fumadocs.vercel.app" />
|
|
13
|
+
</Cards>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Components
|
|
3
|
+
description: Components
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Code Block
|
|
7
|
+
|
|
8
|
+
```js
|
|
9
|
+
console.log('Hello World');
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Cards
|
|
13
|
+
|
|
14
|
+
<Cards>
|
|
15
|
+
<Card title="Learn more about Next.js" href="https://nextjs.org/docs" />
|
|
16
|
+
<Card title="Learn more about Fumadocs" href="https://fumadocs.vercel.app" />
|
|
17
|
+
</Cards>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# deps
|
|
2
|
+
/node_modules
|
|
3
|
+
|
|
4
|
+
# generated content
|
|
5
|
+
.map.ts
|
|
6
|
+
.contentlayer
|
|
7
|
+
|
|
8
|
+
# test & build
|
|
9
|
+
/coverage
|
|
10
|
+
/.next/
|
|
11
|
+
/out/
|
|
12
|
+
/build
|
|
13
|
+
*.tsbuildinfo
|
|
14
|
+
|
|
15
|
+
# misc
|
|
16
|
+
.DS_Store
|
|
17
|
+
*.pem
|
|
18
|
+
/.pnp
|
|
19
|
+
.pnp.js
|
|
20
|
+
npm-debug.log*
|
|
21
|
+
yarn-debug.log*
|
|
22
|
+
yarn-error.log*
|
|
23
|
+
|
|
24
|
+
# others
|
|
25
|
+
.env*.local
|
|
26
|
+
.vercel
|
|
27
|
+
next-env.d.ts
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import './global.css';
|
|
2
|
+
import { RootProvider } from 'fumadocs-ui/provider';
|
|
3
|
+
import { Inter } from 'next/font/google';
|
|
4
|
+
import type { ReactNode } from 'react';
|
|
5
|
+
|
|
6
|
+
const inter = Inter({
|
|
7
|
+
subsets: ['latin'],
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export default function Layout({ children }: { children: ReactNode }) {
|
|
11
|
+
return (
|
|
12
|
+
<html lang="en" className={inter.className}>
|
|
13
|
+
<body>
|
|
14
|
+
<RootProvider>{children}</RootProvider>
|
|
15
|
+
</body>
|
|
16
|
+
</html>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import Link from 'next/link';
|
|
2
|
+
|
|
3
|
+
export default function HomePage() {
|
|
4
|
+
return (
|
|
5
|
+
<main className="flex h-screen flex-col justify-center text-center">
|
|
6
|
+
<h1 className="mb-4 text-2xl font-bold">Hello World</h1>
|
|
7
|
+
<p className="text-muted-foreground">
|
|
8
|
+
You can open{' '}
|
|
9
|
+
<Link href="/docs" className="text-foreground font-semibold underline">
|
|
10
|
+
/docs
|
|
11
|
+
</Link>{' '}
|
|
12
|
+
and see the documentation.
|
|
13
|
+
</p>
|
|
14
|
+
</main>
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const { createPreset } = require('fumadocs-ui/tailwind-plugin');
|
|
2
|
+
|
|
3
|
+
/** @type {import('tailwindcss').Config} */
|
|
4
|
+
module.exports = {
|
|
5
|
+
content: [
|
|
6
|
+
'./components/**/*.{ts,tsx}',
|
|
7
|
+
'./app/**/*.{ts,tsx}',
|
|
8
|
+
'./content/**/*.{md,mdx}',
|
|
9
|
+
'./mdx-components.{ts,tsx}',
|
|
10
|
+
'./node_modules/fumadocs-ui/dist/**/*.js',
|
|
11
|
+
],
|
|
12
|
+
presets: [createPreset()],
|
|
13
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { getPages } from '@/app/source';
|
|
2
|
+
import { createSearchAPI } from 'fumadocs-core/search/server';
|
|
3
|
+
|
|
4
|
+
export const { GET } = createSearchAPI('advanced', {
|
|
5
|
+
indexes: getPages().map((page) => ({
|
|
6
|
+
id: page.data._id,
|
|
7
|
+
title: page.data.title,
|
|
8
|
+
url: page.url,
|
|
9
|
+
structuredData: page.data.structuredData,
|
|
10
|
+
})),
|
|
11
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useMDXComponent } from 'next-contentlayer/hooks';
|
|
4
|
+
import defaultComponents from 'fumadocs-ui/mdx';
|
|
5
|
+
|
|
6
|
+
const components = {
|
|
7
|
+
...defaultComponents,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export function Content({ code }: { code: string }) {
|
|
11
|
+
const MDX = useMDXComponent(code);
|
|
12
|
+
|
|
13
|
+
return <MDX components={components} />;
|
|
14
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Content } from './content';
|
|
2
|
+
import { getPage, getPages } from '@/app/source';
|
|
3
|
+
import type { Metadata } from 'next';
|
|
4
|
+
import { DocsPage, DocsBody } from 'fumadocs-ui/page';
|
|
5
|
+
import { notFound } from 'next/navigation';
|
|
6
|
+
|
|
7
|
+
export default async function Page({
|
|
8
|
+
params,
|
|
9
|
+
}: {
|
|
10
|
+
params: { slug?: string[] };
|
|
11
|
+
}) {
|
|
12
|
+
const page = getPage(params.slug);
|
|
13
|
+
|
|
14
|
+
if (page == null) {
|
|
15
|
+
notFound();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<DocsPage toc={page.data.toc}>
|
|
20
|
+
<DocsBody>
|
|
21
|
+
<h1>{page.data.title}</h1>
|
|
22
|
+
<Content code={page.data.body.code} />
|
|
23
|
+
</DocsBody>
|
|
24
|
+
</DocsPage>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export async function generateStaticParams(): Promise<{ slug: string[] }[]> {
|
|
29
|
+
return getPages().map((page) => ({
|
|
30
|
+
slug: page.slugs,
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function generateMetadata({ params }: { params: { slug?: string[] } }) {
|
|
35
|
+
const page = getPage(params.slug);
|
|
36
|
+
|
|
37
|
+
if (page == null) notFound();
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
title: page.data.title,
|
|
41
|
+
description: page.data.description,
|
|
42
|
+
} satisfies Metadata;
|
|
43
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { pageTree } from '../source';
|
|
2
|
+
import { DocsLayout } from 'fumadocs-ui/layout';
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
export default function RootDocsLayout({ children }: { children: ReactNode }) {
|
|
6
|
+
return (
|
|
7
|
+
<DocsLayout tree={pageTree} nav={{ title: 'My App' }}>
|
|
8
|
+
{children}
|
|
9
|
+
</DocsLayout>
|
|
10
|
+
);
|
|
11
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { RootProvider } from 'fumadocs-ui/provider';
|
|
2
|
+
import 'fumadocs-ui/style.css';
|
|
3
|
+
import { Inter } from 'next/font/google';
|
|
4
|
+
import type { ReactNode } from 'react';
|
|
5
|
+
|
|
6
|
+
const inter = Inter({
|
|
7
|
+
subsets: ['latin'],
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export default function Layout({ children }: { children: ReactNode }) {
|
|
11
|
+
return (
|
|
12
|
+
<html lang="en" className={inter.className}>
|
|
13
|
+
<body>
|
|
14
|
+
<RootProvider>{children}</RootProvider>
|
|
15
|
+
</body>
|
|
16
|
+
</html>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import Link from 'next/link';
|
|
2
|
+
|
|
3
|
+
export default function HomePage() {
|
|
4
|
+
return (
|
|
5
|
+
<main
|
|
6
|
+
style={{
|
|
7
|
+
height: '100vh',
|
|
8
|
+
display: 'flex',
|
|
9
|
+
flexDirection: 'column',
|
|
10
|
+
textAlign: 'center',
|
|
11
|
+
justifyContent: 'center',
|
|
12
|
+
}}
|
|
13
|
+
>
|
|
14
|
+
<h1
|
|
15
|
+
style={{
|
|
16
|
+
fontSize: '2rem',
|
|
17
|
+
fontWeight: 'bold',
|
|
18
|
+
marginBottom: '1rem',
|
|
19
|
+
}}
|
|
20
|
+
>
|
|
21
|
+
Hello World
|
|
22
|
+
</h1>
|
|
23
|
+
<p>
|
|
24
|
+
You can open{' '}
|
|
25
|
+
<Link
|
|
26
|
+
href="/docs"
|
|
27
|
+
style={{
|
|
28
|
+
fontWeight: '600',
|
|
29
|
+
textDecoration: 'underline',
|
|
30
|
+
}}
|
|
31
|
+
>
|
|
32
|
+
/docs
|
|
33
|
+
</Link>{' '}
|
|
34
|
+
and see the documentation.
|
|
35
|
+
</p>
|
|
36
|
+
</main>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { allDocs, allMeta } from 'contentlayer/generated';
|
|
2
|
+
import { createContentlayerSource } from 'fumadocs-contentlayer';
|
|
3
|
+
import { loader } from 'fumadocs-core/source';
|
|
4
|
+
|
|
5
|
+
export const { getPage, pageTree, getPages } = loader({
|
|
6
|
+
baseUrl: '/docs',
|
|
7
|
+
rootDir: 'docs',
|
|
8
|
+
source: createContentlayerSource(allMeta, allDocs),
|
|
9
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
"contentlayer/generated": ["./.contentlayer/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
|
+
".contentlayer/generated"
|
|
33
|
+
],
|
|
34
|
+
"exclude": ["node_modules"]
|
|
35
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { getPages } from '@/app/source';
|
|
2
|
+
import { createSearchAPI } from 'fumadocs-core/search/server';
|
|
3
|
+
|
|
4
|
+
export const { GET } = createSearchAPI('advanced', {
|
|
5
|
+
indexes: getPages().map((page) => ({
|
|
6
|
+
title: page.data.title,
|
|
7
|
+
structuredData: page.data.exports.structuredData,
|
|
8
|
+
id: page.url,
|
|
9
|
+
url: page.url,
|
|
10
|
+
})),
|
|
11
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { getPage, getPages } from '@/app/source';
|
|
2
|
+
import type { Metadata } from 'next';
|
|
3
|
+
import { DocsPage, DocsBody } from 'fumadocs-ui/page';
|
|
4
|
+
import { notFound } from 'next/navigation';
|
|
5
|
+
|
|
6
|
+
export default async function Page({
|
|
7
|
+
params,
|
|
8
|
+
}: {
|
|
9
|
+
params: { slug?: string[] };
|
|
10
|
+
}) {
|
|
11
|
+
const page = getPage(params.slug);
|
|
12
|
+
|
|
13
|
+
if (page == null) {
|
|
14
|
+
notFound();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const MDX = page.data.exports.default;
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<DocsPage toc={page.data.exports.toc}>
|
|
21
|
+
<DocsBody>
|
|
22
|
+
<h1>{page.data.title}</h1>
|
|
23
|
+
<MDX />
|
|
24
|
+
</DocsBody>
|
|
25
|
+
</DocsPage>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export async function generateStaticParams() {
|
|
30
|
+
return getPages().map((page) => ({
|
|
31
|
+
slug: page.slugs,
|
|
32
|
+
}));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function generateMetadata({ params }: { params: { slug?: string[] } }) {
|
|
36
|
+
const page = getPage(params.slug);
|
|
37
|
+
|
|
38
|
+
if (page == null) notFound();
|
|
39
|
+
|
|
40
|
+
return {
|
|
41
|
+
title: page.data.title,
|
|
42
|
+
description: page.data.description,
|
|
43
|
+
} satisfies Metadata;
|
|
44
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { pageTree } from '../source';
|
|
2
|
+
import { DocsLayout } from 'fumadocs-ui/layout';
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
|
+
|
|
5
|
+
export default function RootDocsLayout({ children }: { children: ReactNode }) {
|
|
6
|
+
return (
|
|
7
|
+
<DocsLayout tree={pageTree} nav={{ title: 'My App' }}>
|
|
8
|
+
{children}
|
|
9
|
+
</DocsLayout>
|
|
10
|
+
);
|
|
11
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { RootProvider } from 'fumadocs-ui/provider';
|
|
2
|
+
import 'fumadocs-ui/style.css';
|
|
3
|
+
import { Inter } from 'next/font/google';
|
|
4
|
+
import type { ReactNode } from 'react';
|
|
5
|
+
|
|
6
|
+
const inter = Inter({
|
|
7
|
+
subsets: ['latin'],
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
export default function Layout({ children }: { children: ReactNode }) {
|
|
11
|
+
return (
|
|
12
|
+
<html lang="en" className={inter.className}>
|
|
13
|
+
<body>
|
|
14
|
+
<RootProvider>{children}</RootProvider>
|
|
15
|
+
</body>
|
|
16
|
+
</html>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import Link from 'next/link';
|
|
2
|
+
|
|
3
|
+
export default function HomePage() {
|
|
4
|
+
return (
|
|
5
|
+
<main
|
|
6
|
+
style={{
|
|
7
|
+
height: '100vh',
|
|
8
|
+
display: 'flex',
|
|
9
|
+
flexDirection: 'column',
|
|
10
|
+
textAlign: 'center',
|
|
11
|
+
justifyContent: 'center',
|
|
12
|
+
}}
|
|
13
|
+
>
|
|
14
|
+
<h1
|
|
15
|
+
style={{
|
|
16
|
+
fontSize: '2rem',
|
|
17
|
+
fontWeight: 'bold',
|
|
18
|
+
marginBottom: '1rem',
|
|
19
|
+
}}
|
|
20
|
+
>
|
|
21
|
+
Hello World
|
|
22
|
+
</h1>
|
|
23
|
+
<p>
|
|
24
|
+
You can open{' '}
|
|
25
|
+
<Link
|
|
26
|
+
href="/docs"
|
|
27
|
+
style={{
|
|
28
|
+
fontWeight: '600',
|
|
29
|
+
textDecoration: 'underline',
|
|
30
|
+
}}
|
|
31
|
+
>
|
|
32
|
+
/docs
|
|
33
|
+
</Link>{' '}
|
|
34
|
+
and see the documentation.
|
|
35
|
+
</p>
|
|
36
|
+
</main>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { map } from '@/.map';
|
|
2
|
+
import { createMDXSource } from 'fumadocs-mdx';
|
|
3
|
+
import { loader } from 'fumadocs-core/source';
|
|
4
|
+
|
|
5
|
+
export const { getPage, getPages, pageTree } = loader({
|
|
6
|
+
baseUrl: '/docs',
|
|
7
|
+
rootDir: 'docs',
|
|
8
|
+
source: createMDXSource(map),
|
|
9
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"baseUrl": ".",
|
|
4
|
+
"target": "ESNext",
|
|
5
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
6
|
+
"allowJs": true,
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
"strict": true,
|
|
9
|
+
"forceConsistentCasingInFileNames": true,
|
|
10
|
+
"noEmit": true,
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"module": "esnext",
|
|
13
|
+
"moduleResolution": "node",
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"isolatedModules": true,
|
|
16
|
+
"jsx": "preserve",
|
|
17
|
+
"incremental": true,
|
|
18
|
+
"paths": {
|
|
19
|
+
"@/*": ["./*"]
|
|
20
|
+
},
|
|
21
|
+
"plugins": [
|
|
22
|
+
{
|
|
23
|
+
"name": "next"
|
|
24
|
+
}
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
|
28
|
+
"exclude": ["node_modules"]
|
|
29
|
+
}
|