create-fumadocs-app 16.2.32 → 16.3.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/dist/bin.js CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import { n as getPackageManager, r as managers, t as create } from "./src-55Opr41I.js";
3
- import { i as templates, n as isCI } from "./constants-BXNeGyPA.js";
4
- import { t as feature } from "./feature-BSyhSuG1.js";
2
+ import { n as getPackageManager, r as managers, t as create } from "./src-CRg_0mOO.js";
3
+ import { i as templates, n as isCI } from "./constants-C2dUvnpd.js";
4
+ import { t as feature } from "./feature-CSPlEscc.js";
5
5
  import fs from "node:fs/promises";
6
6
  import path from "node:path";
7
7
  import { cancel, confirm, group, intro, isCancel, outro, select, spinner, text } from "@clack/prompts";
8
- import pc from "picocolors";
8
+ import { styleText } from "node:util";
9
9
  import { cac } from "cac";
10
10
  import { ai } from "@fumadocs/cli/features/ai";
11
11
  import { lint } from "@fumadocs/cli/features/lint";
@@ -47,7 +47,7 @@ async function main(defaultName, config) {
47
47
  checkOption("template", config.template, templateNames);
48
48
  checkOption("pm", config.pm, managers);
49
49
  const skipPrompts = isCI || config.yes === true;
50
- intro(pc.bgCyan(pc.bold("Create Fumadocs App")));
50
+ intro(styleText(["bgCyan", "bold"], "Create Fumadocs App"));
51
51
  const options = await group({
52
52
  name: async () => {
53
53
  if (defaultName) return defaultName;
@@ -208,10 +208,10 @@ async function main(defaultName, config) {
208
208
  } });
209
209
  const projectName = options.name.toLowerCase().replace(/\s/, "-");
210
210
  if (options.aiChat && isStatic(options.template)) {
211
- console.warn(pc.yellow("AI Chat needs a server, the template is static, skipping it."));
211
+ console.warn(styleText("yellow", "AI Chat needs a server, the template is static, skipping it."));
212
212
  options.aiChat = false;
213
213
  }
214
- if (options.ogImage === "next-og" && !options.template.startsWith("+next")) console.warn(pc.yellow("next/og is only available on Next.js, the template uses Takumi instead."));
214
+ if (options.ogImage === "next-og" && !options.template.startsWith("+next")) console.warn(styleText("yellow", "next/og is only available on Next.js, the template uses Takumi instead."));
215
215
  if (!isCI) await checkDir(projectName, skipPrompts);
216
216
  const info = spinner();
217
217
  info.start(`Generating Project`);
@@ -236,13 +236,13 @@ async function main(defaultName, config) {
236
236
  }
237
237
  });
238
238
  info.stop("Project Generated");
239
- outro(pc.bgGreen(pc.bold("Done")));
240
- console.log(pc.bold("\nOpen the project"));
241
- console.log(pc.cyan(`cd ${projectName}`));
242
- console.log(pc.bold("\nRun Development Server"));
243
- if (config.pm === "npm" || config.pm === "bun") console.log(pc.cyan(`${config.pm} run dev`));
244
- else console.log(pc.cyan(`${config.pm} dev`));
245
- console.log(pc.bold("\nYou can now open the project and start writing documents"));
239
+ outro(styleText(["bgGreen", "bold"], "Done"));
240
+ console.log(styleText("bold", "\nOpen the project"));
241
+ console.log(styleText("cyan", `cd ${projectName}`));
242
+ console.log(styleText("bold", "\nRun Development Server"));
243
+ if (config.pm === "npm" || config.pm === "bun") console.log(styleText("cyan", `${config.pm} run dev`));
244
+ else console.log(styleText("cyan", `${config.pm} dev`));
245
+ console.log(styleText("bold", "\nYou can now open the project and start writing documents"));
246
246
  process.exit(0);
247
247
  }
248
248
  async function checkDir(outputDir, skipPrompts) {
@@ -273,9 +273,7 @@ try {
273
273
  cli.parse(process.argv, { run: false });
274
274
  await cli.runMatchedCommand();
275
275
  } catch (e) {
276
- console.error(pc.red(e instanceof Error ? e.message : String(e)));
276
+ console.error(styleText("red", e instanceof Error ? e.message : String(e)));
277
277
  process.exit(1);
278
278
  }
279
279
  export {};
280
-
281
- //# sourceMappingURL=bin.js.map
@@ -51,7 +51,7 @@ var package_exports$3 = /* @__PURE__ */ __exportAll({
51
51
  version: () => version$3
52
52
  });
53
53
  var name$3 = "fumadocs-core";
54
- var version$3 = "16.18.3";
54
+ var version$3 = "16.18.4";
55
55
  var description$3 = "The React.js library for building a documentation website";
56
56
  var keywords$3 = ["Docs", "Fumadocs"];
57
57
  var homepage$3 = "https://fumadocs.dev";
@@ -315,7 +315,7 @@ var package_exports$2 = /* @__PURE__ */ __exportAll({
315
315
  version: () => version$2
316
316
  });
317
317
  var name$2 = "fumadocs-mdx";
318
- var version$2 = "15.5.2";
318
+ var version$2 = "15.5.3";
319
319
  var description$2 = "The built-in source for Fumadocs";
320
320
  var keywords$2 = ["Docs", "fumadocs"];
321
321
  var homepage$2 = "https://fumadocs.dev";
@@ -482,7 +482,7 @@ var package_exports$1 = /* @__PURE__ */ __exportAll({
482
482
  version: () => version$1
483
483
  });
484
484
  var name$1 = "@fumadocs/base-ui";
485
- var version$1 = "16.18.3";
485
+ var version$1 = "16.18.4";
486
486
  var description$1 = "The Base UI version of Fumadocs UI";
487
487
  var keywords$1 = ["Docs", "Fumadocs"];
488
488
  var homepage$1 = "https://fumadocs.dev";
@@ -634,7 +634,7 @@ var devDependencies$1 = {
634
634
  "@types/node": "^26.6.6",
635
635
  "@types/react": "^19.3.0",
636
636
  "@types/react-dom": "^19.3.0",
637
- "fuma-cli": "^0.3.1",
637
+ "fuma-cli": "^0.3.4",
638
638
  "fumadocs-core": "workspace:*",
639
639
  "react-medium-image-zoom": "^5.4.9",
640
640
  "tailwindcss": "^4.3.5",
@@ -856,5 +856,3 @@ const depVersions = dependencies$4;
856
856
  for (const workspace of workspaces) depVersions[workspace.name] = workspace.version;
857
857
  depVersions["fumadocs-ui"] = `npm:${name$1}@${version$1}`;
858
858
  export { templates as i, isCI as n, sourceDir as r, depVersions as t };
859
-
860
- //# sourceMappingURL=constants-BXNeGyPA.js.map
@@ -0,0 +1,476 @@
1
+ import { t as depVersions } from "./constants-C2dUvnpd.js";
2
+ import { getDefaultConfig } from "@fumadocs/cli/config";
3
+ import { runFeature } from "@fumadocs/cli/features";
4
+ import { loadProject } from "@fumadocs/cli/project";
5
+ // ../../node_modules/.pnpm/fuma-cli@0.3.4/node_modules/fuma-cli/dist/schema-DMvEg9i4.js
6
+ /**
7
+ * Error thrown when type assertion fails.
8
+ *
9
+ * Thrown by {@link assert}, {@link assertGuard}, and other assert-family
10
+ * functions when input doesn't match expected type `T`. Contains detailed
11
+ * information about the first assertion failure:
12
+ *
13
+ * - `method`: Which typia function threw (e.g., `"typia.assert"`)
14
+ * - `path`: Property path where error occurred (e.g., `"input.user.age"`)
15
+ * - `expected`: Expected type string (e.g., `"number & ExclusiveMinimum<19>"`)
16
+ * - `value`: Actual value that failed validation
17
+ *
18
+ * @template T Expected type (for type safety)
19
+ */
20
+ var TypeGuardError = class extends Error {
21
+ /**
22
+ * Creates a new TypeGuardError instance.
23
+ *
24
+ * @param props Error properties
25
+ */
26
+ constructor(props) {
27
+ super(props.message || `Error on ${props.method}(): invalid type${props.path ? ` on ${props.path}` : ""}, expect to be ${props.expected}`);
28
+ const proto = new.target.prototype;
29
+ if (Object.setPrototypeOf) Object.setPrototypeOf(this, proto);
30
+ else this.__proto__ = proto;
31
+ this.name = "TypeGuardError";
32
+ this.method = props.method;
33
+ this.path = props.path;
34
+ this.expected = props.expected;
35
+ this.value = props.value;
36
+ if (props.description || props.value === void 0) this.description = props.description ?? [
37
+ "The value at this path is `undefined`.",
38
+ "",
39
+ `Please fill the \`${props.expected}\` typed value next time.`
40
+ ].join("\n");
41
+ }
42
+ };
43
+ /**
44
+ * Report an assertion failure.
45
+ *
46
+ * When `exceptionable` is true it throws the error that `factory` makes, or a
47
+ * TypeGuardError when `factory` is not a function; otherwise it returns false
48
+ * so a union probe can try the next branch.
49
+ *
50
+ * @evidence contracts/common.md#principled-implementation When the call is exceptionable it throws an error built by the caller's factory if one is a function, and a TypeGuardError otherwise, and when it is not exceptionable it returns false so a union probe can try another branch without throwing. The factory is tested for callability because a pointwise call such as `rows.map(assertUser)` passes the element index in that position, which a bare truthiness test would call.
51
+ * @evidence contracts/common.md#clear-and-simple-design One function with a boolean guard and one factory branch.
52
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts A non-callable argument falls back to the default error and is not retried or wrapped; the comment explains that a create-time factory overridden by the argument cannot be recovered here.
53
+ * @evidence contracts/common.md#meaningful-documentation The doc states the two outcomes and the factory rule; the inline comment records the pointwise hand-off failure.
54
+ */
55
+ const _assertGuard = (exceptionable, props, factory) => {
56
+ if (exceptionable === true) {
57
+ if (typeof factory === "function") throw factory(props);
58
+ throw new TypeGuardError(props);
59
+ }
60
+ return false;
61
+ };
62
+ /**
63
+ * Write a property access on a key as source text.
64
+ *
65
+ * A key that is a legal ASCII identifier and not a reserved word becomes
66
+ * `.key`, and any other key becomes `["key"]` with a JSON string literal.
67
+ *
68
+ * @evidence contracts/common.md#principled-implementation A key that is a legal ASCII identifier and not a reserved word is written as a dot access, and every other key as a bracket access with a JSON string literal, which is a valid JavaScript string literal for any key, so the emitted access expression is correct for every property name. The reserved list is conservative for dot access, which is legal after a dot, so it can only cause an extra bracket form; the strict-mode future reserved words are not in the list.
69
+ * @evidence contracts/common.md#clear-and-simple-design One function with two private helpers, the identifier test and the reserved set.
70
+ * @evidence contracts/common.md#prohibited-implementation-shortcuts The decision is purely lexical and no property name is special-cased.
71
+ * @evidence contracts/common.md#meaningful-documentation The doc states the dot and bracket forms and why bracket access is always safe.
72
+ */
73
+ const _accessExpressionAsString = (str) => variable(str) ? `.${str}` : `[${JSON.stringify(str)}]`;
74
+ const variable = (str) => reserved(str) === false && /^[a-zA-Z_$][a-zA-Z_$0-9]*$/g.test(str);
75
+ const reserved = (str) => RESERVED.has(str);
76
+ const RESERVED = /* @__PURE__ */ new Set([
77
+ "break",
78
+ "case",
79
+ "catch",
80
+ "class",
81
+ "const",
82
+ "continue",
83
+ "debugger",
84
+ "default",
85
+ "delete",
86
+ "do",
87
+ "else",
88
+ "enum",
89
+ "export",
90
+ "extends",
91
+ "false",
92
+ "finally",
93
+ "for",
94
+ "function",
95
+ "if",
96
+ "import",
97
+ "in",
98
+ "instanceof",
99
+ "new",
100
+ "null",
101
+ "return",
102
+ "super",
103
+ "switch",
104
+ "this",
105
+ "throw",
106
+ "true",
107
+ "try",
108
+ "typeof",
109
+ "var",
110
+ "void",
111
+ "while",
112
+ "with"
113
+ ]);
114
+ const __typia_transform__accessExpressionAsString = _accessExpressionAsString;
115
+ /** @throws when the input is not a manifest */
116
+ const assertManifest = (() => {
117
+ const _ip0 = (input) => "string" === typeof input["name"];
118
+ const _ip1 = (input) => void 0 === input["dependencies"] || "object" === typeof input["dependencies"] && null !== input["dependencies"] && false === Array.isArray(input["dependencies"]) && _io5(input["dependencies"]);
119
+ const _ip2 = (input) => void 0 === input["devDependencies"] || "object" === typeof input["devDependencies"] && null !== input["devDependencies"] && false === Array.isArray(input["devDependencies"]) && _io5(input["devDependencies"]);
120
+ const _ap0 = (input, _path, _exceptionable = true) => "string" === typeof input["name"] || _assertGuard(_exceptionable, {
121
+ method: "typia.createAssert",
122
+ path: _path + ".name",
123
+ expected: "string",
124
+ value: input["name"]
125
+ }, _errorFactory);
126
+ const _ae0 = "(BaseFile & { type: \"components\" | \"css\" | \"layout\" | \"lib\" | \"ui\"; target?: string | undefined; } | BaseFile & { type: \"route-handler\"; route: string; })";
127
+ const _ap1 = (input, _path, _exceptionable = true) => void 0 === input["dependencies"] || ("object" === typeof input["dependencies"] && null !== input["dependencies"] && false === Array.isArray(input["dependencies"]) || _assertGuard(_exceptionable, {
128
+ method: "typia.createAssert",
129
+ path: _path + ".dependencies",
130
+ expected: "(Dependencies | undefined)",
131
+ value: input["dependencies"]
132
+ }, _errorFactory)) && _ao5(input["dependencies"], _path + ".dependencies", _exceptionable) || _assertGuard(_exceptionable, {
133
+ method: "typia.createAssert",
134
+ path: _path + ".dependencies",
135
+ expected: "(Dependencies | undefined)",
136
+ value: input["dependencies"]
137
+ }, _errorFactory);
138
+ const _ap2 = (input, _path, _exceptionable = true) => void 0 === input["devDependencies"] || ("object" === typeof input["devDependencies"] && null !== input["devDependencies"] && false === Array.isArray(input["devDependencies"]) || _assertGuard(_exceptionable, {
139
+ method: "typia.createAssert",
140
+ path: _path + ".devDependencies",
141
+ expected: "(Dependencies | undefined)",
142
+ value: input["devDependencies"]
143
+ }, _errorFactory)) && _ao5(input["devDependencies"], _path + ".devDependencies", _exceptionable) || _assertGuard(_exceptionable, {
144
+ method: "typia.createAssert",
145
+ path: _path + ".devDependencies",
146
+ expected: "(Dependencies | undefined)",
147
+ value: input["devDependencies"]
148
+ }, _errorFactory);
149
+ const _ao0 = (input, _path, _exceptionable = true) => _ap0(input, _path, _exceptionable) && ((Array.isArray(input.components) || _assertGuard(_exceptionable, {
150
+ method: "typia.createAssert",
151
+ path: _path + ".components",
152
+ expected: "Array<ManifestComponent>",
153
+ value: input.components
154
+ }, _errorFactory)) && input.components.every((elem, _index9) => ("object" === typeof elem && null !== elem || _assertGuard(_exceptionable, {
155
+ method: "typia.createAssert",
156
+ path: _path + ".components[" + _index9 + "]",
157
+ expected: "ManifestComponent",
158
+ value: elem
159
+ }, _errorFactory)) && _ao1(elem, _path + ".components[" + _index9 + "]", _exceptionable) || _assertGuard(_exceptionable, {
160
+ method: "typia.createAssert",
161
+ path: _path + ".components[" + _index9 + "]",
162
+ expected: "ManifestComponent",
163
+ value: elem
164
+ }, _errorFactory)) || _assertGuard(_exceptionable, {
165
+ method: "typia.createAssert",
166
+ path: _path + ".components",
167
+ expected: "Array<ManifestComponent>",
168
+ value: input.components
169
+ }, _errorFactory)) && (("object" === typeof input.files && null !== input.files && false === Array.isArray(input.files) || _assertGuard(_exceptionable, {
170
+ method: "typia.createAssert",
171
+ path: _path + ".files",
172
+ expected: "Record<string, ManifestFile>",
173
+ value: input.files
174
+ }, _errorFactory)) && _ao2(input.files, _path + ".files", _exceptionable) || _assertGuard(_exceptionable, {
175
+ method: "typia.createAssert",
176
+ path: _path + ".files",
177
+ expected: "Record<string, ManifestFile>",
178
+ value: input.files
179
+ }, _errorFactory)) && (void 0 === input.registries || (Array.isArray(input.registries) || _assertGuard(_exceptionable, {
180
+ method: "typia.createAssert",
181
+ path: _path + ".registries",
182
+ expected: "(Array<string> | undefined)",
183
+ value: input.registries
184
+ }, _errorFactory)) && input.registries.every((elem, _index10) => "string" === typeof elem || _assertGuard(_exceptionable, {
185
+ method: "typia.createAssert",
186
+ path: _path + ".registries[" + _index10 + "]",
187
+ expected: "string",
188
+ value: elem
189
+ }, _errorFactory)) || _assertGuard(_exceptionable, {
190
+ method: "typia.createAssert",
191
+ path: _path + ".registries",
192
+ expected: "(Array<string> | undefined)",
193
+ value: input.registries
194
+ }, _errorFactory));
195
+ const _ao1 = (input, _path, _exceptionable = true) => _ap0(input, _path, _exceptionable) && (void 0 === input.title || "string" === typeof input.title || _assertGuard(_exceptionable, {
196
+ method: "typia.createAssert",
197
+ path: _path + ".title",
198
+ expected: "(string | undefined)",
199
+ value: input.title
200
+ }, _errorFactory)) && (void 0 === input.description || "string" === typeof input.description || _assertGuard(_exceptionable, {
201
+ method: "typia.createAssert",
202
+ path: _path + ".description",
203
+ expected: "(string | undefined)",
204
+ value: input.description
205
+ }, _errorFactory)) && (void 0 === input.unlisted || "boolean" === typeof input.unlisted || _assertGuard(_exceptionable, {
206
+ method: "typia.createAssert",
207
+ path: _path + ".unlisted",
208
+ expected: "(boolean | undefined)",
209
+ value: input.unlisted
210
+ }, _errorFactory)) && ((Array.isArray(input.files) || _assertGuard(_exceptionable, {
211
+ method: "typia.createAssert",
212
+ path: _path + ".files",
213
+ expected: "Array<string>",
214
+ value: input.files
215
+ }, _errorFactory)) && input.files.every((elem, _index11) => "string" === typeof elem || _assertGuard(_exceptionable, {
216
+ method: "typia.createAssert",
217
+ path: _path + ".files[" + _index11 + "]",
218
+ expected: "string",
219
+ value: elem
220
+ }, _errorFactory)) || _assertGuard(_exceptionable, {
221
+ method: "typia.createAssert",
222
+ path: _path + ".files",
223
+ expected: "Array<string>",
224
+ value: input.files
225
+ }, _errorFactory));
226
+ const _ao2 = (input, _path, _exceptionable = true) => false === _exceptionable || Object.keys(input).every((key) => {
227
+ const value = input[key];
228
+ if (void 0 === value) return true;
229
+ return ("object" === typeof value && null !== value || _assertGuard(_exceptionable, {
230
+ method: "typia.createAssert",
231
+ path: _path + __typia_transform__accessExpressionAsString(key),
232
+ expected: _ae0,
233
+ value
234
+ }, _errorFactory)) && _au0(value, _path + __typia_transform__accessExpressionAsString(key), _exceptionable) || _assertGuard(_exceptionable, {
235
+ method: "typia.createAssert",
236
+ path: _path + __typia_transform__accessExpressionAsString(key),
237
+ expected: _ae0,
238
+ value
239
+ }, _errorFactory);
240
+ });
241
+ const _ao3 = (input, _path, _exceptionable = true) => _ao4(input, _path, _exceptionable) && ("components" === input.type || "css" === input.type || "layout" === input.type || "lib" === input.type || "ui" === input.type || _assertGuard(_exceptionable, {
242
+ method: "typia.createAssert",
243
+ path: _path + ".type",
244
+ expected: "(\"components\" | \"css\" | \"layout\" | \"lib\" | \"ui\")",
245
+ value: input.type
246
+ }, _errorFactory)) && (void 0 === input.target || "string" === typeof input.target || _assertGuard(_exceptionable, {
247
+ method: "typia.createAssert",
248
+ path: _path + ".target",
249
+ expected: "(string | undefined)",
250
+ value: input.target
251
+ }, _errorFactory));
252
+ const _ao4 = (input, _path, _exceptionable = true) => _ap1(input, _path, _exceptionable) && _ap2(input, _path, _exceptionable) && (void 0 === input.imports || (Array.isArray(input.imports) || _assertGuard(_exceptionable, {
253
+ method: "typia.createAssert",
254
+ path: _path + ".imports",
255
+ expected: "(Array<ManifestImport> | undefined)",
256
+ value: input.imports
257
+ }, _errorFactory)) && input.imports.every((elem, _index12) => ("object" === typeof elem && null !== elem || _assertGuard(_exceptionable, {
258
+ method: "typia.createAssert",
259
+ path: _path + ".imports[" + _index12 + "]",
260
+ expected: "ManifestImport",
261
+ value: elem
262
+ }, _errorFactory)) && _ao6(elem, _path + ".imports[" + _index12 + "]", _exceptionable) || _assertGuard(_exceptionable, {
263
+ method: "typia.createAssert",
264
+ path: _path + ".imports[" + _index12 + "]",
265
+ expected: "ManifestImport",
266
+ value: elem
267
+ }, _errorFactory)) || _assertGuard(_exceptionable, {
268
+ method: "typia.createAssert",
269
+ path: _path + ".imports",
270
+ expected: "(Array<ManifestImport> | undefined)",
271
+ value: input.imports
272
+ }, _errorFactory)) && (void 0 === input.stmtInfos || (Array.isArray(input.stmtInfos) || _assertGuard(_exceptionable, {
273
+ method: "typia.createAssert",
274
+ path: _path + ".stmtInfos",
275
+ expected: "(Array<StmtInfo> | undefined)",
276
+ value: input.stmtInfos
277
+ }, _errorFactory)) && input.stmtInfos.every((elem, _index13) => ("object" === typeof elem && null !== elem || _assertGuard(_exceptionable, {
278
+ method: "typia.createAssert",
279
+ path: _path + ".stmtInfos[" + _index13 + "]",
280
+ expected: "StmtInfo",
281
+ value: elem
282
+ }, _errorFactory)) && _ao7(elem, _path + ".stmtInfos[" + _index13 + "]", _exceptionable) || _assertGuard(_exceptionable, {
283
+ method: "typia.createAssert",
284
+ path: _path + ".stmtInfos[" + _index13 + "]",
285
+ expected: "StmtInfo",
286
+ value: elem
287
+ }, _errorFactory)) || _assertGuard(_exceptionable, {
288
+ method: "typia.createAssert",
289
+ path: _path + ".stmtInfos",
290
+ expected: "(Array<StmtInfo> | undefined)",
291
+ value: input.stmtInfos
292
+ }, _errorFactory));
293
+ const _ao5 = (input, _path, _exceptionable = true) => false === _exceptionable || Object.keys(input).every((key) => {
294
+ const value = input[key];
295
+ if (void 0 === value) return true;
296
+ return null === value || "string" === typeof value || _assertGuard(_exceptionable, {
297
+ method: "typia.createAssert",
298
+ path: _path + __typia_transform__accessExpressionAsString(key),
299
+ expected: "(null | string)",
300
+ value
301
+ }, _errorFactory);
302
+ });
303
+ const _ao6 = (input, _path, _exceptionable = true) => ("number" === typeof input.start || _assertGuard(_exceptionable, {
304
+ method: "typia.createAssert",
305
+ path: _path + ".start",
306
+ expected: "number",
307
+ value: input.start
308
+ }, _errorFactory)) && ("string" === typeof input.id || _assertGuard(_exceptionable, {
309
+ method: "typia.createAssert",
310
+ path: _path + ".id",
311
+ expected: "string",
312
+ value: input.id
313
+ }, _errorFactory)) && (void 0 === input.bindings || (Array.isArray(input.bindings) || _assertGuard(_exceptionable, {
314
+ method: "typia.createAssert",
315
+ path: _path + ".bindings",
316
+ expected: "(Array<string> | undefined)",
317
+ value: input.bindings
318
+ }, _errorFactory)) && input.bindings.every((elem, _index14) => "string" === typeof elem || _assertGuard(_exceptionable, {
319
+ method: "typia.createAssert",
320
+ path: _path + ".bindings[" + _index14 + "]",
321
+ expected: "string",
322
+ value: elem
323
+ }, _errorFactory)) || _assertGuard(_exceptionable, {
324
+ method: "typia.createAssert",
325
+ path: _path + ".bindings",
326
+ expected: "(Array<string> | undefined)",
327
+ value: input.bindings
328
+ }, _errorFactory)) && (void 0 === input["package"] || "string" === typeof input["package"] || _assertGuard(_exceptionable, {
329
+ method: "typia.createAssert",
330
+ path: _path + "[\"package\"]",
331
+ expected: "(string | undefined)",
332
+ value: input["package"]
333
+ }, _errorFactory));
334
+ const _ao7 = (input, _path, _exceptionable = true) => ("number" === typeof input.end || _assertGuard(_exceptionable, {
335
+ method: "typia.createAssert",
336
+ path: _path + ".end",
337
+ expected: "number",
338
+ value: input.end
339
+ }, _errorFactory)) && (void 0 === input.declares || (Array.isArray(input.declares) || _assertGuard(_exceptionable, {
340
+ method: "typia.createAssert",
341
+ path: _path + ".declares",
342
+ expected: "(Array<string> | undefined)",
343
+ value: input.declares
344
+ }, _errorFactory)) && input.declares.every((elem, _index15) => "string" === typeof elem || _assertGuard(_exceptionable, {
345
+ method: "typia.createAssert",
346
+ path: _path + ".declares[" + _index15 + "]",
347
+ expected: "string",
348
+ value: elem
349
+ }, _errorFactory)) || _assertGuard(_exceptionable, {
350
+ method: "typia.createAssert",
351
+ path: _path + ".declares",
352
+ expected: "(Array<string> | undefined)",
353
+ value: input.declares
354
+ }, _errorFactory)) && (void 0 === input.references || (Array.isArray(input.references) || _assertGuard(_exceptionable, {
355
+ method: "typia.createAssert",
356
+ path: _path + ".references",
357
+ expected: "(Array<number> | undefined)",
358
+ value: input.references
359
+ }, _errorFactory)) && input.references.every((elem, _index16) => "number" === typeof elem || _assertGuard(_exceptionable, {
360
+ method: "typia.createAssert",
361
+ path: _path + ".references[" + _index16 + "]",
362
+ expected: "number",
363
+ value: elem
364
+ }, _errorFactory)) || _assertGuard(_exceptionable, {
365
+ method: "typia.createAssert",
366
+ path: _path + ".references",
367
+ expected: "(Array<number> | undefined)",
368
+ value: input.references
369
+ }, _errorFactory)) && (void 0 === input["import"] || "boolean" === typeof input["import"] || _assertGuard(_exceptionable, {
370
+ method: "typia.createAssert",
371
+ path: _path + "[\"import\"]",
372
+ expected: "(boolean | undefined)",
373
+ value: input["import"]
374
+ }, _errorFactory)) && _ap1(input, _path, _exceptionable) && _ap2(input, _path, _exceptionable);
375
+ const _ao8 = (input, _path, _exceptionable = true) => _ao4(input, _path, _exceptionable) && ("route-handler" === input.type || _assertGuard(_exceptionable, {
376
+ method: "typia.createAssert",
377
+ path: _path + ".type",
378
+ expected: "\"route-handler\"",
379
+ value: input.type
380
+ }, _errorFactory)) && ("string" === typeof input.route || _assertGuard(_exceptionable, {
381
+ method: "typia.createAssert",
382
+ path: _path + ".route",
383
+ expected: "string",
384
+ value: input.route
385
+ }, _errorFactory));
386
+ const _au0 = (input, _path, _exceptionable = true) => (() => {
387
+ if ("components" === input.type || "css" === input.type || "layout" === input.type || "lib" === input.type || "ui" === input.type) return _ao3(input, _path, _exceptionable);
388
+ else if ("route-handler" === input.type) return _ao8(input, _path, _exceptionable);
389
+ else return _assertGuard(_exceptionable, {
390
+ method: "typia.createAssert",
391
+ path: _path,
392
+ expected: _ae0,
393
+ value: input
394
+ }, _errorFactory);
395
+ })();
396
+ const _io0 = (input) => _ip0(input) && Array.isArray(input.components) && input.components.every((elem) => "object" === typeof elem && null !== elem && _io1(elem)) && "object" === typeof input.files && null !== input.files && false === Array.isArray(input.files) && _io2(input.files) && (void 0 === input.registries || Array.isArray(input.registries) && input.registries.every((elem) => "string" === typeof elem));
397
+ const _io1 = (input) => _ip0(input) && (void 0 === input.title || "string" === typeof input.title) && (void 0 === input.description || "string" === typeof input.description) && (void 0 === input.unlisted || "boolean" === typeof input.unlisted) && Array.isArray(input.files) && input.files.every((elem) => "string" === typeof elem);
398
+ const _io2 = (input) => Object.keys(input).every((key) => {
399
+ const value = input[key];
400
+ if (void 0 === value) return true;
401
+ return "object" === typeof value && null !== value && _iu0(value);
402
+ });
403
+ const _io3 = (input) => _io4(input) && ("components" === input.type || "css" === input.type || "layout" === input.type || "lib" === input.type || "ui" === input.type) && (void 0 === input.target || "string" === typeof input.target);
404
+ const _io4 = (input) => _ip1(input) && _ip2(input) && (void 0 === input.imports || Array.isArray(input.imports) && input.imports.every((elem) => "object" === typeof elem && null !== elem && _io6(elem))) && (void 0 === input.stmtInfos || Array.isArray(input.stmtInfos) && input.stmtInfos.every((elem) => "object" === typeof elem && null !== elem && _io7(elem)));
405
+ const _io5 = (input) => Object.keys(input).every((key) => {
406
+ const value = input[key];
407
+ if (void 0 === value) return true;
408
+ return null === value || "string" === typeof value;
409
+ });
410
+ const _io6 = (input) => "number" === typeof input.start && "string" === typeof input.id && (void 0 === input.bindings || Array.isArray(input.bindings) && input.bindings.every((elem) => "string" === typeof elem)) && (void 0 === input["package"] || "string" === typeof input["package"]);
411
+ const _io7 = (input) => "number" === typeof input.end && (void 0 === input.declares || Array.isArray(input.declares) && input.declares.every((elem) => "string" === typeof elem)) && (void 0 === input.references || Array.isArray(input.references) && input.references.every((elem) => "number" === typeof elem)) && (void 0 === input["import"] || "boolean" === typeof input["import"]) && _ip1(input) && _ip2(input);
412
+ const _io8 = (input) => _io4(input) && "route-handler" === input.type && "string" === typeof input.route;
413
+ const _iu0 = (input) => (() => {
414
+ if ("components" === input.type || "css" === input.type || "layout" === input.type || "lib" === input.type || "ui" === input.type) return _io3(input);
415
+ else if ("route-handler" === input.type) return _io8(input);
416
+ else return false;
417
+ })();
418
+ const __is = (input) => "object" === typeof input && null !== input && _io0(input);
419
+ let _errorFactory;
420
+ return (input, errorFactory) => {
421
+ if (false === __is(input)) {
422
+ _errorFactory = errorFactory;
423
+ ((input, _path, _exceptionable = true) => ("object" === typeof input && null !== input || _assertGuard(true, {
424
+ method: "typia.createAssert",
425
+ path: _path + "",
426
+ expected: "Manifest",
427
+ value: input
428
+ }, _errorFactory)) && _ao0(input, _path + "", true) || _assertGuard(true, {
429
+ method: "typia.createAssert",
430
+ path: _path + "",
431
+ expected: "Manifest",
432
+ value: input
433
+ }, _errorFactory))(input, "$input", true);
434
+ }
435
+ return input;
436
+ };
437
+ })();
438
+ // ../../node_modules/.pnpm/fuma-cli@0.3.4/node_modules/fuma-cli/dist/registry/connector.js
439
+ var HttpRegistryConnector = class {
440
+ baseUrl;
441
+ constructor(baseUrl) {
442
+ this.baseUrl = baseUrl;
443
+ }
444
+ async fetch(pathname, registry) {
445
+ const url = `${this.baseUrl}/${registry ? `${registry}/` : ""}${pathname}`;
446
+ const res = await fetch(url);
447
+ if (!res.ok) throw new Error(`failed to fetch ${url}: ${res.status} ${res.statusText}`);
448
+ return res;
449
+ }
450
+ async fetchManifest(registry) {
451
+ const res = await this.fetch("_registry.json", registry);
452
+ return assertManifest(await res.json());
453
+ }
454
+ async fetchFile(file, registry) {
455
+ return (await this.fetch(`files/${file}`, registry)).bytes();
456
+ }
457
+ };
458
+ // src/plugins/feature.ts
459
+ /** apply a Fumadocs CLI feature to the generated project */
460
+ function feature(feature, options) {
461
+ return { async afterWrite() {
462
+ const config = await getDefaultConfig(this.dest);
463
+ const project = await loadProject(config, this.dest);
464
+ await runFeature(feature, options, {
465
+ project,
466
+ connector: new HttpRegistryConnector("https://fumadocs.dev/registry"),
467
+ versions: depVersions,
468
+ io: {
469
+ log: this.log,
470
+ installDependencies: false,
471
+ confirmOverwrite: async () => true
472
+ }
473
+ });
474
+ } };
475
+ }
476
+ export { feature as t };
@@ -57,5 +57,4 @@ interface TemplatePlugin {
57
57
  readme?: (this: TemplatePluginContext, content: string) => Awaitable<void | string>;
58
58
  }
59
59
  declare function create(createOptions: Options): Promise<void>;
60
- export { TemplatePluginContext as a, TemplatePlugin as i, PackageJsonType as n, create as o, Template as r, Options as t };
61
- //# sourceMappingURL=index-DHK1sZ4O.d.ts.map
60
+ export { TemplatePluginContext as a, TemplatePlugin as i, PackageJsonType as n, create as o, Template as r, Options as t };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export { t as create } from "./src-55Opr41I.js";
1
+ export { t as create } from "./src-CRg_0mOO.js";
@@ -1,5 +1,4 @@
1
1
  import { i as TemplatePlugin } from "../index-DHK1sZ4O.js";
2
2
  import { Feature } from "@fumadocs/cli/features";
3
3
  /** apply a Fumadocs CLI feature to the generated project */
4
- export declare function feature<O extends object>(feature: Feature<O>, options: O): TemplatePlugin;
5
- //# sourceMappingURL=feature.d.ts.map
4
+ export declare function feature<O extends object>(feature: Feature<O>, options: O): TemplatePlugin;
@@ -1 +1 @@
1
- export { t as feature } from "../feature-BSyhSuG1.js";
1
+ export { t as feature } from "../feature-CSPlEscc.js";
@@ -2,5 +2,4 @@ import { i as TemplatePlugin } from "../index-DHK1sZ4O.js";
2
2
  /**
3
3
  * Use `src` for app directory
4
4
  */
5
- export declare function nextUseSrc(): TemplatePlugin;
6
- //# sourceMappingURL=next-use-src.d.ts.map
5
+ export declare function nextUseSrc(): TemplatePlugin;
@@ -45,5 +45,3 @@ function isRelative(dir, file) {
45
45
  return !path.relative(dir, file).startsWith(`..${path.sep}`);
46
46
  }
47
47
  export { nextUseSrc };
48
-
49
- //# sourceMappingURL=next-use-src.js.map
@@ -1,4 +1,4 @@
1
- import { i as templates, r as sourceDir, t as depVersions } from "./constants-BXNeGyPA.js";
1
+ import { i as templates, r as sourceDir, t as depVersions } from "./constants-C2dUvnpd.js";
2
2
  import fs from "node:fs/promises";
3
3
  import path, { join } from "node:path";
4
4
  import { x } from "tinyexec";
@@ -141,5 +141,3 @@ async function initPackageJson(projectName, packageJsonPath) {
141
141
  };
142
142
  }
143
143
  export { getPackageManager as n, managers as r, create as t };
144
-
145
- //# sourceMappingURL=src-55Opr41I.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-fumadocs-app",
3
- "version": "16.2.32",
3
+ "version": "16.3.0",
4
4
  "description": "Create a new documentation site with Fumadocs",
5
5
  "keywords": [
6
6
  "Docs",
@@ -40,22 +40,21 @@
40
40
  },
41
41
  "dependencies": {
42
42
  "@clack/prompts": "^1.8.1",
43
- "@fumadocs/cli": "1.8.3",
43
+ "@fumadocs/cli": "1.9.0",
44
44
  "cac": "^7.1.0",
45
- "fuma-cli": "^0.3.1",
46
- "picocolors": "^1.1.1",
47
45
  "tinyexec": "^1.3.1"
48
46
  },
49
47
  "devDependencies": {
50
48
  "@types/cross-spawn": "^6.0.6",
51
49
  "@types/node": "26.6.6",
50
+ "fuma-cli": "^0.3.4",
52
51
  "tinyglobby": "^0.2.17",
53
52
  "tsconfig": "0.0.0",
54
53
  "tsdown": "0.23.7",
55
54
  "typescript": "^7.0.2"
56
55
  },
57
56
  "engines": {
58
- "node": ">=20"
57
+ "node": "^22.18.0 || >=24.11.0"
59
58
  },
60
59
  "scripts": {
61
60
  "build": "pnpm run sync && tsdown",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "example-next",
3
- "version": "0.0.57",
3
+ "version": "0.0.59",
4
4
  "private": true,
5
5
  "scripts": {
6
6
  "build": "next build",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "example-next-static",
3
- "version": "0.0.57",
3
+ "version": "0.0.59",
4
4
  "private": true,
5
5
  "scripts": {
6
6
  "build": "next build",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "example-astro",
3
- "version": "0.0.53",
3
+ "version": "0.0.54",
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "scripts": {
package/dist/bin.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"bin.js","names":[],"sources":["../src/bin.ts"],"sourcesContent":["#!/usr/bin/env node\nimport fs from 'node:fs/promises';\nimport path from 'node:path';\nimport {\n cancel,\n confirm,\n group,\n intro,\n isCancel,\n outro,\n select,\n spinner,\n text,\n} from '@clack/prompts';\nimport pc from 'picocolors';\nimport { getPackageManager, managers, type PackageManager } from './auto-install';\nimport { create, type Template, type TemplatePlugin } from './index';\nimport { isCI, templates } from './constants';\nimport { cac } from 'cac';\nimport { feature } from './plugins/feature';\nimport { ai, type AIProvider } from '@fumadocs/cli/features/ai';\nimport { lint } from '@fumadocs/cli/features/lint';\nimport { og } from '@fumadocs/cli/features/og';\nimport { search, type SearchProvider } from '@fumadocs/cli/features/search';\n\nconst linters = ['eslint', 'oxlint', 'biome'] as const;\nconst searchProviders = [\n 'orama',\n 'orama-cloud',\n 'algolia',\n 'meilisearch',\n 'typesense',\n 'mixedbread',\n] as const;\nconst ogImages = ['next-og', 'takumi'] as const;\nconst aiChats = ['openrouter', 'llmgateway', 'inkeep'] as const;\nconst templateNames = templates.map((item) => item.value);\n\ninterface CliOptions {\n src?: boolean;\n install?: boolean;\n git: boolean;\n yes?: boolean;\n linter?: (typeof linters)[number];\n search?: SearchProvider | 'orama';\n ogImage?: (typeof ogImages)[number];\n aiChat?: AIProvider;\n template?: Template;\n pm: PackageManager;\n}\n\nconst cli = cac('create-fumadocs-app');\n\ncli\n .command('[name]', 'create a Fumadocs app, [name] is the project name')\n .option('--src', '(Next.js only) enable `src/` directory')\n .option('--install', 'install packages automatically')\n .option('--no-git', 'disable auto Git repository initialization')\n .option('-y, --yes', 'skip prompts and use defaults for unspecified options')\n .option(\n '--linter <name>',\n `configure a linter/formatter, ESLint is currently Next.js only. (${linters.join(', ')})`,\n )\n .option('--search <name>', `configure a search solution (${searchProviders.join(', ')})`)\n .option('--og-image <name>', `configure OG image generation (${ogImages.join(', ')})`)\n .option('--ai-chat <name>', `configure AI chat (${aiChats.join(', ')})`)\n .option('--template <name>', `choose a template (${templateNames.join(', ')})`)\n .option('--pm <name>', `choose a package manager (${managers.join(', ')})`, {\n default: getPackageManager(),\n })\n .action(main);\n\n/** templates without a server at runtime */\nconst isStatic = (template: Template) =>\n template === 'astro' || template === '+next+fuma-docs-mdx+static' || template.endsWith('-spa');\n\nfunction checkOption(name: string, value: string | undefined, choices: readonly string[]) {\n if (value !== undefined && !choices.includes(value))\n throw new Error(`invalid value for --${name}: ${value}, expected: ${choices.join(', ')}`);\n}\n\nasync function main(defaultName: string | undefined, config: CliOptions): Promise<void> {\n checkOption('linter', config.linter, linters);\n checkOption('search', config.search, searchProviders);\n checkOption('og-image', config.ogImage, ogImages);\n checkOption('ai-chat', config.aiChat, aiChats);\n checkOption('template', config.template, templateNames);\n checkOption('pm', config.pm, managers);\n const skipPrompts = isCI || config.yes === true;\n intro(pc.bgCyan(pc.bold('Create Fumadocs App')));\n\n const options = await group(\n {\n name: async () => {\n if (defaultName) return defaultName;\n if (skipPrompts) return 'untitled';\n\n return text({\n message: 'Project name',\n placeholder: 'my-app',\n defaultValue: 'my-app',\n });\n },\n template: async () => {\n if (config.template) return config.template;\n if (skipPrompts) return '+next+fuma-docs-mdx';\n\n return select<Template>({\n message: 'Choose a template',\n initialValue: '+next+fuma-docs-mdx',\n options: templates,\n });\n },\n src: async ({ results }: { results: { template?: Template } }) => {\n if (config.src !== undefined) return config.src;\n if (skipPrompts || !results.template?.startsWith('+next')) return false;\n\n return confirm({\n message: 'Use `/src` directory?',\n initialValue: false,\n });\n },\n lint: async ({ results }: { results: { template?: Template } }) => {\n if (config.linter !== undefined) return config.linter;\n if (skipPrompts) return 'disabled';\n\n return select({\n message: 'Configure linter?',\n options: results.template?.startsWith('+next')\n ? [\n {\n value: 'disabled',\n label: 'Disabled',\n },\n {\n value: 'eslint',\n label: 'ESLint',\n },\n {\n value: 'biome',\n label: 'Biome',\n },\n {\n value: 'oxlint',\n label: 'Oxlint',\n },\n ]\n : [\n {\n value: 'disabled',\n label: 'Disabled',\n },\n {\n value: 'biome',\n label: 'Biome',\n },\n {\n value: 'oxlint',\n label: 'Oxlint',\n },\n ],\n });\n },\n search: async ({ results }: { results: { template?: Template } }) => {\n if (config.search !== undefined) return config.search;\n if (skipPrompts) return 'orama';\n\n return select({\n message: 'Choose a search solution?',\n options: [\n {\n value: 'orama',\n label: 'Default',\n hint: 'local search powered by ZBSearch, recommended',\n },\n {\n value: 'orama-cloud',\n label: 'Orama Cloud',\n hint: '3rd party search solution, signup needed',\n },\n { value: 'algolia', label: 'Algolia', hint: 'signup needed' },\n { value: 'meilisearch', label: 'Meilisearch', hint: 'self-hosted or cloud' },\n { value: 'typesense', label: 'Typesense', hint: 'self-hosted or cloud' },\n // searches on a server\n ...(isStatic(results.template!)\n ? []\n : [{ value: 'mixedbread', label: 'Mixedbread', hint: 'AI search, signup needed' }]),\n ],\n });\n },\n ogImage: async ({ results }: { results: { template?: Template } }) => {\n if (config.ogImage !== undefined) return config.ogImage;\n if (!results.template?.startsWith('+next')) return 'takumi';\n if (skipPrompts) return 'next/og';\n\n return select({\n message: 'Configure Open Graph Image generation?',\n options: [\n {\n value: 'next/og',\n label: 'next/og',\n hint: 'Next.js built-in solution',\n },\n {\n value: 'takumi',\n label: 'Takumi',\n hint: 'Output WebP format, framework-agnostic',\n },\n ],\n });\n },\n aiChat: async ({ results }: { results: { template?: Template } }) => {\n if (config.aiChat !== undefined) return config.aiChat;\n if (skipPrompts || isStatic(results.template!)) return false;\n\n return select<false | 'openrouter' | 'llmgateway' | 'inkeep'>({\n message: 'Configure AI Chat?',\n options: [\n {\n value: false,\n label: 'No',\n },\n {\n value: 'openrouter',\n label: 'AI SDK',\n hint: 'default to OpenRouter',\n },\n {\n value: 'llmgateway',\n label: 'LLMGateway',\n hint: 'open-source LLM gateway, API key required',\n },\n {\n value: 'inkeep',\n label: 'Inkeep AI',\n hint: 'API key required',\n },\n ],\n });\n },\n installDeps: async () => {\n if (config.install !== undefined) return config.install;\n if (skipPrompts) return false;\n\n return confirm({\n message: `Do you want to install packages automatically? (detected as ${config.pm})`,\n });\n },\n },\n {\n onCancel: () => {\n cancel('Installation Stopped.');\n process.exit(0);\n },\n },\n );\n\n const projectName = options.name.toLowerCase().replace(/\\s/, '-');\n if (options.aiChat && isStatic(options.template)) {\n console.warn(pc.yellow('AI Chat needs a server, the template is static, skipping it.'));\n options.aiChat = false;\n }\n if (options.ogImage === 'next-og' && !options.template.startsWith('+next')) {\n console.warn(\n pc.yellow('next/og is only available on Next.js, the template uses Takumi instead.'),\n );\n }\n\n if (!isCI) await checkDir(projectName, skipPrompts);\n\n const info = spinner();\n info.start(`Generating Project`);\n const plugins: TemplatePlugin[] = [];\n\n if (options.src) {\n const { nextUseSrc } = await import('./plugins/next-use-src');\n plugins.push(nextUseSrc());\n }\n\n if (options.search !== 'orama') plugins.push(feature(search, { provider: options.search }));\n if (options.lint !== 'disabled') plugins.push(feature(lint, { linter: options.lint }));\n if (options.ogImage === 'takumi' && options.template.startsWith('+next'))\n plugins.push(feature(og, { engine: 'takumi' }));\n if (options.aiChat) plugins.push(feature(ai, { provider: options.aiChat }));\n\n await create({\n packageManager: config.pm,\n template: options.template,\n outputDir: projectName,\n installDeps: options.installDeps,\n initializeGit: config.git,\n plugins,\n log: (message) => {\n info.message(message);\n },\n });\n\n info.stop('Project Generated');\n\n outro(pc.bgGreen(pc.bold('Done')));\n\n console.log(pc.bold('\\nOpen the project'));\n console.log(pc.cyan(`cd ${projectName}`));\n\n console.log(pc.bold('\\nRun Development Server'));\n if (config.pm === 'npm' || config.pm === 'bun') {\n console.log(pc.cyan(`${config.pm} run dev`));\n } else {\n console.log(pc.cyan(`${config.pm} dev`));\n }\n console.log(pc.bold('\\nYou can now open the project and start writing documents'));\n\n process.exit(0);\n}\n\nasync function checkDir(outputDir: string, skipPrompts: boolean) {\n const destDir = await fs.readdir(outputDir).catch(() => null);\n if (!destDir || destDir.length === 0) return;\n if (skipPrompts) {\n cancel(`directory ${outputDir} already exists and is not empty.`);\n process.exit(1);\n }\n const del = await confirm({\n message: `directory ${outputDir} already exists, do you want to delete its files?`,\n });\n\n if (isCancel(del)) {\n cancel();\n process.exit(1);\n }\n\n if (!del) return;\n\n const info = spinner();\n info.start(`Deleting files in ${outputDir}`);\n\n await Promise.all(\n destDir.map((item) => {\n return fs.rm(path.join(outputDir, item), {\n recursive: true,\n force: true,\n });\n }),\n );\n\n info.stop(`Deleted files in ${outputDir}`);\n}\n\ncli.help();\n\ntry {\n cli.parse(process.argv, { run: false });\n await cli.runMatchedCommand();\n} catch (e) {\n console.error(pc.red(e instanceof Error ? e.message : String(e)));\n process.exit(1);\n}\n"],"mappings":";;;;;;;;;;;;;;AAyBA,MAAM,UAAU;CAAC;CAAU;CAAU;AAAO;AAC5C,MAAM,kBAAkB;CACtB;CACA;CACA;CACA;CACA;CACA;AACF;AACA,MAAM,WAAW,CAAC,WAAW,QAAQ;AACrC,MAAM,UAAU;CAAC;CAAc;CAAc;AAAQ;AACrD,MAAM,gBAAgB,UAAU,KAAK,SAAS,KAAK,KAAK;AAexD,MAAM,MAAM,IAAI,qBAAqB;AAErC,IACG,QAAQ,UAAU,mDAAmD,CAAC,CACtE,OAAO,SAAS,wCAAwC,CAAC,CACzD,OAAO,aAAa,gCAAgC,CAAC,CACrD,OAAO,YAAY,4CAA4C,CAAC,CAChE,OAAO,aAAa,uDAAuD,CAAC,CAC5E,OACC,mBACA,oEAAoE,QAAQ,KAAK,IAAI,EAAE,EACzF,CAAC,CACA,OAAO,mBAAmB,gCAAgC,gBAAgB,KAAK,IAAI,EAAE,EAAE,CAAC,CACxF,OAAO,qBAAqB,kCAAkC,SAAS,KAAK,IAAI,EAAE,EAAE,CAAC,CACrF,OAAO,oBAAoB,sBAAsB,QAAQ,KAAK,IAAI,EAAE,EAAE,CAAC,CACvE,OAAO,qBAAqB,sBAAsB,cAAc,KAAK,IAAI,EAAE,EAAE,CAAC,CAC9E,OAAO,eAAe,6BAA6B,SAAS,KAAK,IAAI,EAAE,IAAI,EAC1E,SAAS,kBAAkB,EAC7B,CAAC,CAAC,CACD,OAAO,IAAI;;AAGd,MAAM,YAAY,aAChB,aAAa,WAAW,aAAa,gCAAgC,SAAS,SAAS,MAAM;AAE/F,SAAS,YAAY,MAAc,OAA2B,SAA4B;CACxF,IAAI,UAAU,KAAA,K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C,WAAW;GACX,OAAO;EACT,CAAC;CACH,CAAC,CACH;CAEA,KAAK,KAAK,oBAAoB,WAAW;AAC3C;AAEA,IAAI,KAAK;AAET,IAAI;CACF,IAAI,MAAM,QAAQ,MAAM,EAAE,KAAK,MAAM,CAAC;CACtC,MAAM,IAAI,kBAAkB;AAC9B,SAAS,GAAG;CACV,QAAQ,MAAM,GAAG,IAAI,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC,CAAC,CAAC;CAChE,QAAQ,KAAK,CAAC;AAChB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants-BXNeGyPA.js","names":["corePkg","mdxPkg","basePkg","astroPkg","versionPkg.dependencies","basePkg.name","basePkg.version"],"sources":["../../create-app-versions/package.json","../../core/package.json","../../mdx/package.json","../../base-ui/package.json","../../astro/package.json","../src/constants.ts"],"sourcesContent":["","","","","","import { fileURLToPath } from 'node:url';\nimport versionPkg from '../../create-app-versions/package.json';\nimport * as corePkg from '../../core/package.json';\nimport * as mdxPkg from '../../mdx/package.json';\nimport * as basePkg from '../../base-ui/package.json';\nimport * as astroPkg from '../../astro/package.json';\n\nexport const sourceDir = fileURLToPath(new URL(`../`, import.meta.url).href);\n\nexport const isCI = Boolean(process.env.CI);\n\nexport interface TemplateInfo {\n value:\n | '+next+fuma-docs-mdx'\n | 'astro'\n | 'waku'\n | 'react-router'\n | 'react-router-spa'\n | 'tanstack-start'\n | 'tanstack-start-spa'\n | '+next+fuma-docs-mdx+static';\n label: string;\n appDir: string;\n /**\n * path to root provider, relative to `appDir`\n */\n rootProviderPath: string;\n hint?: string;\n /**\n * rename files when copying from template\n */\n rename?: (name: string) => string;\n}\n\nexport const templates: TemplateInfo[] = [\n {\n value: '+next+fuma-docs-mdx',\n label: 'Next.js: Fumadocs MDX',\n hint: 'recommended: powerful and mature',\n appDir: '',\n rootProviderPath: 'app/layout.tsx',\n },\n {\n value: 'waku',\n label: 'Waku: Fumadocs MDX',\n hint: 'recommended: fast and simple',\n appDir: 'src',\n rootProviderPath: 'components/provider.tsx',\n },\n {\n value: '+next+fuma-docs-mdx+static',\n label: 'Next.js Static: Fumadocs MDX',\n appDir: '',\n rootProviderPath: 'components/provider.tsx',\n },\n {\n value: 'react-router',\n label: 'React Router: Fumadocs MDX (not RSC)',\n appDir: 'app',\n rootProviderPath: 'root.tsx',\n },\n {\n value: 'react-router-spa',\n label: 'React Router SPA: Fumadocs MDX (not RSC)',\n hint: 'SPA mode allows you to host the site statically, compatible with a CDN.',\n appDir: 'app',\n rootProviderPath: 'root.tsx',\n },\n {\n value: 'tanstack-start',\n label: 'Tanstack Start: Fumadocs MDX (not RSC)',\n appDir: 'src',\n rootProviderPath: 'routes/__root.tsx',\n },\n {\n value: 'tanstack-start-spa',\n label: 'Tanstack Start SPA: Fumadocs MDX (not RSC)',\n hint: 'SPA mode allows you to host the site statically, compatible with a CDN.',\n appDir: 'src',\n rootProviderPath: 'routes/__root.tsx',\n },\n {\n value: 'astro',\n label: 'Astro: Content Collections',\n appDir: 'src',\n rootProviderPath: 'components/provider.tsx',\n },\n];\n\nconst workspaces = [corePkg, mdxPkg, basePkg, astroPkg];\n\nexport const depVersions = versionPkg.dependencies;\n\nfor (const workspace of workspaces) {\n depVersions[workspace.name as keyof typeof depVersions] = workspace.version;\n}\n\ndepVersions['fumadocs-ui'] = `npm:${basePkg.name}@${basePkg.version}`;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAM,aAAa;CAACA;CAASC;CAAQC;CAASC;AAAQ;AAEtD,MAAa,cAAcC;AAE3B,KAAK,MAAM,aAAa,YACtB,YAAY,UAAU,QAAoC,UAAU;AAGtE,YAAY,iBAAiB,OAAOC,OAAa,GAAGC"}
@@ -1,26 +0,0 @@
1
- import { t as depVersions } from "./constants-BXNeGyPA.js";
2
- import { HttpRegistryConnector } from "fuma-cli/registry/connector";
3
- import { getDefaultConfig } from "@fumadocs/cli/config";
4
- import { runFeature } from "@fumadocs/cli/features";
5
- import { loadProject } from "@fumadocs/cli/project";
6
- // src/plugins/feature.ts
7
- /** apply a Fumadocs CLI feature to the generated project */
8
- function feature(feature, options) {
9
- return { async afterWrite() {
10
- const config = await getDefaultConfig(this.dest);
11
- const project = await loadProject(config, this.dest);
12
- await runFeature(feature, options, {
13
- project,
14
- connector: new HttpRegistryConnector("https://fumadocs.dev/registry"),
15
- versions: depVersions,
16
- io: {
17
- log: this.log,
18
- installDependencies: false,
19
- confirmOverwrite: async () => true
20
- }
21
- });
22
- } };
23
- }
24
- export { feature as t };
25
-
26
- //# sourceMappingURL=feature-BSyhSuG1.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"feature-BSyhSuG1.js","names":[],"sources":["../src/plugins/feature.ts"],"sourcesContent":["import type { TemplatePlugin } from '@/index';\nimport { HttpRegistryConnector } from 'fuma-cli/registry/connector';\nimport { getDefaultConfig } from '@fumadocs/cli/config';\nimport { type Feature, runFeature } from '@fumadocs/cli/features';\nimport { loadProject } from '@fumadocs/cli/project';\nimport { depVersions } from '@/constants';\n\n/** apply a Fumadocs CLI feature to the generated project */\nexport function feature<O extends object>(feature: Feature<O>, options: O): TemplatePlugin {\n return {\n async afterWrite() {\n const config = await getDefaultConfig(this.dest);\n const project = await loadProject(config, this.dest);\n\n await runFeature(feature, options, {\n project,\n connector: new HttpRegistryConnector('https://fumadocs.dev/registry'),\n versions: depVersions,\n io: { log: this.log, installDependencies: false, confirmOverwrite: async () => true },\n });\n },\n };\n}\n"],"mappings":";;;;;;;AAQA,SAAgB,QAA0B,SAAqB,SAA4B;CACzF,OAAO,EACL,MAAM,aAAa;EACjB,MAAM,SAAS,MAAM,iBAAiB,KAAK,IAAI;EAC/C,MAAM,UAAU,MAAM,YAAY,QAAQ,KAAK,IAAI;EAEnD,MAAM,WAAW,SAAS,SAAS;GACjC;GACA,WAAW,IAAI,sBAAsB,+BAA+B;GACpE,UAAU;GACV,IAAI;IAAE,KAAK,KAAK;IAAK,qBAAqB;IAAO,kBAAkB,YAAY;GAAK;EACtF,CAAC;CACH,EACF;AACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-DHK1sZ4O.d.ts","names":[],"sources":["../src/auto-install.ts","../src/constants.ts","../src/index.ts"],"mappings":"A,KAEY,yBAAyB;cAExB;UCOI;EACf;EASA;EACA;;;;EAIA;EACA;;;;EAIA,UAAU;;KCxBA,WAAW;UACN;EACf;EACA,UAAU;;;;;;EAOV,iBAAiB;EAEjB;EACA;EACA,OAAO;EACP,UAAU;;UAGK;EACf,UAAU;EACV,MAAM;;;;EAIN;;;;EAKA;;KAGU;EACV;EACA;EACA;EACA,UAAU;EACV,eAAe;EACf,kBAAkB;IAChB;KAEC,UAAU,KAAK,IAAI,QAAQ;UAEf;EACf,YACE,MAAM,KAAK,gCACX,MAAM,iBACH,iBAAiB;EACtB,eACE,MAAM,uBACN,aAAa,oBACV,iBAAiB;EACtB,cAAc,MAAM,0BAA0B;EAC9C,UAAU,MAAM,uBAAuB,oBAAoB;;iBAGvC,OAAO,eAAe,UAAU"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"feature.d.ts","names":[],"sources":["../../src/plugins/feature.ts"],"mappings":";;;wBAQgB,QAAQ,kBAAkB,SAAS,QAAQ,IAAI,SAAS,IAAI"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"next-use-src.d.ts","names":[],"sources":["../../src/plugins/next-use-src.ts"],"mappings":";;;;wBAOgB,cAAc"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"next-use-src.js","names":[],"sources":["../../src/plugins/next-use-src.ts"],"sourcesContent":["import { TemplatePlugin } from '@/index';\nimport path from 'node:path';\nimport fs from 'node:fs/promises';\n\n/**\n * Use `src` for app directory\n */\nexport function nextUseSrc(): TemplatePlugin {\n return {\n template(info) {\n if (!info.value.startsWith('+next')) return;\n\n return {\n ...info,\n appDir: 'src',\n rename: (file) => {\n if (\n isRelative(path.join(this.dest, 'app'), file) ||\n isRelative(path.join(this.dest, 'lib'), file) ||\n isRelative(path.join(this.dest, 'components'), file) ||\n isRootConventionFile(this.dest, file)\n ) {\n return path.join(this.dest, 'src', path.relative(this.dest, file));\n }\n\n return file;\n },\n };\n },\n // update tsconfig.json for src dir\n async afterWrite() {\n if (!this.template.value.startsWith('+next')) return;\n\n const tsconfigPath = path.join(this.dest, 'tsconfig.json');\n const content = await fs.readFile(tsconfigPath, 'utf-8');\n const config = JSON.parse(content);\n\n if (config.compilerOptions?.paths) {\n Object.assign(config.compilerOptions.paths, {\n '@/*': ['./src/*'],\n });\n }\n\n await fs.writeFile(tsconfigPath, JSON.stringify(config, null, 2));\n },\n };\n}\n\n/**\n * Next.js only reads these files from the same level as `app`, so they must move into `src` too.\n */\nconst rootConventionFiles = ['proxy', 'middleware', 'instrumentation', 'instrumentation-client'];\n\nfunction isRootConventionFile(dest: string, file: string) {\n const relative = path.relative(dest, file);\n if (relative.includes(path.sep)) return false;\n\n return rootConventionFiles.includes(relative.replace(/\\.(ts|js|mts|mjs)$/, ''));\n}\n\nfunction isRelative(dir: string, file: string) {\n return !path.relative(dir, file).startsWith(`..${path.sep}`);\n}\n"],"mappings":";;;;;;AAOA,SAAgB,aAA6B;CAC3C,OAAO;EACL,SAAS,MAAM;GACb,IAAI,CAAC,KAAK,MAAM,WAAW,OAAO,GAAG;GAErC,OAAO;IACL,GAAG;IACH,QAAQ;IACR,SAAS,SAAS;KAChB,IACE,WAAW,KAAK,KAAK,KAAK,MAAM,KAAK,GAAG,IAAI,KAC5C,WAAW,KAAK,KAAK,KAAK,MAAM,KAAK,GAAG,IAAI,KAC5C,WAAW,KAAK,KAAK,KAAK,MAAM,YAAY,GAAG,IAAI,KACnD,qBAAqB,KAAK,MAAM,IAAI,GAEpC,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,KAAK,SAAS,KAAK,MAAM,IAAI,CAAC;KAGnE,OAAO;IACT;GACF;EACF;EAEA,MAAM,aAAa;GACjB,IAAI,CAAC,KAAK,SAAS,MAAM,WAAW,OAAO,GAAG;GAE9C,MAAM,eAAe,KAAK,KAAK,KAAK,MAAM,eAAe;GACzD,MAAM,UAAU,MAAM,GAAG,SAAS,cAAc,OAAO;GACvD,MAAM,SAAS,KAAK,MAAM,OAAO;GAEjC,IAAI,OAAO,iBAAiB,OAC1B,OAAO,OAAO,OAAO,gBAAgB,OAAO,EAC1C,OAAO,CAAC,SAAS,EACnB,CAAC;GAGH,MAAM,GAAG,UAAU,cAAc,KAAK,UAAU,QAAQ,MAAM,CAAC,CAAC;EAClE;CACF;AACF;;;;AAKA,MAAM,sBAAsB;CAAC;CAAS;CAAc;CAAmB;AAAwB;AAE/F,SAAS,qBAAqB,MAAc,MAAc;CACxD,MAAM,WAAW,KAAK,SAAS,MAAM,IAAI;CACzC,IAAI,SAAS,SAAS,KAAK,GAAG,GAAG,OAAO;CAExC,OAAO,oBAAoB,SAAS,SAAS,QAAQ,sBAAsB,EAAE,CAAC;AAChF;AAEA,SAAS,WAAW,KAAa,MAAc;CAC7C,OAAO,CAAC,KAAK,SAAS,KAAK,IAAI,CAAC,CAAC,WAAW,KAAK,KAAK,KAAK;AAC7D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"src-55Opr41I.js","names":[],"sources":["../src/auto-install.ts","../src/utils.ts","../src/index.ts"],"sourcesContent":["import { x } from 'tinyexec';\n\nexport type PackageManager = (typeof managers)[number];\n\nexport const managers = ['npm', 'yarn', 'bun', 'pnpm'] as const;\n\nexport function getPackageManager(): PackageManager {\n const userAgent = process.env.npm_config_user_agent ?? '';\n\n if (userAgent.startsWith('yarn')) {\n return 'yarn';\n }\n\n if (userAgent.startsWith('pnpm')) {\n return 'pnpm';\n }\n\n if (userAgent.startsWith('bun')) {\n return 'bun';\n }\n\n return 'npm';\n}\n\nexport async function autoInstall(manager: PackageManager, dest: string) {\n await x(manager, ['install'], {\n throwOnError: true,\n nodeOptions: {\n env: {\n ...process.env,\n NODE_ENV: 'development',\n DISABLE_OPENCOLLECTIVE: '1',\n },\n cwd: dest,\n },\n });\n}\n","import fs from 'node:fs/promises';\nimport path, { join } from 'node:path';\nimport { x } from 'tinyexec';\n\nexport async function copy(\n from: string,\n to: string,\n options: {\n rename?: (s: string) => string;\n filter?: (s: string) => boolean;\n filterDir?: (dir: string) => boolean;\n } = {},\n): Promise<void> {\n const { rename = (s) => s, filterDir = () => true, filter = () => true } = options;\n const stats = await fs.stat(from);\n\n if (stats.isDirectory() && filterDir(from)) {\n const files = await fs.readdir(from);\n\n await Promise.all(\n files.map((file) => copy(path.join(from, file), path.join(to, file), options)),\n );\n }\n\n if (stats.isFile() && filter(from)) {\n to = rename(to);\n await fs.mkdir(path.dirname(to), { recursive: true });\n await fs.copyFile(from, to);\n }\n}\n\nasync function isInGitRepository(cwd: string) {\n const { exitCode } = await x('git', ['rev-parse', '--is-inside-work-tree'], {\n nodeOptions: { cwd },\n });\n\n return exitCode === 0;\n}\n\nasync function isDefaultBranchSet(cwd: string) {\n const { exitCode } = await x('git', ['config', 'init.defaultBranch'], {\n nodeOptions: { cwd },\n });\n\n return exitCode === 0;\n}\n\n/*\nInitialize a Git repo on the project.\n\nBased on https://github.com/vercel/next.js/blob/canary/packages/create-next-app/helpers/git.ts\n*/\nexport async function tryGitInit(cwd: string): Promise<boolean> {\n const { exitCode } = await x('git', ['--version']);\n if (exitCode !== 0) return false;\n\n if (await isInGitRepository(cwd)) return false;\n\n try {\n await x('git', ['init'], {\n throwOnError: true,\n nodeOptions: { cwd },\n });\n\n if (!(await isDefaultBranchSet(cwd))) {\n await x('git', ['checkout', '-b', 'main'], {\n throwOnError: true,\n nodeOptions: {\n cwd,\n },\n });\n }\n\n await x('git', ['add', '-A'], {\n throwOnError: true,\n nodeOptions: {\n cwd,\n },\n });\n\n await x('git', ['commit', '-m', 'Initial commit from Create Fumadocs App'], {\n throwOnError: true,\n nodeOptions: {\n cwd,\n },\n });\n return true;\n } catch {\n await fs.rm(join(cwd, '.git'), { recursive: true, force: true });\n\n return false;\n }\n}\n","import path from 'node:path';\nimport fs from 'node:fs/promises';\nimport { copy, tryGitInit } from '@/utils';\nimport type { PackageManager } from './auto-install';\nimport { autoInstall } from './auto-install';\nimport { depVersions, sourceDir, type TemplateInfo, templates } from './constants';\n\nexport type Template = TemplateInfo['value'];\nexport interface Options {\n outputDir: string;\n template: Template;\n\n /**\n * the package manager to use\n *\n * @defaultValue 'npm'\n */\n packageManager?: PackageManager;\n\n installDeps?: boolean;\n initializeGit?: boolean;\n log?: (message: string) => void;\n plugins?: TemplatePlugin[];\n}\n\nexport interface TemplatePluginContext {\n template: TemplateInfo;\n log: (message: string) => void;\n /**\n * output directory\n */\n dest: string;\n\n /**\n * output directory for app code (e.g. under `/src`)\n */\n appDir: string;\n}\n\nexport type PackageJsonType = {\n name?: string;\n version?: string;\n private?: boolean;\n scripts?: Record<string, string>;\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n} & Record<string, unknown>;\n\ntype Awaitable<T> = T | Promise<T>;\n\nexport interface TemplatePlugin {\n template?: (\n this: Pick<TemplatePluginContext, 'dest'>,\n info: TemplateInfo,\n ) => Awaitable<void | TemplateInfo>;\n packageJson?: (\n this: TemplatePluginContext,\n packageJson: PackageJsonType,\n ) => Awaitable<void | PackageJsonType>;\n afterWrite?: (this: TemplatePluginContext) => Awaitable<void>;\n readme?: (this: TemplatePluginContext, content: string) => Awaitable<void | string>;\n}\n\nexport async function create(createOptions: Options): Promise<void> {\n const {\n outputDir,\n plugins = [],\n packageManager = 'npm',\n initializeGit = false,\n installDeps = false,\n log = console.log,\n } = createOptions;\n\n let template = templates.find((item) => item.value === createOptions.template)!;\n for (const plugin of plugins) {\n template = (await plugin.template?.call({ dest: outputDir }, template)) ?? template;\n }\n\n const appDir = path.join(outputDir, template.appDir);\n const projectName = path.basename(outputDir);\n const pluginContext: TemplatePluginContext = {\n template,\n dest: outputDir,\n log,\n appDir,\n };\n\n await copy(path.join(sourceDir, 'template', template.value), outputDir, {\n rename(file) {\n file = file.replace('example.gitignore', '.gitignore');\n\n return template.rename?.(file) ?? file;\n },\n });\n\n const packageJsonPath = path.join(outputDir, 'package.json');\n let packageJson = await initPackageJson(projectName, packageJsonPath);\n for (const plugin of plugins) {\n packageJson = (await plugin.packageJson?.call(pluginContext, packageJson)) ?? packageJson;\n }\n await fs.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2));\n\n const readmePath = path.join(outputDir, 'README.md');\n let readme = `# ${projectName}\\n\\n${await fs.readFile(readmePath)}`;\n for (const plugin of plugins) {\n readme = (await plugin.readme?.call(pluginContext, readme)) ?? readme;\n }\n await fs.writeFile(readmePath, readme);\n\n for (const plugin of plugins) {\n await plugin.afterWrite?.call(pluginContext);\n }\n\n if (installDeps) {\n try {\n await autoInstall(packageManager, outputDir);\n log('Installed dependencies');\n } catch (err) {\n log(`Failed to install dependencies: ${err}`);\n }\n }\n\n if (initializeGit && (await tryGitInit(outputDir))) {\n log('Initialized Git repository');\n }\n}\n\nasync function initPackageJson(\n projectName: string,\n packageJsonPath: string,\n): Promise<PackageJsonType> {\n function replaceWorkspaceDeps(deps: Record<string, string> = {}) {\n for (const k in deps) {\n if (deps[k].startsWith('workspace:') && k in depVersions) {\n deps[k] = depVersions[k as keyof typeof depVersions];\n }\n }\n\n return deps;\n }\n\n const packageJson: PackageJsonType = JSON.parse(await fs.readFile(packageJsonPath, 'utf-8'));\n const dependencies = replaceWorkspaceDeps(packageJson.dependencies);\n const devDependencies = replaceWorkspaceDeps(packageJson.devDependencies);\n const scripts = { ...packageJson.scrip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