create-krispya 0.1.0 → 0.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.
Files changed (59) hide show
  1. package/dist/cli.cjs +550 -0
  2. package/dist/cli.d.cts +1 -0
  3. package/dist/cli.d.mts +1 -0
  4. package/dist/cli.d.ts +1 -2
  5. package/dist/cli.mjs +531 -0
  6. package/dist/index.cjs +1688 -0
  7. package/dist/index.d.cts +148 -0
  8. package/dist/index.d.mts +148 -0
  9. package/dist/index.d.ts +89 -27
  10. package/dist/index.mjs +1676 -0
  11. package/package.json +6 -5
  12. package/dist/cli.js +0 -497
  13. package/dist/constants.d.ts +0 -33
  14. package/dist/constants.js +0 -110
  15. package/dist/index.js +0 -394
  16. package/dist/integrations/biome.d.ts +0 -8
  17. package/dist/integrations/biome.js +0 -80
  18. package/dist/integrations/drei.d.ts +0 -3
  19. package/dist/integrations/drei.js +0 -9
  20. package/dist/integrations/eslint.d.ts +0 -3
  21. package/dist/integrations/eslint.js +0 -78
  22. package/dist/integrations/fiber.d.ts +0 -8
  23. package/dist/integrations/fiber.js +0 -35
  24. package/dist/integrations/github-pages.d.ts +0 -3
  25. package/dist/integrations/github-pages.js +0 -58
  26. package/dist/integrations/handle.d.ts +0 -3
  27. package/dist/integrations/handle.js +0 -7
  28. package/dist/integrations/koota.d.ts +0 -8
  29. package/dist/integrations/koota.js +0 -7
  30. package/dist/integrations/leva.d.ts +0 -3
  31. package/dist/integrations/leva.js +0 -7
  32. package/dist/integrations/offscreen.d.ts +0 -3
  33. package/dist/integrations/offscreen.js +0 -12
  34. package/dist/integrations/oxfmt.d.ts +0 -3
  35. package/dist/integrations/oxfmt.js +0 -27
  36. package/dist/integrations/oxlint.d.ts +0 -3
  37. package/dist/integrations/oxlint.js +0 -52
  38. package/dist/integrations/postprocessing.d.ts +0 -3
  39. package/dist/integrations/postprocessing.js +0 -12
  40. package/dist/integrations/prettier.d.ts +0 -3
  41. package/dist/integrations/prettier.js +0 -28
  42. package/dist/integrations/rapier.d.ts +0 -3
  43. package/dist/integrations/rapier.js +0 -7
  44. package/dist/integrations/triplex.d.ts +0 -26
  45. package/dist/integrations/triplex.js +0 -159
  46. package/dist/integrations/uikit.d.ts +0 -3
  47. package/dist/integrations/uikit.js +0 -7
  48. package/dist/integrations/viverse.d.ts +0 -3
  49. package/dist/integrations/viverse.js +0 -74
  50. package/dist/integrations/xr.d.ts +0 -5
  51. package/dist/integrations/xr.js +0 -51
  52. package/dist/integrations/zustand.d.ts +0 -8
  53. package/dist/integrations/zustand.js +0 -7
  54. package/dist/lib/array.d.ts +0 -1
  55. package/dist/lib/array.js +0 -9
  56. package/dist/merge.d.ts +0 -1
  57. package/dist/merge.js +0 -26
  58. package/dist/utils.d.ts +0 -22
  59. package/dist/utils.js +0 -123
package/dist/cli.cjs ADDED
@@ -0,0 +1,550 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+
4
+ const process$1 = require('process');
5
+ const index = require('./index.cjs');
6
+ const path = require('path');
7
+ const promises = require('fs/promises');
8
+ const commander = require('commander');
9
+ const p = require('@clack/prompts');
10
+ const color = require('chalk');
11
+ const undici = require('undici');
12
+
13
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
14
+
15
+ function _interopNamespaceCompat(e) {
16
+ if (e && typeof e === 'object' && 'default' in e) return e;
17
+ const n = Object.create(null);
18
+ if (e) {
19
+ for (const k in e) {
20
+ n[k] = e[k];
21
+ }
22
+ }
23
+ n.default = e;
24
+ return n;
25
+ }
26
+
27
+ const p__namespace = /*#__PURE__*/_interopNamespaceCompat(p);
28
+ const color__default = /*#__PURE__*/_interopDefaultCompat(color);
29
+
30
+ function getDefaultProjectName(template) {
31
+ const base = index.getBaseTemplate(template);
32
+ switch (base) {
33
+ case "vanilla":
34
+ return `vanilla-${index.generateRandomName()}`;
35
+ case "react":
36
+ return `react-${index.generateRandomName()}`;
37
+ case "r3f":
38
+ return `react-three-${index.generateRandomName()}`;
39
+ }
40
+ }
41
+ function getDefaultOptions(template, name, projectType = "app", libraryBundler) {
42
+ const baseTemplate = index.getBaseTemplate(template);
43
+ const base = {
44
+ name,
45
+ template,
46
+ projectType,
47
+ libraryBundler: projectType === "library" ? libraryBundler ?? "unbuild" : void 0,
48
+ packageManager: "pnpm",
49
+ pnpmManageVersions: true,
50
+ nodeVersion: "latest",
51
+ linter: "oxlint",
52
+ formatter: "oxfmt"
53
+ };
54
+ if (baseTemplate === "r3f") {
55
+ return {
56
+ ...base,
57
+ drei: {},
58
+ handle: {},
59
+ leva: {},
60
+ postprocessing: {},
61
+ rapier: {},
62
+ xr: {},
63
+ uikit: {},
64
+ offscreen: {},
65
+ zustand: {},
66
+ koota: {},
67
+ triplex: {},
68
+ viverse: {}
69
+ };
70
+ }
71
+ return base;
72
+ }
73
+ function formatConfigSummary(options) {
74
+ const lines = [];
75
+ const VALUE_COL = 27;
76
+ const formatRow = (label, value, indent = "") => {
77
+ const fullLabel = indent + label;
78
+ const dotCount = Math.max(1, VALUE_COL - fullLabel.length - 1);
79
+ const dots = color__default.gray(".".repeat(dotCount));
80
+ return `${indent}${label} ${dots} ${value}`;
81
+ };
82
+ const formatLanguage = (lang) => {
83
+ return lang === "typescript" ? "TypeScript" : lang === "javascript" ? "JavaScript" : lang;
84
+ };
85
+ const projectType = options.projectType ?? "app";
86
+ const language = options.template ? index.getLanguageFromTemplate(options.template) : "typescript";
87
+ lines.push(formatRow("Language", formatLanguage(language)));
88
+ if (projectType === "library") {
89
+ lines.push(formatRow("Bundler", options.libraryBundler ?? "unbuild"));
90
+ } else {
91
+ lines.push(formatRow("Bundler", "vite"));
92
+ }
93
+ lines.push(formatRow("Node version", options.nodeVersion || "latest"));
94
+ lines.push(formatRow("Package manager", options.packageManager || "pnpm"));
95
+ if (options.packageManager === "pnpm") {
96
+ const versionManaged = options.pnpmManageVersions ? "yes" : "no";
97
+ lines.push(formatRow("\u21B3 Version managed", versionManaged, ""));
98
+ }
99
+ if (options.linter) {
100
+ lines.push(formatRow("Linter", options.linter));
101
+ }
102
+ if (options.formatter) {
103
+ lines.push(formatRow("Formatter", options.formatter));
104
+ }
105
+ lines.push(formatRow("Testing", "vitest"));
106
+ if (options.template && index.getBaseTemplate(options.template) === "r3f") {
107
+ const integrationNames = [
108
+ options.drei && "drei",
109
+ options.handle && "handle",
110
+ options.leva && "leva",
111
+ options.postprocessing && "postproc",
112
+ options.rapier && "rapier",
113
+ options.xr && "xr",
114
+ options.uikit && "uikit",
115
+ options.offscreen && "offscreen",
116
+ options.zustand && "zustand",
117
+ options.koota && "koota",
118
+ options.triplex && "triplex",
119
+ options.viverse && "viverse"
120
+ ].filter(Boolean);
121
+ lines.push("");
122
+ lines.push(color__default.dim("Integrations"));
123
+ for (let i = 0; i < integrationNames.length; i += 2) {
124
+ const left = `${color__default.green("\u25CF")} ${integrationNames[i]}`;
125
+ const right = integrationNames[i + 1] ? `${color__default.green("\u25CF")} ${integrationNames[i + 1]}` : "";
126
+ const spacing = " ".repeat(Math.max(1, 16 - integrationNames[i].length));
127
+ lines.push(` ${left}${spacing}${right}`);
128
+ }
129
+ }
130
+ return lines.join("\n");
131
+ }
132
+ async function promptForCustomization(template, name, projectType) {
133
+ let libraryBundler;
134
+ if (projectType === "library") {
135
+ const bundler = await p__namespace.select({
136
+ message: "Library bundler",
137
+ options: [
138
+ { value: "unbuild", label: "unbuild", hint: "unjs, simple config" },
139
+ { value: "tsdown", label: "tsdown", hint: "fast, esbuild-based" }
140
+ ],
141
+ initialValue: "unbuild"
142
+ });
143
+ if (p__namespace.isCancel(bundler)) {
144
+ p__namespace.cancel("Operation cancelled.");
145
+ process.exit(0);
146
+ }
147
+ libraryBundler = bundler;
148
+ }
149
+ const nodeVersion = await p__namespace.text({
150
+ message: "Node.js version",
151
+ placeholder: "latest",
152
+ defaultValue: "latest",
153
+ validate: (value) => {
154
+ if (!value.length) return "Required";
155
+ if (value !== "latest" && !/^\d+(\.\d+(\.\d+)?)?$/.test(value)) {
156
+ return 'Must be "latest" or a valid semver (e.g., "22" or "22.13.0")';
157
+ }
158
+ }
159
+ });
160
+ if (p__namespace.isCancel(nodeVersion)) {
161
+ p__namespace.cancel("Operation cancelled.");
162
+ process.exit(0);
163
+ }
164
+ const packageManager = await p__namespace.select({
165
+ message: "Package manager",
166
+ options: [
167
+ { value: "pnpm", label: "pnpm" },
168
+ { value: "npm", label: "npm" },
169
+ { value: "yarn", label: "yarn" },
170
+ { value: "custom", label: "Other (custom)" }
171
+ ],
172
+ initialValue: "pnpm"
173
+ });
174
+ if (p__namespace.isCancel(packageManager)) {
175
+ p__namespace.cancel("Operation cancelled.");
176
+ process.exit(0);
177
+ }
178
+ let finalPackageManager = packageManager;
179
+ if (packageManager === "custom") {
180
+ const customPm = await p__namespace.text({
181
+ message: "Enter package manager command",
182
+ validate: (value) => {
183
+ if (!value.length) return "Required";
184
+ }
185
+ });
186
+ if (p__namespace.isCancel(customPm)) {
187
+ p__namespace.cancel("Operation cancelled.");
188
+ process.exit(0);
189
+ }
190
+ finalPackageManager = customPm;
191
+ }
192
+ let pnpmManageVersions = true;
193
+ if (packageManager === "pnpm") {
194
+ const managePnpm = await p__namespace.confirm({
195
+ message: "Enable manage-package-manager-versions?",
196
+ initialValue: true
197
+ });
198
+ if (p__namespace.isCancel(managePnpm)) {
199
+ p__namespace.cancel("Operation cancelled.");
200
+ process.exit(0);
201
+ }
202
+ pnpmManageVersions = managePnpm;
203
+ }
204
+ const linter = await p__namespace.select({
205
+ message: "Linter",
206
+ options: [
207
+ { value: "oxlint", label: "Oxlint", hint: "fast, from OXC" },
208
+ { value: "eslint", label: "ESLint", hint: "classic" },
209
+ { value: "biome", label: "Biome", hint: "all-in-one" }
210
+ ],
211
+ initialValue: "oxlint"
212
+ });
213
+ if (p__namespace.isCancel(linter)) {
214
+ p__namespace.cancel("Operation cancelled.");
215
+ process.exit(0);
216
+ }
217
+ const formatter = await p__namespace.select({
218
+ message: "Formatter",
219
+ options: [
220
+ { value: "oxfmt", label: "Oxfmt", hint: "fast, Prettier-compatible" },
221
+ { value: "prettier", label: "Prettier", hint: "classic" },
222
+ { value: "biome", label: "Biome", hint: "all-in-one" }
223
+ ],
224
+ initialValue: "oxfmt"
225
+ });
226
+ if (p__namespace.isCancel(formatter)) {
227
+ p__namespace.cancel("Operation cancelled.");
228
+ process.exit(0);
229
+ }
230
+ const language = await p__namespace.select({
231
+ message: "Language",
232
+ options: [
233
+ { value: "typescript", label: "TypeScript" },
234
+ { value: "javascript", label: "JavaScript" }
235
+ ],
236
+ initialValue: "typescript"
237
+ });
238
+ if (p__namespace.isCancel(language)) {
239
+ p__namespace.cancel("Operation cancelled.");
240
+ process.exit(0);
241
+ }
242
+ const baseTemplate = index.getBaseTemplate(template);
243
+ const finalTemplate = language === "javascript" ? `${baseTemplate}-js` : baseTemplate;
244
+ let integrations = [];
245
+ if (baseTemplate === "r3f") {
246
+ const selected = await p__namespace.multiselect({
247
+ message: "R3F integrations",
248
+ options: [
249
+ { value: "drei", label: "Drei" },
250
+ { value: "handle", label: "Handle" },
251
+ { value: "leva", label: "Leva" },
252
+ { value: "postprocessing", label: "Postprocessing" },
253
+ { value: "rapier", label: "Rapier" },
254
+ { value: "xr", label: "XR" },
255
+ { value: "uikit", label: "UIKit" },
256
+ { value: "offscreen", label: "Offscreen" },
257
+ { value: "zustand", label: "Zustand" },
258
+ { value: "koota", label: "Koota" },
259
+ { value: "triplex", label: "Triplex" },
260
+ { value: "viverse", label: "Viverse" }
261
+ ],
262
+ initialValues: [
263
+ "drei",
264
+ "handle",
265
+ "leva",
266
+ "postprocessing",
267
+ "rapier",
268
+ "xr",
269
+ "uikit",
270
+ "offscreen",
271
+ "zustand",
272
+ "koota",
273
+ "triplex",
274
+ "viverse"
275
+ ],
276
+ required: false
277
+ });
278
+ if (p__namespace.isCancel(selected)) {
279
+ p__namespace.cancel("Operation cancelled.");
280
+ process.exit(0);
281
+ }
282
+ integrations = selected;
283
+ }
284
+ return {
285
+ name,
286
+ template: finalTemplate,
287
+ projectType,
288
+ libraryBundler: projectType === "library" ? libraryBundler : void 0,
289
+ nodeVersion,
290
+ packageManager: finalPackageManager,
291
+ pnpmManageVersions,
292
+ linter,
293
+ formatter,
294
+ ...baseTemplate === "r3f" && {
295
+ drei: integrations.includes("drei") ? {} : void 0,
296
+ handle: integrations.includes("handle") ? {} : void 0,
297
+ leva: integrations.includes("leva") ? {} : void 0,
298
+ postprocessing: integrations.includes("postprocessing") ? {} : void 0,
299
+ rapier: integrations.includes("rapier") ? {} : void 0,
300
+ xr: integrations.includes("xr") ? {} : void 0,
301
+ uikit: integrations.includes("uikit") ? {} : void 0,
302
+ offscreen: integrations.includes("offscreen") ? {} : void 0,
303
+ zustand: integrations.includes("zustand") ? {} : void 0,
304
+ koota: integrations.includes("koota") ? {} : void 0,
305
+ triplex: integrations.includes("triplex") ? {} : void 0,
306
+ viverse: integrations.includes("viverse") ? {} : void 0
307
+ }
308
+ };
309
+ }
310
+ async function promptForOptions(name) {
311
+ let projectName = name;
312
+ if (!projectName) {
313
+ const nameResult = await p__namespace.text({
314
+ message: "What is your project named?",
315
+ placeholder: index.generateRandomName(),
316
+ defaultValue: index.generateRandomName(),
317
+ validate: (value) => {
318
+ if (!value.length) return "Project name is required";
319
+ }
320
+ });
321
+ if (p__namespace.isCancel(nameResult)) {
322
+ p__namespace.cancel("Operation cancelled.");
323
+ process.exit(0);
324
+ }
325
+ projectName = nameResult;
326
+ }
327
+ const projectType = await p__namespace.select({
328
+ message: "Project type",
329
+ options: [
330
+ { value: "app", label: "Application" },
331
+ { value: "library", label: "Library" }
332
+ ],
333
+ initialValue: "app"
334
+ });
335
+ if (p__namespace.isCancel(projectType)) {
336
+ p__namespace.cancel("Operation cancelled.");
337
+ process.exit(0);
338
+ }
339
+ const template = await p__namespace.select({
340
+ message: "Select a template",
341
+ options: [
342
+ { value: "vanilla", label: "Vanilla" },
343
+ { value: "react", label: "React" },
344
+ { value: "r3f", label: "React Three Fiber" }
345
+ ],
346
+ initialValue: "vanilla"
347
+ });
348
+ if (p__namespace.isCancel(template)) {
349
+ p__namespace.cancel("Operation cancelled.");
350
+ process.exit(0);
351
+ }
352
+ const defaultOptions = getDefaultOptions(
353
+ template,
354
+ projectName,
355
+ projectType
356
+ );
357
+ p__namespace.note(formatConfigSummary(defaultOptions), "Template Configuration");
358
+ const action = await p__namespace.select({
359
+ message: "Proceed with these settings?",
360
+ options: [
361
+ { value: "confirm", label: "Yes, create project" },
362
+ { value: "customize", label: "No, let me customize" }
363
+ ],
364
+ initialValue: "confirm"
365
+ });
366
+ if (p__namespace.isCancel(action)) {
367
+ p__namespace.cancel("Operation cancelled.");
368
+ process.exit(0);
369
+ }
370
+ if (action === "confirm") {
371
+ return defaultOptions;
372
+ }
373
+ return promptForCustomization(
374
+ template,
375
+ projectName,
376
+ projectType
377
+ );
378
+ }
379
+ async function main() {
380
+ const program = new commander.Command().name("create-krispya").description(
381
+ "CLI for creating Vanilla, React, and React Three Fiber projects"
382
+ ).argument("[name]", "name for the project").option(
383
+ "--type <type>",
384
+ "project type: app or library (default: app)"
385
+ ).option(
386
+ "--bundler <bundler>",
387
+ "library bundler: unbuild or tsdown (default: unbuild, only for libraries)"
388
+ ).option(
389
+ "--template <type>",
390
+ "project template: vanilla, vanilla-js, react, react-js, r3f, r3f-js (default: vanilla)"
391
+ ).option(
392
+ "--linter <type>",
393
+ "linter: eslint, oxlint, or biome (default: oxlint)"
394
+ ).option(
395
+ "--formatter <type>",
396
+ "formatter: prettier, oxfmt, or biome (default: oxfmt)"
397
+ ).option("--drei", "add @react-three/drei (r3f only)").option("--handle", "add @react-three/handle (r3f only)").option("--leva", "add leva (r3f only)").option("--postprocessing", "add @react-three/postprocessing (r3f only)").option("--rapier", "add @react-three/rapier (r3f only)").option("--xr", "add @react-three/xr (r3f only)").option("--uikit", "add @react-three/uikit (r3f only)").option("--offscreen", "add @react-three/offscreen (r3f only)").option("--zustand", "add zustand (r3f only)").option("--koota", "add koota (r3f only)").option("--triplex", "set up triplex development environment (r3f only)").option("--viverse", "set up viverse deployment (r3f only)").option(
398
+ "--package-manager <manager>",
399
+ "specify package manager (e.g. npm, yarn, pnpm)"
400
+ ).option(
401
+ "--pnpm-manage-versions",
402
+ "enable manage-package-manager-versions in pnpm-workspace.yaml (default: true)"
403
+ ).option(
404
+ "--no-pnpm-manage-versions",
405
+ "disable manage-package-manager-versions in pnpm-workspace.yaml"
406
+ ).option(
407
+ "--node-version <version>",
408
+ 'set Node.js version for engines.node field (default: "latest")'
409
+ ).option("-y, --yes", "Skip prompts and use default values").action(async (name, options) => {
410
+ console.clear();
411
+ p__namespace.intro(color__default.bgCyan(color__default.black(" create-krispya ")));
412
+ let generateOptions;
413
+ if (Object.keys(options).length > 0) {
414
+ const template = options.template ?? "vanilla";
415
+ const baseTemplate = index.getBaseTemplate(template);
416
+ const defaultName = getDefaultProjectName(template);
417
+ const projectType = options.type ?? "app";
418
+ generateOptions = {
419
+ name: name || defaultName,
420
+ projectType,
421
+ libraryBundler: projectType === "library" ? options.bundler ?? "unbuild" : void 0,
422
+ template,
423
+ linter: options.linter ?? "oxlint",
424
+ formatter: options.formatter ?? "oxfmt",
425
+ ...baseTemplate === "r3f" && {
426
+ drei: options.drei ? {} : void 0,
427
+ handle: options.handle ? {} : void 0,
428
+ leva: options.leva ? {} : void 0,
429
+ postprocessing: options.postprocessing ? {} : void 0,
430
+ rapier: options.rapier ? {} : void 0,
431
+ xr: options.xr ? {} : void 0,
432
+ uikit: options.uikit ? {} : void 0,
433
+ offscreen: options.offscreen ? {} : void 0,
434
+ zustand: options.zustand ? {} : void 0,
435
+ koota: options.koota ? {} : void 0,
436
+ viverse: options.viverse ? {} : void 0,
437
+ triplex: options.triplex ? {} : void 0
438
+ },
439
+ packageManager: options.packageManager,
440
+ pnpmManageVersions: options.pnpmManageVersions,
441
+ nodeVersion: options.nodeVersion ?? "latest"
442
+ };
443
+ } else {
444
+ generateOptions = await promptForOptions(name);
445
+ }
446
+ const base = generateOptions.template ? index.getBaseTemplate(generateOptions.template) : "vanilla";
447
+ const defaultFallbackName = base === "vanilla" ? "vanilla-app" : base === "react" ? "react-app" : "react-three-app";
448
+ generateOptions.name ??= defaultFallbackName;
449
+ const packageManager = generateOptions.packageManager || "pnpm";
450
+ if (packageManager === "pnpm") {
451
+ generateOptions.pnpmVersion = await index.getLatestPnpmVersion();
452
+ }
453
+ const nodeVersion = generateOptions.nodeVersion ?? "latest";
454
+ if (nodeVersion === "latest") {
455
+ generateOptions.nodeVersion = await index.getLatestNodeVersion();
456
+ }
457
+ const versions = {};
458
+ const versionPromises = [
459
+ index.getLatestNpmVersion("vitest", "4.0.0").then((v) => {
460
+ versions.vitest = v;
461
+ })
462
+ ];
463
+ if (generateOptions.projectType !== "library") {
464
+ versionPromises.push(
465
+ index.getLatestNpmVersion("vite", "6.3.4").then((v) => {
466
+ versions.vite = v;
467
+ })
468
+ );
469
+ }
470
+ const linter = generateOptions.linter ?? "oxlint";
471
+ if (linter === "eslint") {
472
+ versionPromises.push(
473
+ index.getLatestNpmVersion("eslint", "9.17.0").then((v) => {
474
+ versions.eslint = v;
475
+ })
476
+ );
477
+ } else if (linter === "oxlint") {
478
+ versionPromises.push(
479
+ index.getLatestNpmVersion("oxlint", "0.16.0").then((v) => {
480
+ versions.oxlint = v;
481
+ })
482
+ );
483
+ } else if (linter === "biome") {
484
+ versionPromises.push(
485
+ index.getLatestNpmVersion("@biomejs/biome", "1.9.4").then((v) => {
486
+ versions.biome = v;
487
+ })
488
+ );
489
+ }
490
+ const formatter = generateOptions.formatter ?? "oxfmt";
491
+ if (formatter === "prettier") {
492
+ versionPromises.push(
493
+ index.getLatestNpmVersion("prettier", "3.4.2").then((v) => {
494
+ versions.prettier = v;
495
+ })
496
+ );
497
+ } else if (formatter === "oxfmt") {
498
+ versionPromises.push(
499
+ index.getLatestNpmVersion("oxfmt", "0.1.0").then((v) => {
500
+ versions.oxfmt = v;
501
+ })
502
+ );
503
+ } else if (formatter === "biome" && linter !== "biome") {
504
+ versionPromises.push(
505
+ index.getLatestNpmVersion("@biomejs/biome", "1.9.4").then((v) => {
506
+ versions.biome = v;
507
+ })
508
+ );
509
+ }
510
+ await Promise.all(versionPromises);
511
+ generateOptions.versions = versions;
512
+ const basePath = path.join(process$1.cwd(), generateOptions.name);
513
+ const s = p__namespace.spinner();
514
+ s.start("Creating project...");
515
+ try {
516
+ const files = index.generate(generateOptions);
517
+ const filePaths = Object.keys(files).sort();
518
+ for (const filePath of filePaths) {
519
+ const fullFilePath = path.join(basePath, filePath);
520
+ await promises.mkdir(path.dirname(fullFilePath), { recursive: true });
521
+ const file = files[filePath];
522
+ if (file.type === "text") {
523
+ await promises.writeFile(fullFilePath, file.content);
524
+ } else {
525
+ const response = await undici.fetch(file.url);
526
+ await promises.writeFile(fullFilePath, response.body);
527
+ }
528
+ }
529
+ s.stop("Project created!");
530
+ const isLibrary = generateOptions.projectType === "library";
531
+ const nextSteps = isLibrary ? [
532
+ `cd ${generateOptions.name}`,
533
+ `${packageManager} install`,
534
+ `${packageManager} run build`
535
+ ].join("\n") : [
536
+ `cd ${generateOptions.name}`,
537
+ `${packageManager} install`,
538
+ `${packageManager} run dev`
539
+ ].join("\n");
540
+ p__namespace.note(nextSteps, "Next steps");
541
+ p__namespace.outro(color__default.green("Happy coding! \u2728"));
542
+ } catch (error) {
543
+ s.stop("Failed to create project");
544
+ p__namespace.log.error(String(error));
545
+ process.exit(1);
546
+ }
547
+ });
548
+ await program.parseAsync();
549
+ }
550
+ main().catch(console.error);
package/dist/cli.d.cts ADDED
@@ -0,0 +1 @@
1
+
package/dist/cli.d.mts ADDED
@@ -0,0 +1 @@
1
+
package/dist/cli.d.ts CHANGED
@@ -1,2 +1 @@
1
- #!/usr/bin/env node
2
- export {};
1
+