create-fumadocs-app 10.0.2 → 10.0.4
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-Q2SBE3ZN.js +176 -0
- package/dist/create-app.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-JCKPUWTI.js +0 -578
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
// src/create-app.ts
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import fs from "node:fs/promises";
|
|
4
|
+
|
|
5
|
+
// ../create-app-versions/package.json
|
|
6
|
+
var package_default = {
|
|
7
|
+
name: "example-versions",
|
|
8
|
+
version: "0.0.0",
|
|
9
|
+
private: true,
|
|
10
|
+
description: "Used to track dependency versions in create-fumadocs-app",
|
|
11
|
+
license: "MIT",
|
|
12
|
+
dependencies: {
|
|
13
|
+
"@types/mdx": "^2.0.11",
|
|
14
|
+
"@types/react": "^18.2.0",
|
|
15
|
+
"@types/react-dom": "^18.2.1",
|
|
16
|
+
autoprefixer: "^10.4.16",
|
|
17
|
+
contentlayer: "^0.3.4",
|
|
18
|
+
"fumadocs-contentlayer": "^1.1.5",
|
|
19
|
+
"fumadocs-core": "^10.0.4",
|
|
20
|
+
"fumadocs-mdx": "^8.2.3",
|
|
21
|
+
"fumadocs-ui": "^10.0.4",
|
|
22
|
+
next: "^14.1.2",
|
|
23
|
+
"next-contentlayer": "^0.3.4",
|
|
24
|
+
postcss: "^8.4.32",
|
|
25
|
+
react: "^18.2.0",
|
|
26
|
+
"react-dom": "^18.2.0",
|
|
27
|
+
tailwindcss: "^3.4.1",
|
|
28
|
+
typescript: "^5.4.2"
|
|
29
|
+
},
|
|
30
|
+
overrides: {
|
|
31
|
+
unified: "^11.0.4",
|
|
32
|
+
"mdx-bundler": "^10.0.1"
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
// src/auto-install.ts
|
|
37
|
+
import { spawn } from "cross-spawn";
|
|
38
|
+
function getPackageManager() {
|
|
39
|
+
const userAgent = process.env.npm_config_user_agent ?? "";
|
|
40
|
+
if (userAgent.startsWith("yarn")) {
|
|
41
|
+
return "yarn";
|
|
42
|
+
}
|
|
43
|
+
if (userAgent.startsWith("pnpm")) {
|
|
44
|
+
return "pnpm";
|
|
45
|
+
}
|
|
46
|
+
if (userAgent.startsWith("bun")) {
|
|
47
|
+
return "bun";
|
|
48
|
+
}
|
|
49
|
+
return "npm";
|
|
50
|
+
}
|
|
51
|
+
function autoInstall(manager, dest) {
|
|
52
|
+
return new Promise((res, reject) => {
|
|
53
|
+
const installProcess = spawn(manager, ["install"], {
|
|
54
|
+
stdio: "inherit",
|
|
55
|
+
env: {
|
|
56
|
+
...process.env,
|
|
57
|
+
NODE_ENV: "development",
|
|
58
|
+
DISABLE_OPENCOLLECTIVE: "1"
|
|
59
|
+
},
|
|
60
|
+
cwd: dest
|
|
61
|
+
});
|
|
62
|
+
installProcess.on("close", (code) => {
|
|
63
|
+
if (code !== 0) {
|
|
64
|
+
reject(new Error("Install failed"));
|
|
65
|
+
} else {
|
|
66
|
+
res();
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// src/constants.ts
|
|
73
|
+
import { fileURLToPath } from "node:url";
|
|
74
|
+
var sourceDir = fileURLToPath(new URL(`../`, import.meta.url).href);
|
|
75
|
+
var cwd = process.cwd();
|
|
76
|
+
|
|
77
|
+
// src/create-app.ts
|
|
78
|
+
async function create(options) {
|
|
79
|
+
const projectName = path.basename(options.outputDir);
|
|
80
|
+
const dest = path.resolve(cwd, options.outputDir);
|
|
81
|
+
await copy(path.join(sourceDir, `template/${options.template}`), dest);
|
|
82
|
+
await copy(path.join(sourceDir, `template/+content`), dest, (name) => {
|
|
83
|
+
switch (name) {
|
|
84
|
+
case "example.gitignore":
|
|
85
|
+
return ".gitignore";
|
|
86
|
+
default:
|
|
87
|
+
return name;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
if (options.tailwindcss) {
|
|
91
|
+
await copy(path.join(sourceDir, `template/+tailwindcss`), dest);
|
|
92
|
+
}
|
|
93
|
+
const packageJson = createPackageJson(projectName, options);
|
|
94
|
+
await fs.writeFile(path.join(dest, "package.json"), packageJson);
|
|
95
|
+
const readMe = await getReadme(dest, projectName);
|
|
96
|
+
await fs.writeFile(path.join(dest, "README.md"), readMe);
|
|
97
|
+
if (options.installDeps) {
|
|
98
|
+
await autoInstall(options.packageManager, dest);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
async function getReadme(dest, projectName) {
|
|
102
|
+
const template = await fs.readFile(path.join(dest, "README.md")).then((res) => res.toString());
|
|
103
|
+
return `# ${projectName}
|
|
104
|
+
|
|
105
|
+
${template}`;
|
|
106
|
+
}
|
|
107
|
+
async function copy(from, to, rename = (s) => s) {
|
|
108
|
+
const stats = await fs.stat(from);
|
|
109
|
+
if (stats.isDirectory()) {
|
|
110
|
+
const files = await fs.readdir(from);
|
|
111
|
+
await Promise.all(
|
|
112
|
+
files.map(
|
|
113
|
+
(file) => copy(path.join(from, file), path.join(to, rename(file)))
|
|
114
|
+
)
|
|
115
|
+
);
|
|
116
|
+
} else {
|
|
117
|
+
await fs.mkdir(path.dirname(to), { recursive: true });
|
|
118
|
+
await fs.copyFile(from, to);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function createPackageJson(projectName, { template, tailwindcss }) {
|
|
122
|
+
const packageJson = {
|
|
123
|
+
name: projectName,
|
|
124
|
+
version: "0.0.0",
|
|
125
|
+
private: true,
|
|
126
|
+
scripts: {
|
|
127
|
+
build: "next build",
|
|
128
|
+
dev: "next dev",
|
|
129
|
+
start: "next start"
|
|
130
|
+
},
|
|
131
|
+
dependencies: {
|
|
132
|
+
next: package_default.dependencies.next,
|
|
133
|
+
"fumadocs-ui": package_default.dependencies["fumadocs-ui"],
|
|
134
|
+
"fumadocs-core": package_default.dependencies["fumadocs-core"],
|
|
135
|
+
react: package_default.dependencies.react,
|
|
136
|
+
"react-dom": package_default.dependencies["react-dom"]
|
|
137
|
+
},
|
|
138
|
+
devDependencies: {
|
|
139
|
+
"@types/react": package_default.dependencies["@types/react"],
|
|
140
|
+
"@types/react-dom": package_default.dependencies["@types/react-dom"],
|
|
141
|
+
typescript: package_default.dependencies.typescript
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
if (template === "contentlayer") {
|
|
145
|
+
Object.assign(packageJson.dependencies, {
|
|
146
|
+
"fumadocs-contentlayer": package_default.dependencies["fumadocs-contentlayer"],
|
|
147
|
+
contentlayer: package_default.dependencies.contentlayer,
|
|
148
|
+
"next-contentlayer": package_default.dependencies["next-contentlayer"]
|
|
149
|
+
});
|
|
150
|
+
Object.assign(packageJson, {
|
|
151
|
+
overrides: package_default.overrides
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
if (template === "fuma-docs-mdx") {
|
|
155
|
+
Object.assign(packageJson.dependencies, {
|
|
156
|
+
"fumadocs-mdx": package_default.dependencies["fumadocs-mdx"]
|
|
157
|
+
});
|
|
158
|
+
Object.assign(packageJson.devDependencies, {
|
|
159
|
+
"@types/mdx": package_default.dependencies["@types/mdx"]
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
if (tailwindcss) {
|
|
163
|
+
Object.assign(packageJson.devDependencies, {
|
|
164
|
+
autoprefixer: package_default.dependencies.autoprefixer,
|
|
165
|
+
postcss: package_default.dependencies.postcss,
|
|
166
|
+
tailwindcss: package_default.dependencies.tailwindcss
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
return JSON.stringify(packageJson, void 0, 2);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export {
|
|
173
|
+
getPackageManager,
|
|
174
|
+
cwd,
|
|
175
|
+
create
|
|
176
|
+
};
|
package/dist/create-app.js
CHANGED
package/dist/index.js
CHANGED
package/package.json
CHANGED
package/dist/chunk-JCKPUWTI.js
DELETED
|
@@ -1,578 +0,0 @@
|
|
|
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: "10.0.2",
|
|
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/fumadocs",
|
|
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
|
-
"types:check": "tsc --noEmit"
|
|
121
|
-
},
|
|
122
|
-
dependencies: {
|
|
123
|
-
"@formatjs/intl-localematcher": "^0.5.4",
|
|
124
|
-
"@shikijs/rehype": "^1.1.7",
|
|
125
|
-
"@shikijs/transformers": "^1.1.7",
|
|
126
|
-
flexsearch: "^0.7.43",
|
|
127
|
-
"github-slugger": "^2.0.0",
|
|
128
|
-
"hast-util-to-estree": "^3.1.0",
|
|
129
|
-
negotiator: "^0.6.3",
|
|
130
|
-
"react-remove-scroll": "^2.5.7",
|
|
131
|
-
remark: "^15.0.0",
|
|
132
|
-
"remark-gfm": "^4.0.0",
|
|
133
|
-
"remark-mdx": "^3.0.1",
|
|
134
|
-
"scroll-into-view-if-needed": "^3.1.0",
|
|
135
|
-
shiki: "^1.1.7",
|
|
136
|
-
swr: "^2.2.5",
|
|
137
|
-
"unist-util-visit": "^5.0.0"
|
|
138
|
-
},
|
|
139
|
-
devDependencies: {
|
|
140
|
-
"@algolia/client-search": "^4.22.1",
|
|
141
|
-
"@types/flexsearch": "0.7.6",
|
|
142
|
-
"@types/hast": "^3.0.4",
|
|
143
|
-
"@types/mdast": "^4.0.3",
|
|
144
|
-
"@types/negotiator": "^0.6.3",
|
|
145
|
-
"@types/node": "18.17.5",
|
|
146
|
-
"@types/react": "^18.2.0",
|
|
147
|
-
"@types/react-dom": "^18.2.1",
|
|
148
|
-
algoliasearch: "^4.22.1",
|
|
149
|
-
"eslint-config-custom": "workspace:*",
|
|
150
|
-
next: "^14.1.2",
|
|
151
|
-
tsconfig: "workspace:*",
|
|
152
|
-
unified: "^11.0.4"
|
|
153
|
-
},
|
|
154
|
-
peerDependencies: {
|
|
155
|
-
next: ">= 14.1.0",
|
|
156
|
-
react: ">= 18",
|
|
157
|
-
"react-dom": ">= 18"
|
|
158
|
-
},
|
|
159
|
-
publishConfig: {
|
|
160
|
-
access: "public"
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
// ../ui/package.json
|
|
165
|
-
var package_default2 = {
|
|
166
|
-
name: "fumadocs-ui",
|
|
167
|
-
version: "10.0.2",
|
|
168
|
-
description: "The framework for building a documentation website in Next.js",
|
|
169
|
-
keywords: [
|
|
170
|
-
"NextJs",
|
|
171
|
-
"Docs"
|
|
172
|
-
],
|
|
173
|
-
homepage: "https://fumadocs.vercel.app",
|
|
174
|
-
repository: "github:fuma-nama/fumadocs",
|
|
175
|
-
license: "MIT",
|
|
176
|
-
author: "Fuma Nama",
|
|
177
|
-
exports: {
|
|
178
|
-
"./style.css": "./dist/style.css",
|
|
179
|
-
"./twoslash.css": "./dist/twoslash.css",
|
|
180
|
-
"./image-zoom.css": "./dist/image-zoom.css",
|
|
181
|
-
"./tailwind-plugin": {
|
|
182
|
-
import: "./dist/tailwind-plugin.js",
|
|
183
|
-
require: "./dist/tailwind-plugin.js",
|
|
184
|
-
types: "./dist/tailwind-plugin.d.ts"
|
|
185
|
-
},
|
|
186
|
-
"./components/*": {
|
|
187
|
-
import: "./dist/components/*.js",
|
|
188
|
-
types: "./dist/components/*.d.mts"
|
|
189
|
-
},
|
|
190
|
-
"./twoslash/*": {
|
|
191
|
-
import: "./dist/twoslash/*.js",
|
|
192
|
-
types: "./dist/twoslash/*.d.mts"
|
|
193
|
-
},
|
|
194
|
-
"./i18n": {
|
|
195
|
-
import: "./dist/i18n.js",
|
|
196
|
-
types: "./dist/i18n.d.mts"
|
|
197
|
-
},
|
|
198
|
-
"./layout": {
|
|
199
|
-
import: "./dist/layout.js",
|
|
200
|
-
types: "./dist/layout.d.mts"
|
|
201
|
-
},
|
|
202
|
-
"./page": {
|
|
203
|
-
import: "./dist/page.js",
|
|
204
|
-
types: "./dist/page.d.mts"
|
|
205
|
-
},
|
|
206
|
-
"./provider": {
|
|
207
|
-
import: "./dist/provider.js",
|
|
208
|
-
types: "./dist/provider.d.mts"
|
|
209
|
-
},
|
|
210
|
-
"./mdx": {
|
|
211
|
-
import: "./dist/mdx.js",
|
|
212
|
-
types: "./dist/mdx.d.mts"
|
|
213
|
-
}
|
|
214
|
-
},
|
|
215
|
-
typesVersions: {
|
|
216
|
-
"*": {
|
|
217
|
-
"tailwind-plugin": [
|
|
218
|
-
"./dist/tailwind-plugin.d.ts"
|
|
219
|
-
],
|
|
220
|
-
"components/*": [
|
|
221
|
-
"./dist/components/*.d.mts"
|
|
222
|
-
],
|
|
223
|
-
"twoslash/*": [
|
|
224
|
-
"./dist/twoslash/*.d.mts"
|
|
225
|
-
],
|
|
226
|
-
i18n: [
|
|
227
|
-
"./dist/i18n.d.mts"
|
|
228
|
-
],
|
|
229
|
-
layout: [
|
|
230
|
-
"./dist/layout.d.mts"
|
|
231
|
-
],
|
|
232
|
-
page: [
|
|
233
|
-
"./dist/page.d.mts"
|
|
234
|
-
],
|
|
235
|
-
provider: [
|
|
236
|
-
"./dist/provider.d.mts"
|
|
237
|
-
],
|
|
238
|
-
mdx: [
|
|
239
|
-
"./dist/mdx.d.mts"
|
|
240
|
-
]
|
|
241
|
-
}
|
|
242
|
-
},
|
|
243
|
-
files: [
|
|
244
|
-
"dist/*"
|
|
245
|
-
],
|
|
246
|
-
scripts: {
|
|
247
|
-
build: "pnpm build:layout && pnpm build:tailwind",
|
|
248
|
-
"build:layout": "tsup",
|
|
249
|
-
"build:tailwind": "postcss css/*.css --dir dist",
|
|
250
|
-
clean: "rimraf dist",
|
|
251
|
-
dev: 'concurrently "pnpm dev:layout" "pnpm dev:tailwind"',
|
|
252
|
-
"dev:layout": "tsup --watch",
|
|
253
|
-
"dev:tailwind": "postcss css/*.css --dir dist --watch",
|
|
254
|
-
lint: "eslint .",
|
|
255
|
-
"types:check": "tsc --noEmit"
|
|
256
|
-
},
|
|
257
|
-
dependencies: {
|
|
258
|
-
"@radix-ui/react-accordion": "^1.1.2",
|
|
259
|
-
"@radix-ui/react-collapsible": "^1.0.3",
|
|
260
|
-
"@radix-ui/react-dialog": "^1.0.5",
|
|
261
|
-
"@radix-ui/react-hover-card": "^1.0.7",
|
|
262
|
-
"@radix-ui/react-popover": "^1.0.7",
|
|
263
|
-
"@radix-ui/react-scroll-area": "^1.0.5",
|
|
264
|
-
"@radix-ui/react-select": "^2.0.0",
|
|
265
|
-
"@radix-ui/react-tabs": "^1.0.4",
|
|
266
|
-
"@tailwindcss/typography": "^0.5.10",
|
|
267
|
-
"class-variance-authority": "^0.7.0",
|
|
268
|
-
clsx: "^2.1.0",
|
|
269
|
-
cmdk: "^0.2.1",
|
|
270
|
-
"fumadocs-core": "workspace:*",
|
|
271
|
-
"lucide-react": "^0.298.0",
|
|
272
|
-
"next-themes": "^0.2.1",
|
|
273
|
-
"react-medium-image-zoom": "^5.1.10",
|
|
274
|
-
"tailwind-merge": "^2.2.1",
|
|
275
|
-
tailwindcss: "^3.4.1"
|
|
276
|
-
},
|
|
277
|
-
devDependencies: {
|
|
278
|
-
"@algolia/client-search": "^4.22.1",
|
|
279
|
-
"@next/eslint-plugin-next": "^14.1.2",
|
|
280
|
-
"@types/react": "^18.2.0",
|
|
281
|
-
"@types/react-dom": "^18.2.1",
|
|
282
|
-
algoliasearch: "^4.22.1",
|
|
283
|
-
"eslint-config-custom": "workspace:*",
|
|
284
|
-
next: "^14.1.2",
|
|
285
|
-
postcss: "^8.4.35",
|
|
286
|
-
"postcss-cli": "^11.0.0",
|
|
287
|
-
"postcss-lightningcss": "^1.0.0",
|
|
288
|
-
tsconfig: "workspace:*"
|
|
289
|
-
},
|
|
290
|
-
peerDependencies: {
|
|
291
|
-
next: ">= 14.1.0",
|
|
292
|
-
react: ">= 18",
|
|
293
|
-
"react-dom": ">= 18"
|
|
294
|
-
},
|
|
295
|
-
publishConfig: {
|
|
296
|
-
access: "public"
|
|
297
|
-
}
|
|
298
|
-
};
|
|
299
|
-
|
|
300
|
-
// ../mdx/package.json
|
|
301
|
-
var package_default3 = {
|
|
302
|
-
name: "fumadocs-mdx",
|
|
303
|
-
version: "8.2.1",
|
|
304
|
-
description: "The built-in source for Fumadocs",
|
|
305
|
-
keywords: [
|
|
306
|
-
"NextJs",
|
|
307
|
-
"Docs"
|
|
308
|
-
],
|
|
309
|
-
homepage: "https://fumadocs.vercel.app",
|
|
310
|
-
repository: "github:fuma-nama/fumadocs",
|
|
311
|
-
license: "MIT",
|
|
312
|
-
author: "Fuma Nama",
|
|
313
|
-
exports: {
|
|
314
|
-
"./loader": "./loader.js",
|
|
315
|
-
"./loader-mdx": "./loader-mdx.js",
|
|
316
|
-
"./config": {
|
|
317
|
-
import: "./dist/config.mjs",
|
|
318
|
-
types: "./dist/config.d.mts"
|
|
319
|
-
},
|
|
320
|
-
".": {
|
|
321
|
-
import: "./dist/index.mjs",
|
|
322
|
-
types: "./dist/index.mts"
|
|
323
|
-
}
|
|
324
|
-
},
|
|
325
|
-
main: "./dist/index.mjs",
|
|
326
|
-
types: "./dist/index.mts",
|
|
327
|
-
typesVersions: {
|
|
328
|
-
"*": {
|
|
329
|
-
config: [
|
|
330
|
-
"./dist/config.d.mts"
|
|
331
|
-
]
|
|
332
|
-
}
|
|
333
|
-
},
|
|
334
|
-
files: [
|
|
335
|
-
"dist/*",
|
|
336
|
-
"loader-mdx.js",
|
|
337
|
-
"loader.js"
|
|
338
|
-
],
|
|
339
|
-
scripts: {
|
|
340
|
-
build: "tsup",
|
|
341
|
-
clean: "rimraf dist",
|
|
342
|
-
dev: "tsup --watch",
|
|
343
|
-
lint: "eslint .",
|
|
344
|
-
"types:check": "tsc --noEmit"
|
|
345
|
-
},
|
|
346
|
-
dependencies: {
|
|
347
|
-
"@mdx-js/mdx": "^3.0.1",
|
|
348
|
-
"cross-spawn": "^7.0.3",
|
|
349
|
-
"estree-util-value-to-estree": "^3.0.1",
|
|
350
|
-
"fast-glob": "^3.3.1",
|
|
351
|
-
"fumadocs-core": "workspace:*",
|
|
352
|
-
"gray-matter": "^4.0.3",
|
|
353
|
-
zod: "^3.22.4"
|
|
354
|
-
},
|
|
355
|
-
devDependencies: {
|
|
356
|
-
"@types/cross-spawn": "^6.0.6",
|
|
357
|
-
"@types/mdast": "^4.0.3",
|
|
358
|
-
"@types/mdx": "^2.0.11",
|
|
359
|
-
"@types/react": "^18.2.0",
|
|
360
|
-
"eslint-config-custom": "workspace:*",
|
|
361
|
-
next: "^14.1.2",
|
|
362
|
-
tsconfig: "workspace:*",
|
|
363
|
-
unified: "^11.0.4",
|
|
364
|
-
webpack: "^5.90.3"
|
|
365
|
-
},
|
|
366
|
-
peerDependencies: {
|
|
367
|
-
next: ">= 14.1.0"
|
|
368
|
-
},
|
|
369
|
-
publishConfig: {
|
|
370
|
-
access: "public"
|
|
371
|
-
}
|
|
372
|
-
};
|
|
373
|
-
|
|
374
|
-
// ../contentlayer/package.json
|
|
375
|
-
var package_default4 = {
|
|
376
|
-
name: "fumadocs-contentlayer",
|
|
377
|
-
version: "1.1.3",
|
|
378
|
-
description: "The Contentlayer adapter for Fumadocs",
|
|
379
|
-
keywords: [
|
|
380
|
-
"NextJs",
|
|
381
|
-
"Docs"
|
|
382
|
-
],
|
|
383
|
-
homepage: "https://fumadocs.vercel.app",
|
|
384
|
-
repository: "github:fuma-nama/fumadocs",
|
|
385
|
-
license: "MIT",
|
|
386
|
-
author: "Fuma Nama",
|
|
387
|
-
type: "module",
|
|
388
|
-
exports: {
|
|
389
|
-
".": {
|
|
390
|
-
import: "./dist/index.js",
|
|
391
|
-
types: "./dist/index.d.ts"
|
|
392
|
-
},
|
|
393
|
-
"./configuration": {
|
|
394
|
-
import: "./dist/configuration.js",
|
|
395
|
-
types: "./dist/configuration.d.ts"
|
|
396
|
-
}
|
|
397
|
-
},
|
|
398
|
-
main: "./dist/index.js",
|
|
399
|
-
types: "./dist/index.d.ts",
|
|
400
|
-
typesVersions: {
|
|
401
|
-
"*": {
|
|
402
|
-
".": [
|
|
403
|
-
"./dist/index.d.ts"
|
|
404
|
-
],
|
|
405
|
-
configuration: [
|
|
406
|
-
"./dist/configuration.d.ts"
|
|
407
|
-
]
|
|
408
|
-
}
|
|
409
|
-
},
|
|
410
|
-
files: [
|
|
411
|
-
"dist/*"
|
|
412
|
-
],
|
|
413
|
-
scripts: {
|
|
414
|
-
build: "tsup",
|
|
415
|
-
clean: "rimraf dist",
|
|
416
|
-
dev: "tsup --watch",
|
|
417
|
-
lint: "eslint .",
|
|
418
|
-
"types:check": "tsc --noEmit"
|
|
419
|
-
},
|
|
420
|
-
dependencies: {
|
|
421
|
-
"fumadocs-core": "workspace:*",
|
|
422
|
-
"rehype-img-size": "^1.0.1"
|
|
423
|
-
},
|
|
424
|
-
devDependencies: {
|
|
425
|
-
contentlayer: "^0.3.4",
|
|
426
|
-
"eslint-config-custom": "workspace:*",
|
|
427
|
-
tsconfig: "workspace:*",
|
|
428
|
-
unified: "^11.0.4"
|
|
429
|
-
},
|
|
430
|
-
publishConfig: {
|
|
431
|
-
access: "public"
|
|
432
|
-
}
|
|
433
|
-
};
|
|
434
|
-
|
|
435
|
-
// src/auto-install.ts
|
|
436
|
-
import { spawn } from "cross-spawn";
|
|
437
|
-
function getPackageManager() {
|
|
438
|
-
const userAgent = process.env.npm_config_user_agent ?? "";
|
|
439
|
-
if (userAgent.startsWith("yarn")) {
|
|
440
|
-
return "yarn";
|
|
441
|
-
}
|
|
442
|
-
if (userAgent.startsWith("pnpm")) {
|
|
443
|
-
return "pnpm";
|
|
444
|
-
}
|
|
445
|
-
if (userAgent.startsWith("bun")) {
|
|
446
|
-
return "bun";
|
|
447
|
-
}
|
|
448
|
-
return "npm";
|
|
449
|
-
}
|
|
450
|
-
function autoInstall(manager, dest) {
|
|
451
|
-
return new Promise((res, reject) => {
|
|
452
|
-
const installProcess = spawn(manager, ["install"], {
|
|
453
|
-
stdio: "inherit",
|
|
454
|
-
env: {
|
|
455
|
-
...process.env,
|
|
456
|
-
NODE_ENV: "development",
|
|
457
|
-
DISABLE_OPENCOLLECTIVE: "1"
|
|
458
|
-
},
|
|
459
|
-
cwd: dest
|
|
460
|
-
});
|
|
461
|
-
installProcess.on("close", (code) => {
|
|
462
|
-
if (code !== 0) {
|
|
463
|
-
reject(new Error("Install failed"));
|
|
464
|
-
} else {
|
|
465
|
-
res();
|
|
466
|
-
}
|
|
467
|
-
});
|
|
468
|
-
});
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
// src/constants.ts
|
|
472
|
-
import { fileURLToPath } from "node:url";
|
|
473
|
-
var sourceDir = fileURLToPath(new URL(`../`, import.meta.url).href);
|
|
474
|
-
var cwd = process.cwd();
|
|
475
|
-
|
|
476
|
-
// src/create-app.ts
|
|
477
|
-
async function create(options) {
|
|
478
|
-
const projectName = path.basename(options.outputDir);
|
|
479
|
-
const dest = path.resolve(cwd, options.outputDir);
|
|
480
|
-
await copy(path.join(sourceDir, `template/${options.template}`), dest);
|
|
481
|
-
await copy(path.join(sourceDir, `template/+content`), dest, (name) => {
|
|
482
|
-
switch (name) {
|
|
483
|
-
case "example.gitignore":
|
|
484
|
-
return ".gitignore";
|
|
485
|
-
default:
|
|
486
|
-
return name;
|
|
487
|
-
}
|
|
488
|
-
});
|
|
489
|
-
if (options.tailwindcss) {
|
|
490
|
-
await copy(path.join(sourceDir, `template/+tailwindcss`), dest);
|
|
491
|
-
}
|
|
492
|
-
const packageJson = createPackageJson(projectName, options);
|
|
493
|
-
await fs.writeFile(path.join(dest, "package.json"), packageJson);
|
|
494
|
-
const readMe = await getReadme(dest, projectName);
|
|
495
|
-
await fs.writeFile(path.join(dest, "README.md"), readMe);
|
|
496
|
-
if (options.installDeps) {
|
|
497
|
-
await autoInstall(options.packageManager, dest);
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
async function getReadme(dest, projectName) {
|
|
501
|
-
const template = await fs.readFile(path.join(dest, "README.md")).then((res) => res.toString());
|
|
502
|
-
return `# ${projectName}
|
|
503
|
-
|
|
504
|
-
${template}`;
|
|
505
|
-
}
|
|
506
|
-
async function copy(from, to, rename = (s) => s) {
|
|
507
|
-
const stats = await fs.stat(from);
|
|
508
|
-
if (stats.isDirectory()) {
|
|
509
|
-
const files = await fs.readdir(from);
|
|
510
|
-
await Promise.all(
|
|
511
|
-
files.map(
|
|
512
|
-
(file) => copy(path.join(from, file), path.join(to, rename(file)))
|
|
513
|
-
)
|
|
514
|
-
);
|
|
515
|
-
} else {
|
|
516
|
-
await fs.mkdir(path.dirname(to), { recursive: true });
|
|
517
|
-
await fs.copyFile(from, to);
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
function createPackageJson(projectName, { template, tailwindcss }) {
|
|
521
|
-
const packageJson = {
|
|
522
|
-
name: projectName,
|
|
523
|
-
version: "0.0.0",
|
|
524
|
-
private: true,
|
|
525
|
-
scripts: {
|
|
526
|
-
build: "next build",
|
|
527
|
-
dev: "next dev",
|
|
528
|
-
start: "next start"
|
|
529
|
-
},
|
|
530
|
-
dependencies: {
|
|
531
|
-
next: "14.0.4",
|
|
532
|
-
"fumadocs-ui": package_default2.version,
|
|
533
|
-
"fumadocs-core": package_default.version,
|
|
534
|
-
react: "18.2.0",
|
|
535
|
-
"react-dom": "18.2.0"
|
|
536
|
-
},
|
|
537
|
-
devDependencies: {
|
|
538
|
-
"@types/react": "18.2.0",
|
|
539
|
-
"@types/react-dom": "18.2.1",
|
|
540
|
-
typescript: "5.3.3"
|
|
541
|
-
}
|
|
542
|
-
};
|
|
543
|
-
if (template === "contentlayer") {
|
|
544
|
-
Object.assign(packageJson.dependencies, {
|
|
545
|
-
"fumadocs-contentlayer": package_default4.version,
|
|
546
|
-
contentlayer: "0.3.4",
|
|
547
|
-
"next-contentlayer": "0.3.4"
|
|
548
|
-
});
|
|
549
|
-
Object.assign(packageJson, {
|
|
550
|
-
overrides: {
|
|
551
|
-
unified: "^11.0.4",
|
|
552
|
-
"mdx-bundler": "^10.0.1"
|
|
553
|
-
}
|
|
554
|
-
});
|
|
555
|
-
}
|
|
556
|
-
if (template === "fuma-docs-mdx") {
|
|
557
|
-
Object.assign(packageJson.dependencies, {
|
|
558
|
-
"fumadocs-mdx": package_default3.version
|
|
559
|
-
});
|
|
560
|
-
Object.assign(packageJson.devDependencies, {
|
|
561
|
-
"@types/mdx": "2.0.10"
|
|
562
|
-
});
|
|
563
|
-
}
|
|
564
|
-
if (tailwindcss) {
|
|
565
|
-
Object.assign(packageJson.devDependencies, {
|
|
566
|
-
autoprefixer: "10.4.16",
|
|
567
|
-
postcss: "8.4.32",
|
|
568
|
-
tailwindcss: "3.4.1"
|
|
569
|
-
});
|
|
570
|
-
}
|
|
571
|
-
return JSON.stringify(packageJson, void 0, 2);
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
export {
|
|
575
|
-
getPackageManager,
|
|
576
|
-
cwd,
|
|
577
|
-
create
|
|
578
|
-
};
|