create-fumadocs-app 16.0.0 → 16.0.2

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.
Files changed (72) hide show
  1. package/dist/{chunk-KVKS2K3W.js → chunk-6C2B326N.js} +198 -196
  2. package/dist/create-app.d.ts +35 -8
  3. package/dist/create-app.js +3 -5
  4. package/dist/index.js +110 -32
  5. package/package.json +3 -2
  6. package/template/+next+fuma-docs-mdx/app/(home)/page.tsx +16 -0
  7. package/template/{+next+tailwindcss → +next+fuma-docs-mdx}/app/layout.tsx +1 -1
  8. package/template/{+next → +next+fuma-docs-mdx}/example.gitignore +0 -2
  9. package/template/+next+fuma-docs-mdx/lib/layout.shared.tsx +9 -0
  10. package/template/+next+fuma-docs-mdx/lib/source.ts +1 -1
  11. package/template/{+next → +next+fuma-docs-mdx}/mdx-components.tsx +0 -1
  12. package/template/+next+fuma-docs-mdx/package.json +29 -0
  13. package/template/+next+fuma-docs-mdx/source.config.ts +1 -0
  14. package/template/+next+fuma-docs-mdx/tsconfig.json +2 -2
  15. package/template/{+next → +orama-cloud/+next+fuma-docs-mdx}/app/layout.tsx +4 -9
  16. package/template/+orama-cloud/+next+fuma-docs-mdx/app/static.json/route.ts +7 -0
  17. package/template/+orama-cloud/@app/components/search.tsx +59 -0
  18. package/template/+orama-cloud/@app/lib/export-static-indexes.ts +14 -0
  19. package/template/+orama-cloud/@root/.env.example +6 -0
  20. package/template/+orama-cloud/react-router/app/root.tsx +76 -0
  21. package/template/+orama-cloud/react-router/app/routes/static.ts +5 -0
  22. package/template/+orama-cloud/react-router/app/routes.ts +8 -0
  23. package/template/+orama-cloud/react-router-spa/app/root.tsx +76 -0
  24. package/template/+orama-cloud/react-router-spa/app/routes/static.ts +5 -0
  25. package/template/+orama-cloud/react-router-spa/app/routes.ts +8 -0
  26. package/template/+orama-cloud/tanstack-start/src/routes/__root.tsx +51 -0
  27. package/template/+orama-cloud/tanstack-start/src/routes/static[.]json.ts +10 -0
  28. package/template/+orama-cloud/tanstack-start/vite.config.ts +27 -0
  29. package/template/+orama-cloud/waku/src/components/provider.tsx +8 -0
  30. package/template/+orama-cloud/waku/src/pages/api/static.json.ts +9 -0
  31. package/template/react-router/app/docs/page.tsx +4 -4
  32. package/template/react-router/example.gitignore +0 -1
  33. package/template/react-router-spa/README.md +12 -0
  34. package/template/react-router-spa/app/app.css +3 -0
  35. package/template/react-router-spa/app/components/search.tsx +50 -0
  36. package/template/react-router-spa/app/docs/page.tsx +53 -0
  37. package/template/react-router-spa/app/docs/search.ts +10 -0
  38. package/template/react-router-spa/app/lib/layout.shared.tsx +9 -0
  39. package/template/react-router-spa/app/lib/source.ts +7 -0
  40. package/template/react-router-spa/app/root.tsx +76 -0
  41. package/template/react-router-spa/app/routes/home.tsx +30 -0
  42. package/template/react-router-spa/app/routes.ts +7 -0
  43. package/template/react-router-spa/content/docs/index.mdx +32 -0
  44. package/template/react-router-spa/content/docs/test.mdx +24 -0
  45. package/template/react-router-spa/example.gitignore +7 -0
  46. package/template/react-router-spa/package.json +36 -0
  47. package/template/react-router-spa/public/favicon.ico +0 -0
  48. package/template/react-router-spa/react-router.config.ts +18 -0
  49. package/template/react-router-spa/serve.json +3 -0
  50. package/template/react-router-spa/source.config.ts +7 -0
  51. package/template/react-router-spa/tsconfig.json +28 -0
  52. package/template/react-router-spa/vite.config.ts +10 -0
  53. package/template/tanstack-start/example.gitignore +9 -1
  54. package/template/tanstack-start/package.json +6 -6
  55. package/template/waku/example.gitignore +3 -1
  56. package/template/waku/package.json +3 -3
  57. package/template/+next/README.md +0 -37
  58. package/template/+next/app/(home)/page.tsx +0 -42
  59. package/template/+next/lib/layout.shared.tsx +0 -30
  60. package/template/+next+content-collections/app/docs/[[...slug]]/page.tsx +0 -51
  61. package/template/+next+content-collections/content-collections.ts +0 -26
  62. package/template/+next+content-collections/lib/source.ts +0 -8
  63. package/template/+next+content-collections/next.config.mjs +0 -8
  64. package/template/+next+content-collections/tsconfig.json +0 -35
  65. package/template/+next+tailwindcss/app/(home)/page.tsx +0 -19
  66. package/template/{+next → +next+fuma-docs-mdx}/app/(home)/layout.tsx +0 -0
  67. package/template/{+next → +next+fuma-docs-mdx}/app/api/search/route.ts +0 -0
  68. package/template/{+next → +next+fuma-docs-mdx}/app/docs/layout.tsx +1 -1
  69. /package/template/{+next+tailwindcss → +next+fuma-docs-mdx}/app/global.css +0 -0
  70. /package/template/{+next → +next+fuma-docs-mdx}/content/docs/index.mdx +0 -0
  71. /package/template/{+next → +next+fuma-docs-mdx}/content/docs/test.mdx +0 -0
  72. /package/template/{+next+tailwindcss → +next+fuma-docs-mdx}/postcss.config.mjs +0 -0
@@ -1,11 +1,32 @@
1
1
  // src/create-app.ts
2
- import path from "path";
2
+ import path2 from "path";
3
3
  import fs2 from "fs/promises";
4
4
 
5
- // src/git.ts
6
- import * as fs from "fs/promises";
7
- import { join } from "path";
5
+ // src/utils.ts
6
+ import fs from "fs/promises";
7
+ import path, { join } from "path";
8
8
  import { x } from "tinyexec";
9
+ async function copy(from, to, options = {}) {
10
+ const {
11
+ rename = (s) => s,
12
+ filterDir = () => true,
13
+ filter = () => true
14
+ } = options;
15
+ const stats = await fs.stat(from);
16
+ if (stats.isDirectory() && filterDir(from)) {
17
+ const files = await fs.readdir(from);
18
+ await Promise.all(
19
+ files.map(
20
+ (file) => copy(path.join(from, file), path.join(to, file), options)
21
+ )
22
+ );
23
+ }
24
+ if (stats.isFile() && filter(from)) {
25
+ to = rename(to);
26
+ await fs.mkdir(path.dirname(to), { recursive: true });
27
+ await fs.copyFile(from, to);
28
+ }
29
+ }
9
30
  async function isInGitRepository(cwd2) {
10
31
  const { exitCode } = await x("git", ["rev-parse", "--is-inside-work-tree"], {
11
32
  nodeOptions: { cwd: cwd2 }
@@ -57,9 +78,51 @@ async function tryGitInit(cwd2) {
57
78
  return false;
58
79
  }
59
80
  }
81
+ function pick(obj, keys) {
82
+ const result = {};
83
+ for (const key of keys) {
84
+ if (key in obj) {
85
+ result[key] = obj[key];
86
+ }
87
+ }
88
+ return result;
89
+ }
90
+
91
+ // src/auto-install.ts
92
+ import { x as x2 } from "tinyexec";
93
+ var managers = ["npm", "yarn", "bun", "pnpm"];
94
+ function getPackageManager() {
95
+ const userAgent = process.env.npm_config_user_agent ?? "";
96
+ if (userAgent.startsWith("yarn")) {
97
+ return "yarn";
98
+ }
99
+ if (userAgent.startsWith("pnpm")) {
100
+ return "pnpm";
101
+ }
102
+ if (userAgent.startsWith("bun")) {
103
+ return "bun";
104
+ }
105
+ return "npm";
106
+ }
107
+ async function autoInstall(manager, dest) {
108
+ await x2(manager, ["install"], {
109
+ throwOnError: true,
110
+ nodeOptions: {
111
+ env: {
112
+ ...process.env,
113
+ NODE_ENV: "development",
114
+ DISABLE_OPENCOLLECTIVE: "1"
115
+ },
116
+ cwd: dest
117
+ }
118
+ });
119
+ }
120
+
121
+ // src/constants.ts
122
+ import { fileURLToPath } from "url";
60
123
 
61
124
  // src/versions.js
62
- var versions = { "fumadocs-core": "16.0.0", "fumadocs-ui": "16.0.0", "fumadocs-mdx": "13.0.0", "@fumadocs/mdx-remote": "1.4.3", "@fumadocs/content-collections": "1.2.4" };
125
+ var versions = { "fumadocs-core": "16.0.2", "fumadocs-ui": "16.0.2", "fumadocs-mdx": "13.0.0", "@fumadocs/mdx-remote": "1.4.3", "@fumadocs/content-collections": "1.2.4" };
63
126
 
64
127
  // ../create-app-versions/package.json
65
128
  var package_default = {
@@ -72,6 +135,7 @@ var package_default = {
72
135
  "@content-collections/core": "^0.11.1",
73
136
  "@content-collections/mdx": "^0.2.2",
74
137
  "@content-collections/next": "^0.2.8",
138
+ "@orama/core": "^1.2.13",
75
139
  "@react-router/dev": "^7.9.4",
76
140
  "@react-router/node": "^7.9.4",
77
141
  "@react-router/serve": "^7.9.4",
@@ -103,60 +167,58 @@ var package_default = {
103
167
  }
104
168
  };
105
169
 
106
- // src/auto-install.ts
107
- import { x as x2 } from "tinyexec";
108
- var managers = ["npm", "yarn", "bun", "pnpm"];
109
- function getPackageManager() {
110
- const userAgent = process.env.npm_config_user_agent ?? "";
111
- if (userAgent.startsWith("yarn")) {
112
- return "yarn";
113
- }
114
- if (userAgent.startsWith("pnpm")) {
115
- return "pnpm";
116
- }
117
- if (userAgent.startsWith("bun")) {
118
- return "bun";
119
- }
120
- return "npm";
121
- }
122
- async function autoInstall(manager, dest) {
123
- await x2(manager, ["install"], {
124
- throwOnError: true,
125
- nodeOptions: {
126
- env: {
127
- ...process.env,
128
- NODE_ENV: "development",
129
- DISABLE_OPENCOLLECTIVE: "1"
130
- },
131
- cwd: dest
132
- }
133
- });
134
- }
135
-
136
170
  // src/constants.ts
137
- import { fileURLToPath } from "url";
138
171
  var sourceDir = fileURLToPath(new URL(`../`, import.meta.url).href);
139
172
  var cwd = process.cwd();
140
-
141
- // src/create-app.ts
142
173
  var templates = [
143
- "+next+content-collections",
144
- "+next+fuma-docs-mdx",
145
- "react-router",
146
- "tanstack-start",
147
- "waku"
174
+ {
175
+ value: "+next+fuma-docs-mdx",
176
+ label: "Next.js: Fumadocs MDX",
177
+ hint: "recommended",
178
+ componentsDir: "components"
179
+ },
180
+ {
181
+ value: "waku",
182
+ label: "Waku: Fumadocs MDX",
183
+ componentsDir: "src/components"
184
+ },
185
+ {
186
+ value: "react-router",
187
+ label: "React Router: Fumadocs MDX (not RSC)",
188
+ componentsDir: "app/components"
189
+ },
190
+ {
191
+ value: "react-router-spa",
192
+ label: "React Router SPA: Fumadocs MDX (not RSC)",
193
+ hint: "SPA mode allows you to host the site statically, compatible with a CDN.",
194
+ componentsDir: "app/components"
195
+ },
196
+ {
197
+ value: "tanstack-start",
198
+ label: "Tanstack Start: Fumadocs MDX (not RSC)",
199
+ componentsDir: "src/components"
200
+ }
148
201
  ];
202
+ var depVersions = {
203
+ ...versions,
204
+ ...package_default.dependencies
205
+ };
206
+
207
+ // src/create-app.ts
149
208
  function defaults(options) {
150
209
  return {
151
210
  ...options,
152
- useSrcDir: options.useSrcDir ?? false,
153
- tailwindcss: options.tailwindcss ?? true,
211
+ plugins: options.plugins ?? [],
212
+ useSrcDir: options.template.startsWith("+next") && options.useSrcDir === true,
154
213
  lint: options.lint ?? false,
155
214
  initializeGit: options.initializeGit ?? false,
156
215
  installDeps: options.installDeps ?? false,
157
216
  log: console.log
158
217
  };
159
218
  }
219
+ function isRelative(dir, file) {
220
+ return !path2.relative(dir, file).startsWith(`..${path2.sep}`);
221
+ }
160
222
  async function create(createOptions) {
161
223
  const options = defaults(createOptions);
162
224
  const {
@@ -168,72 +230,57 @@ async function create(createOptions) {
168
230
  lint,
169
231
  initializeGit,
170
232
  packageManager,
171
- tailwindcss
233
+ plugins
172
234
  } = options;
173
- const projectName = path.basename(outputDir);
174
- const dest = path.resolve(cwd, outputDir);
235
+ const projectName = path2.basename(outputDir);
236
+ const dest = path2.resolve(cwd, outputDir);
175
237
  const isNext = options.template.startsWith("+next");
176
- function isRelative(dir, file) {
177
- return !path.relative(path.join(dest, dir), file).startsWith(`..${path.sep}`);
178
- }
179
- function defaultRename(file) {
180
- file = file.replace("example.gitignore", ".gitignore");
181
- if (!useSrcDir || !isNext) {
238
+ const pluginContext = {
239
+ template: templates.find((item) => item.value === template),
240
+ dest,
241
+ options
242
+ };
243
+ await copy(path2.join(sourceDir, `template/${template}`), dest, {
244
+ rename(file) {
245
+ file = file.replace("example.gitignore", ".gitignore");
246
+ if (useSrcDir && (path2.basename(file) === "mdx-components.tsx" || isRelative(path2.join(dest, "app"), file) || isRelative(path2.join(dest, "lib"), file))) {
247
+ return path2.join(dest, "src", path2.relative(dest, file));
248
+ }
182
249
  return file;
183
250
  }
184
- if (path.basename(file) === "mdx-components.tsx" || isRelative("app", file) || isRelative("lib", file)) {
185
- return path.join(dest, "src", path.relative(dest, file));
186
- }
187
- return file;
251
+ });
252
+ if (isNext && lint) {
253
+ await copy(path2.join(sourceDir, `template/+next+${lint}`), dest);
254
+ log("Configured Linter");
188
255
  }
189
- if (isNext) {
190
- await copy(path.join(sourceDir, `template/+next`), dest, defaultRename);
191
- await copy(
192
- path.join(sourceDir, `template/${template}`),
193
- dest,
194
- defaultRename
195
- );
196
- if (tailwindcss) {
197
- await copy(
198
- path.join(sourceDir, `template/+next+tailwindcss`),
199
- dest,
200
- defaultRename
201
- );
202
- log("Configured Tailwind CSS");
203
- }
204
- if (lint) {
205
- await copy(
206
- path.join(sourceDir, `template/+next+${lint}`),
207
- dest,
208
- defaultRename
209
- );
210
- log("Configured Linter");
211
- }
212
- if (useSrcDir) {
213
- const tsconfigPath = path.join(dest, "tsconfig.json");
214
- const content = (await fs2.readFile(tsconfigPath)).toString();
215
- const config = JSON.parse(content);
216
- if (config.compilerOptions?.paths) {
217
- Object.assign(config.compilerOptions.paths, {
218
- "@/*": ["./src/*"]
219
- });
220
- }
221
- await fs2.writeFile(tsconfigPath, JSON.stringify(config, null, 2));
256
+ if (isNext && useSrcDir) {
257
+ const tsconfigPath = path2.join(dest, "tsconfig.json");
258
+ const content = (await fs2.readFile(tsconfigPath)).toString();
259
+ const config = JSON.parse(content);
260
+ if (config.compilerOptions?.paths) {
261
+ Object.assign(config.compilerOptions.paths, {
262
+ "@/*": ["./src/*"]
263
+ });
222
264
  }
223
- } else {
224
- await copy(
225
- path.join(sourceDir, `template/${template}`),
226
- dest,
227
- defaultRename
228
- );
265
+ await fs2.writeFile(tsconfigPath, JSON.stringify(config, null, 2));
266
+ }
267
+ let packageJson = await createPackageJson(projectName, dest, options);
268
+ for (const plugin of plugins) {
269
+ const result = await plugin.packageJson?.call(pluginContext, packageJson);
270
+ if (result) packageJson = result;
229
271
  }
230
- const packageJson = isNext ? await createNextPackageJson(projectName, options) : await createPackageJson(projectName, dest);
231
272
  await fs2.writeFile(
232
- path.join(dest, "package.json"),
273
+ path2.join(dest, "package.json"),
233
274
  JSON.stringify(packageJson, null, 2)
234
275
  );
235
- const readMe = await getReadme(dest, projectName);
236
- await fs2.writeFile(path.join(dest, "README.md"), readMe);
276
+ let readme = await getReadme(dest, projectName);
277
+ for (const plugin of plugins) {
278
+ readme = await plugin.readme?.call(pluginContext, readme) ?? readme;
279
+ }
280
+ await fs2.writeFile(path2.join(dest, "README.md"), readme);
281
+ for (const plugin of plugins) {
282
+ await plugin.afterWrite?.call(pluginContext);
283
+ }
237
284
  if (installDeps) {
238
285
  try {
239
286
  await autoInstall(packageManager, dest);
@@ -247,124 +294,79 @@ async function create(createOptions) {
247
294
  }
248
295
  }
249
296
  async function getReadme(dest, projectName) {
250
- const template = await fs2.readFile(path.join(dest, "README.md")).then((res) => res.toString());
297
+ const template = await fs2.readFile(path2.join(dest, "README.md")).then((res) => res.toString());
251
298
  return `# ${projectName}
252
299
 
253
300
  ${template}`;
254
301
  }
255
- async function copy(from, to, rename = (s) => s) {
256
- const stats = await fs2.stat(from);
257
- if (stats.isDirectory()) {
258
- const files = await fs2.readdir(from);
259
- await Promise.all(
260
- files.map(
261
- (file) => copy(path.join(from, file), rename(path.join(to, file)))
262
- )
263
- );
264
- } else {
265
- await fs2.mkdir(path.dirname(to), { recursive: true });
266
- await fs2.copyFile(from, to);
267
- }
268
- }
269
- async function createNextPackageJson(projectName, { template, lint, tailwindcss }) {
270
- return {
271
- name: projectName,
272
- version: "0.0.0",
273
- private: true,
274
- scripts: {
275
- build: "next build",
276
- dev: "next dev --turbo",
277
- start: "next start",
278
- ...template === "+next+fuma-docs-mdx" && {
279
- postinstall: "fumadocs-mdx"
280
- },
281
- ...lint && {
282
- eslint: {
283
- lint: "eslint"
284
- },
285
- biome: { lint: "biome check", format: "biome format --write" }
286
- }[lint]
287
- },
288
- dependencies: {
289
- ...pick(package_default.dependencies, [
290
- "next",
291
- "react",
292
- "react-dom",
293
- "lucide-react"
294
- ]),
295
- ...pick(versions, ["fumadocs-ui", "fumadocs-core"]),
296
- ...{
297
- "+next+content-collections": {
298
- ...pick(package_default.dependencies, [
299
- "@content-collections/mdx",
300
- "@content-collections/core",
301
- "@content-collections/next"
302
- ]),
303
- ...pick(versions, ["@fumadocs/content-collections"])
304
- },
305
- "+next+fuma-docs-mdx": pick(versions, ["fumadocs-mdx"]),
306
- waku: null,
307
- "tanstack-start": null,
308
- "react-router": null
309
- }[template]
310
- },
311
- devDependencies: {
312
- ...pick(package_default.dependencies, [
313
- "@types/node",
314
- "@types/react",
315
- "@types/react-dom",
316
- "typescript",
317
- "@types/mdx"
318
- ]),
319
- ...tailwindcss && pick(package_default.dependencies, [
320
- "@tailwindcss/postcss",
321
- "tailwindcss",
322
- "postcss"
323
- ]),
324
- ...lint && {
325
- eslint: {
326
- eslint: "^9",
327
- "eslint-config-next": package_default.dependencies.next,
328
- "@eslint/eslintrc": "^3"
329
- },
330
- biome: pick(package_default.dependencies, ["@biomejs/biome"])
331
- }[lint]
332
- }
333
- };
334
- }
335
- async function createPackageJson(projectName, dir) {
302
+ async function createPackageJson(projectName, dir, { template, lint }) {
303
+ const isNext = template.startsWith("+next");
336
304
  function replaceWorkspaceDeps(deps) {
337
305
  for (const k in deps) {
338
- if (deps[k].startsWith("workspace:") && k in versions) {
339
- deps[k] = versions[k];
306
+ if (deps[k].startsWith("workspace:") && k in depVersions) {
307
+ deps[k] = depVersions[k];
340
308
  }
341
309
  }
342
310
  return deps;
343
311
  }
344
- const packageJson = JSON.parse(
345
- await fs2.readFile(path.join(dir, "package.json")).then((res) => res.toString())
312
+ let packageJson = JSON.parse(
313
+ await fs2.readFile(path2.join(dir, "package.json")).then((res) => res.toString())
346
314
  );
347
- return {
315
+ packageJson = {
348
316
  name: projectName,
349
317
  ...packageJson,
350
318
  dependencies: replaceWorkspaceDeps(packageJson.dependencies),
351
319
  devDependencies: replaceWorkspaceDeps(packageJson.devDependencies)
352
320
  };
353
- }
354
- function pick(obj, keys) {
355
- const result = {};
356
- for (const key of keys) {
357
- if (key in obj) {
358
- result[key] = obj[key];
359
- }
321
+ if (isNext) {
322
+ packageJson = {
323
+ ...packageJson,
324
+ scripts: {
325
+ ...packageJson.scripts,
326
+ postinstall: "fumadocs-mdx"
327
+ }
328
+ };
360
329
  }
361
- return result;
330
+ if (isNext && lint === "biome") {
331
+ packageJson = {
332
+ ...packageJson,
333
+ scripts: {
334
+ ...packageJson.scripts,
335
+ lint: "biome check",
336
+ format: "biome format --write"
337
+ },
338
+ devDependencies: {
339
+ ...packageJson.devDependencies,
340
+ ...pick(depVersions, ["@biomejs/biome"])
341
+ }
342
+ };
343
+ }
344
+ if (isNext && lint === "eslint") {
345
+ packageJson = {
346
+ ...packageJson,
347
+ scripts: {
348
+ ...packageJson.scripts,
349
+ lint: "eslint"
350
+ },
351
+ devDependencies: {
352
+ ...packageJson.devDependencies,
353
+ eslint: "^9",
354
+ "eslint-config-next": depVersions.next,
355
+ "@eslint/eslintrc": "^3"
356
+ }
357
+ };
358
+ }
359
+ return packageJson;
362
360
  }
363
361
 
364
362
  export {
363
+ copy,
364
+ pick,
365
365
  managers,
366
366
  getPackageManager,
367
+ sourceDir,
367
368
  cwd,
368
369
  templates,
370
+ depVersions,
369
371
  create
370
372
  };
@@ -1,8 +1,25 @@
1
1
  type PackageManager = (typeof managers)[number];
2
2
  declare const managers: readonly ["npm", "yarn", "bun", "pnpm"];
3
3
 
4
- declare const templates: readonly ["+next+content-collections", "+next+fuma-docs-mdx", "react-router", "tanstack-start", "waku"];
5
- type Template = (typeof templates)[number];
4
+ interface TemplateInfo {
5
+ label: string;
6
+ value: string;
7
+ hint?: string;
8
+ componentsDir: string;
9
+ }
10
+ declare const templates: ({
11
+ value: string;
12
+ label: string;
13
+ hint: string;
14
+ componentsDir: string;
15
+ } | {
16
+ value: string;
17
+ label: string;
18
+ componentsDir: string;
19
+ hint?: undefined;
20
+ })[];
21
+
22
+ type Template = (typeof templates)[number]['value'];
6
23
  interface Options {
7
24
  outputDir: string;
8
25
  template: Template;
@@ -15,11 +32,6 @@ interface Options {
15
32
  * @defaultValue false
16
33
  */
17
34
  useSrcDir?: boolean;
18
- /**
19
- * (Next.js only) Configure Tailwind CSS
20
- * @defaultValue true
21
- */
22
- tailwindcss?: boolean;
23
35
  /**
24
36
  * (Next.js Only) Configure Lint
25
37
  * @defaultValue false
@@ -28,7 +40,22 @@ interface Options {
28
40
  installDeps?: boolean;
29
41
  initializeGit?: boolean;
30
42
  log?: (message: string) => void;
43
+ plugins?: TemplatePlugin[];
44
+ }
45
+ interface TemplatePluginContext {
46
+ template: TemplateInfo;
47
+ options: Required<Options>;
48
+ /**
49
+ * output directory
50
+ */
51
+ dest: string;
52
+ }
53
+ type Awaitable<T> = T | Promise<T>;
54
+ interface TemplatePlugin {
55
+ packageJson?: (this: TemplatePluginContext, packageJson: any) => Awaitable<void | any>;
56
+ afterWrite?: (this: TemplatePluginContext) => Awaitable<void>;
57
+ readme?: (this: TemplatePluginContext, content: string) => Awaitable<void | string>;
31
58
  }
32
59
  declare function create(createOptions: Options): Promise<void>;
33
60
 
34
- export { type Options, type Template, create, templates };
61
+ export { type Options, type Template, type TemplatePlugin, type TemplatePluginContext, create };
@@ -1,8 +1,6 @@
1
1
  import {
2
- create,
3
- templates
4
- } from "./chunk-KVKS2K3W.js";
2
+ create
3
+ } from "./chunk-6C2B326N.js";
5
4
  export {
6
- create,
7
- templates
5
+ create
8
6
  };