vite-plus 0.1.1 → 0.1.3

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 (43) hide show
  1. package/binding/index.cjs +2 -0
  2. package/binding/index.d.cts +32 -0
  3. package/dist/global/{prompts-CAIahN1u.js → agent-BE4Xze8Q.js} +380 -1280
  4. package/dist/global/{browser-CY4NBwxR.js → browser-CBapUTD0.js} +579 -1023
  5. package/dist/global/{browser-DFpJ6sKb.js → browser-EZnNDcaO.js} +2 -3
  6. package/dist/global/{chunk-CtfvYSle.js → chunk-CgnkrU7a.js} +13 -22
  7. package/dist/global/{cli-truncate-BxinOqz5.js → cli-truncate-Da6Y8aM8.js} +25 -74
  8. package/dist/global/config.js +95 -165
  9. package/dist/global/create.js +353 -496
  10. package/dist/global/{terminal-Cb-NuRkb.js → help-BAGHa8fD.js} +22 -54
  11. package/dist/global/{json-Bfvtp2rL.js → json-BRdVJ52a.js} +24 -58
  12. package/dist/global/{lib-CibYHP32.js → lib-DxappLRQ.js} +19 -43
  13. package/dist/global/{log-update-DdU6_LCN.js → log-update-C8WCYCbc.js} +102 -281
  14. package/dist/global/mcp.js +97 -169
  15. package/dist/global/migrate.js +223 -72
  16. package/dist/global/{package-Pq2biU7_.js → package-YAMvX5PJ.js} +6 -13
  17. package/dist/global/{slice-ansi-BhwAwMdF.js → slice-ansi-Fap0ehe9.js} +21 -52
  18. package/dist/global/{src-C6aLHRsS.js → src-DwSJ0s0I.js} +28 -110
  19. package/dist/global/staged.js +654 -1521
  20. package/dist/global/{strip-ansi-BL-dgd7n.js → strip-ansi-CE-VDMdw.js} +20 -67
  21. package/dist/global/version.js +16 -37
  22. package/dist/global/{workspace-De4OKHV7.js → workspace-lRm8huz4.js} +1645 -2806
  23. package/dist/global/wrap-ansi-Ou9oAs-a.js +3 -0
  24. package/dist/global/{wrap-ansi-Iww6Ak1s.js → wrap-ansi-eywLlPVQ.js} +29 -80
  25. package/dist/index.d.ts +1 -1
  26. package/dist/init-config.js +10 -2
  27. package/dist/run-config.d.ts +17 -0
  28. package/dist/utils/agent.d.ts +15 -1
  29. package/dist/utils/agent.js +104 -20
  30. package/dist/utils/constants.d.ts +1 -0
  31. package/dist/utils/constants.js +2 -0
  32. package/dist/utils/editor.d.ts +16 -3
  33. package/dist/utils/editor.js +55 -17
  34. package/dist/utils/prompts.d.ts +32 -3
  35. package/dist/utils/prompts.js +32 -8
  36. package/dist/utils/skills.js +18 -2
  37. package/dist/utils/tsconfig.d.ts +6 -0
  38. package/dist/utils/tsconfig.js +16 -0
  39. package/package.json +13 -13
  40. package/templates/monorepo/package.json +1 -1
  41. package/dist/global/wrap-ansi-BJxjUEQR.js +0 -4
  42. package/dist/oxlint-config.d.ts +0 -498
  43. package/dist/oxlint-config.js +0 -309
@@ -1,11 +1,11 @@
1
- import { i as __toESM, t as __commonJSMin } from "./chunk-CtfvYSle.js";
2
- import { C as log, D as select, E as outro, O as text, S as intro, _ as templatesDir, a as runViteFmt, b as cancel, f as selectAgentTargetPaths, i as promptGitHooks, k as Ct, m as displayRelative, n as defaultInteractive, o as runViteInstall, p as writeAgentInstructions, r as downloadPackageManager$1, s as selectPackageManager, u as detectExistingAgentTargetPaths, v as DependencyType, w as multiselect, x as confirm, y as PackageManager } from "./prompts-CAIahN1u.js";
3
- import { t as lib_default } from "./lib-CibYHP32.js";
4
- import { a as selectEditor, d as rewriteMonorepo, f as rewriteMonorepoProject, i as detectExistingEditor, l as installGitHooks, n as updatePackageJsonWithDeps, o as writeEditorConfigs, p as rewriteStandaloneProject, r as updateWorkspaceConfig, t as detectWorkspace$1 } from "./workspace-De4OKHV7.js";
5
- import "./browser-CY4NBwxR.js";
6
- import { r as readJsonFile, t as editJsonFile } from "./json-Bfvtp2rL.js";
7
- import "./package-Pq2biU7_.js";
8
- import { a as renderCliDoc, i as success, n as log$1, r as muted, t as accent } from "./terminal-Cb-NuRkb.js";
1
+ import { i as __toESM, t as __commonJSMin } from "./chunk-CgnkrU7a.js";
2
+ import { A as select, C as cancel, D as multiselect, E as log, M as Ct, S as PackageManager, T as intro, a as selectAgentTargetPaths, c as defaultInteractive, d as promptGitHooks, f as runViteFmt, g as displayRelative, j as text, l as downloadPackageManager$1, m as selectPackageManager, o as writeAgentInstructions, p as runViteInstall, r as detectExistingAgentTargetPaths, w as confirm, x as DependencyType, y as templatesDir } from "./agent-BE4Xze8Q.js";
3
+ import { t as lib_default } from "./lib-DxappLRQ.js";
4
+ import { b as rewriteStandaloneProject, c as writeEditorConfigs, n as updatePackageJsonWithDeps, o as detectExistingEditor, p as installGitHooks, r as updateWorkspaceConfig, s as selectEditor, t as detectWorkspace$1, v as rewriteMonorepo, y as rewriteMonorepoProject } from "./workspace-lRm8huz4.js";
5
+ import "./browser-CBapUTD0.js";
6
+ import { r as readJsonFile, t as editJsonFile } from "./json-BRdVJ52a.js";
7
+ import "./package-YAMvX5PJ.js";
8
+ import { a as success, i as muted, n as accent, r as log$1, t as renderCliDoc } from "./help-BAGHa8fD.js";
9
9
  import path from "node:path";
10
10
  import { styleText } from "node:util";
11
11
  import colors from "picocolors";
@@ -14,19 +14,14 @@ import { runCommand, vitePlusHeader } from "../../binding/index.js";
14
14
  import spawn from "cross-spawn";
15
15
  import fsPromises from "node:fs/promises";
16
16
  import assert from "node:assert";
17
-
18
17
  //#region src/create/command.ts
19
18
  async function runCommandAndDetectProjectDir(options, parentDir) {
20
19
  const cwd = parentDir ? path.join(options.cwd, parentDir) : options.cwd;
21
- const existingDirs = new Set();
20
+ const existingDirs = /* @__PURE__ */ new Set();
22
21
  if (parentDir) {
23
22
  await fsPromises.mkdir(cwd, { recursive: true });
24
23
  const entries = await fsPromises.readdir(cwd, { withFileTypes: true });
25
- for (const entry of entries) {
26
- if (entry.isDirectory()) {
27
- existingDirs.add(entry.name);
28
- }
29
- }
24
+ for (const entry of entries) if (entry.isDirectory()) existingDirs.add(entry.name);
30
25
  }
31
26
  const result = await runCommand({
32
27
  binName: options.command,
@@ -36,37 +31,56 @@ async function runCommandAndDetectProjectDir(options, parentDir) {
36
31
  });
37
32
  let projectDir;
38
33
  let minDepth = Infinity;
39
- for (const [filePath, pathAccess] of Object.entries(result.pathAccesses)) {
40
- if (pathAccess.write && filePath.endsWith("package.json") && !filePath.includes("node_modules")) {
41
- const dir = path.dirname(filePath);
42
- if (dir === "." || dir === "") {
43
- continue;
44
- }
45
- if (existingDirs.has(dir)) {
46
- continue;
47
- }
48
- const depth = dir.split(path.sep).length;
49
- if (depth < minDepth) {
50
- minDepth = depth;
51
- projectDir = dir;
52
- }
34
+ for (const [filePath, pathAccess] of Object.entries(result.pathAccesses)) if (pathAccess.write && filePath.endsWith("package.json") && !filePath.includes("node_modules")) {
35
+ const dir = path.dirname(filePath);
36
+ if (dir === "." || dir === "") continue;
37
+ if (existingDirs.has(dir)) continue;
38
+ const depth = dir.split(path.sep).length;
39
+ if (depth < minDepth) {
40
+ minDepth = depth;
41
+ projectDir = dir;
53
42
  }
54
43
  }
55
- if (parentDir && projectDir) {
56
- projectDir = path.join(parentDir, projectDir);
57
- }
44
+ if (parentDir && projectDir) projectDir = path.join(parentDir, projectDir);
58
45
  return {
59
46
  exitCode: result.exitCode,
60
47
  projectDir
61
48
  };
62
49
  }
50
+ async function runCommandSilently(options) {
51
+ const child = spawn(options.command, options.args, {
52
+ stdio: "pipe",
53
+ cwd: options.cwd,
54
+ env: options.envs
55
+ });
56
+ return await new Promise((resolve, reject) => {
57
+ const stdout = [];
58
+ const stderr = [];
59
+ child.stdout?.on("data", (data) => {
60
+ stdout.push(data);
61
+ });
62
+ child.stderr?.on("data", (data) => {
63
+ stderr.push(data);
64
+ });
65
+ child.on("close", (code) => {
66
+ resolve({
67
+ exitCode: code ?? 0,
68
+ stdout: Buffer.concat(stdout),
69
+ stderr: Buffer.concat(stderr)
70
+ });
71
+ });
72
+ child.on("error", (err) => {
73
+ reject(err);
74
+ });
75
+ });
76
+ }
63
77
  async function runCommand$1(options) {
64
78
  const child = spawn(options.command, options.args, {
65
79
  stdio: "inherit",
66
80
  cwd: options.cwd,
67
81
  env: options.envs
68
82
  });
69
- const promise = new Promise((resolve, reject) => {
83
+ return await new Promise((resolve, reject) => {
70
84
  child.on("close", (code) => {
71
85
  resolve({ exitCode: code ?? 0 });
72
86
  });
@@ -74,7 +88,6 @@ async function runCommand$1(options) {
74
88
  reject(err);
75
89
  });
76
90
  });
77
- return await promise;
78
91
  }
79
92
  function getPackageRunner(workspaceInfo) {
80
93
  switch (workspaceInfo.packageManager) {
@@ -86,7 +99,6 @@ function getPackageRunner(workspaceInfo) {
86
99
  command: "yarn",
87
100
  args: ["dlx"]
88
101
  };
89
- case "npm":
90
102
  default: return {
91
103
  command: "npx",
92
104
  args: []
@@ -109,13 +121,9 @@ function prependToPathToEnvs(extraPath, envs) {
109
121
  const delimiter = path.delimiter;
110
122
  const pathKey = Object.keys(envs).find((key) => key.toLowerCase() === "path") ?? "PATH";
111
123
  const current = envs[pathKey] ?? "";
112
- const parts = current.split(delimiter).filter(Boolean);
113
- if (!parts.includes(extraPath)) {
114
- envs[pathKey] = extraPath + (current ? delimiter + current : "");
115
- }
124
+ if (!current.split(delimiter).filter(Boolean).includes(extraPath)) envs[pathKey] = extraPath + (current ? delimiter + current : "");
116
125
  return envs;
117
126
  }
118
-
119
127
  //#endregion
120
128
  //#region src/create/templates/types.ts
121
129
  const BuiltinTemplate = {
@@ -129,65 +137,52 @@ const TemplateType = {
129
137
  bingo: "bingo",
130
138
  remote: "remote"
131
139
  };
132
-
133
140
  //#endregion
134
141
  //#region src/create/discovery.ts
135
142
  function isGitHubUrl(templateName) {
136
143
  return templateName.startsWith("https://github.com/") || templateName.startsWith("github:") || templateName.includes("github.com/");
137
144
  }
138
145
  function parseGitHubUrl(url) {
139
- if (url.startsWith("github:")) {
140
- return url.slice(7);
141
- }
146
+ if (url.startsWith("github:")) return url.slice(7);
142
147
  const match = url.match(/github\.com\/([^/]+\/[^/]+)/);
143
- if (match) {
144
- return match[1].replace(/\.git$/, "");
145
- }
148
+ if (match) return match[1].replace(/\.git$/, "");
146
149
  return null;
147
150
  }
148
151
  function discoverTemplate(templateName, templateArgs, workspaceInfo, interactive) {
149
152
  const envs = prependToPathToEnvs(workspaceInfo.downloadPackageManager.binPrefix, { ...process.env });
150
153
  const parentDir = inferParentDir(templateName, workspaceInfo);
151
- if (templateName.startsWith("vite:")) {
152
- return {
153
- command: templateName,
154
- args: [...templateArgs],
154
+ if (templateName.startsWith("vite:")) return {
155
+ command: templateName,
156
+ args: [...templateArgs],
157
+ envs,
158
+ type: TemplateType.builtin,
159
+ parentDir,
160
+ interactive
161
+ };
162
+ if (isGitHubUrl(templateName)) {
163
+ const degitPath = parseGitHubUrl(templateName);
164
+ if (degitPath) return {
165
+ command: "degit",
166
+ args: [
167
+ degitPath,
168
+ templateName,
169
+ ...templateArgs
170
+ ],
155
171
  envs,
156
- type: TemplateType.builtin,
172
+ type: TemplateType.remote,
157
173
  parentDir,
158
174
  interactive
159
175
  };
160
176
  }
161
- if (isGitHubUrl(templateName)) {
162
- const degitPath = parseGitHubUrl(templateName);
163
- if (degitPath) {
164
- return {
165
- command: "degit",
166
- args: [
167
- degitPath,
168
- templateName,
169
- ...templateArgs
170
- ],
171
- envs,
172
- type: TemplateType.remote,
173
- parentDir,
174
- interactive
175
- };
176
- }
177
- }
178
177
  const localPackage = workspaceInfo.packages.find((pkg) => pkg.name === templateName);
179
178
  if (localPackage) {
180
179
  const localPackagePath = path.join(workspaceInfo.rootDir, localPackage.path);
181
- const packageJsonPath = path.join(localPackagePath, "package.json");
182
- const pkg = readJsonFile(packageJsonPath);
180
+ const pkg = readJsonFile(path.join(localPackagePath, "package.json"));
183
181
  let binPath = "";
184
- if (pkg.bin) {
185
- if (typeof pkg.bin === "string") {
186
- binPath = path.join(localPackagePath, pkg.bin);
187
- } else {
188
- const binName = Object.keys(pkg.bin)[0];
189
- binPath = path.join(localPackagePath, pkg.bin[binName]);
190
- }
182
+ if (pkg.bin) if (typeof pkg.bin === "string") binPath = path.join(localPackagePath, pkg.bin);
183
+ else {
184
+ const binName = Object.keys(pkg.bin)[0];
185
+ binPath = path.join(localPackagePath, pkg.bin[binName]);
191
186
  }
192
187
  const args = [binPath, ...templateArgs];
193
188
  let type = TemplateType.remote;
@@ -195,20 +190,17 @@ function discoverTemplate(templateName, templateArgs, workspaceInfo, interactive
195
190
  type = TemplateType.bingo;
196
191
  args.push("--skip-requests");
197
192
  }
198
- if (binPath) {
199
- return {
200
- command: "node",
201
- args,
202
- envs,
203
- type,
204
- parentDir,
205
- interactive
206
- };
207
- }
193
+ if (binPath) return {
194
+ command: "node",
195
+ args,
196
+ envs,
197
+ type,
198
+ parentDir,
199
+ interactive
200
+ };
208
201
  }
209
- const expandedName = expandCreateShorthand(templateName);
210
202
  return {
211
- command: expandedName,
203
+ command: expandCreateShorthand(templateName),
212
204
  args: [...templateArgs],
213
205
  envs,
214
206
  type: TemplateType.remote,
@@ -232,56 +224,33 @@ function discoverTemplate(templateName, templateArgs, workspaceInfo, interactive
232
224
  * - Names already starting with `create-` (or `@scope/create-`)
233
225
  */
234
226
  function expandCreateShorthand(templateName) {
235
- if (templateName.includes(":")) {
236
- return templateName;
237
- }
238
- if (isGitHubUrl(templateName)) {
239
- return templateName;
240
- }
241
- if (templateName.startsWith("./") || templateName.startsWith("../") || templateName.startsWith("/")) {
242
- return templateName;
243
- }
227
+ if (templateName.includes(":")) return templateName;
228
+ if (isGitHubUrl(templateName)) return templateName;
229
+ if (templateName.startsWith("./") || templateName.startsWith("../") || templateName.startsWith("/")) return templateName;
244
230
  if (templateName.startsWith("@")) {
245
231
  const slashIndex = templateName.indexOf("/");
246
- if (slashIndex === -1) {
247
- return templateName;
248
- }
232
+ if (slashIndex === -1) return templateName;
249
233
  const scope = templateName.slice(0, slashIndex);
250
234
  const rest = templateName.slice(slashIndex + 1);
251
235
  const atIndex = rest.indexOf("@");
252
236
  const name = atIndex === -1 ? rest : rest.slice(0, atIndex);
253
237
  const version = atIndex === -1 ? "" : rest.slice(atIndex);
254
- if (name.startsWith("create-")) {
255
- return templateName;
256
- }
238
+ if (name.startsWith("create-")) return templateName;
257
239
  return `${scope}/create-${name}${version}`;
258
240
  }
259
241
  const atIndex = templateName.indexOf("@");
260
242
  const name = atIndex === -1 ? templateName : templateName.slice(0, atIndex);
261
243
  const version = atIndex === -1 ? "" : templateName.slice(atIndex);
262
- if (name.startsWith("create-")) {
263
- return templateName;
264
- }
244
+ if (name.startsWith("create-")) return templateName;
265
245
  return `create-${name}${version}`;
266
246
  }
267
247
  function inferParentDir(templateName, workspaceInfo) {
268
- if (workspaceInfo.parentDirs.length === 0) {
269
- return;
270
- }
248
+ if (workspaceInfo.parentDirs.length === 0) return;
271
249
  let rule = /app/i;
272
- if (templateName === BuiltinTemplate.library) {
273
- rule = /lib|component|package/i;
274
- } else if (templateName === BuiltinTemplate.generator) {
275
- rule = /generator|tool/i;
276
- }
277
- for (const parentDir of workspaceInfo.parentDirs) {
278
- if (rule.test(parentDir)) {
279
- return parentDir;
280
- }
281
- }
282
- return;
250
+ if (templateName === BuiltinTemplate.library) rule = /lib|component|package/i;
251
+ else if (templateName === BuiltinTemplate.generator) rule = /generator|tool/i;
252
+ for (const parentDir of workspaceInfo.parentDirs) if (rule.test(parentDir)) return parentDir;
283
253
  }
284
-
285
254
  //#endregion
286
255
  //#region ../../node_modules/.pnpm/validate-npm-package-name@7.0.2/node_modules/validate-npm-package-name/lib/builtin-modules.json
287
256
  var require_builtin_modules = /* @__PURE__ */ __commonJSMin(((exports, module) => {
@@ -360,12 +329,11 @@ var require_builtin_modules = /* @__PURE__ */ __commonJSMin(((exports, module) =
360
329
  "node:test/reporters"
361
330
  ];
362
331
  }));
363
-
364
332
  //#endregion
365
- //#region ../../node_modules/.pnpm/validate-npm-package-name@7.0.2/node_modules/validate-npm-package-name/lib/index.js
366
- var require_lib = /* @__PURE__ */ __commonJSMin(((exports, module) => {
333
+ //#region src/create/utils.ts
334
+ var import_lib = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
367
335
  const builtins = require_builtin_modules();
368
- var scopedPackagePattern = new RegExp("^(?:@([^/]+?)[/])?([^/]+?)$");
336
+ var scopedPackagePattern = /* @__PURE__ */ new RegExp("^(?:@([^/]+?)[/])?([^/]+?)$");
369
337
  var exclusionList = ["node_modules", "favicon.ico"];
370
338
  function validate(name) {
371
339
  var warnings = [];
@@ -374,7 +342,7 @@ var require_lib = /* @__PURE__ */ __commonJSMin(((exports, module) => {
374
342
  errors.push("name cannot be null");
375
343
  return done(warnings, errors);
376
344
  }
377
- if (name === undefined) {
345
+ if (name === void 0) {
378
346
  errors.push("name cannot be undefined");
379
347
  return done(warnings, errors);
380
348
  }
@@ -382,49 +350,25 @@ var require_lib = /* @__PURE__ */ __commonJSMin(((exports, module) => {
382
350
  errors.push("name must be a string");
383
351
  return done(warnings, errors);
384
352
  }
385
- if (!name.length) {
386
- errors.push("name length must be greater than zero");
387
- }
388
- if (name.startsWith(".")) {
389
- errors.push("name cannot start with a period");
390
- }
391
- if (name.startsWith("-")) {
392
- errors.push("name cannot start with a hyphen");
393
- }
394
- if (name.match(/^_/)) {
395
- errors.push("name cannot start with an underscore");
396
- }
397
- if (name.trim() !== name) {
398
- errors.push("name cannot contain leading or trailing spaces");
399
- }
353
+ if (!name.length) errors.push("name length must be greater than zero");
354
+ if (name.startsWith(".")) errors.push("name cannot start with a period");
355
+ if (name.startsWith("-")) errors.push("name cannot start with a hyphen");
356
+ if (name.match(/^_/)) errors.push("name cannot start with an underscore");
357
+ if (name.trim() !== name) errors.push("name cannot contain leading or trailing spaces");
400
358
  exclusionList.forEach(function(excludedName) {
401
- if (name.toLowerCase() === excludedName) {
402
- errors.push(excludedName + " is not a valid package name");
403
- }
359
+ if (name.toLowerCase() === excludedName) errors.push(excludedName + " is not a valid package name");
404
360
  });
405
- if (builtins.includes(name.toLowerCase())) {
406
- warnings.push(name + " is a core module name");
407
- }
408
- if (name.length > 214) {
409
- warnings.push("name can no longer contain more than 214 characters");
410
- }
411
- if (name.toLowerCase() !== name) {
412
- warnings.push("name can no longer contain capital letters");
413
- }
414
- if (/[~'!()*]/.test(name.split("/").slice(-1)[0])) {
415
- warnings.push("name can no longer contain special characters (\"~'!()*\")");
416
- }
361
+ if (builtins.includes(name.toLowerCase())) warnings.push(name + " is a core module name");
362
+ if (name.length > 214) warnings.push("name can no longer contain more than 214 characters");
363
+ if (name.toLowerCase() !== name) warnings.push("name can no longer contain capital letters");
364
+ if (/[~'!()*]/.test(name.split("/").slice(-1)[0])) warnings.push("name can no longer contain special characters (\"~'!()*\")");
417
365
  if (encodeURIComponent(name) !== name) {
418
366
  var nameMatch = name.match(scopedPackagePattern);
419
367
  if (nameMatch) {
420
368
  var user = nameMatch[1];
421
369
  var pkg = nameMatch[2];
422
- if (pkg.startsWith(".")) {
423
- errors.push("name cannot start with a period");
424
- }
425
- if (encodeURIComponent(user) === user && encodeURIComponent(pkg) === pkg) {
426
- return done(warnings, errors);
427
- }
370
+ if (pkg.startsWith(".")) errors.push("name cannot start with a period");
371
+ if (encodeURIComponent(user) === user && encodeURIComponent(pkg) === pkg) return done(warnings, errors);
428
372
  }
429
373
  errors.push("name can only contain URL-friendly characters");
430
374
  }
@@ -437,35 +381,19 @@ var require_lib = /* @__PURE__ */ __commonJSMin(((exports, module) => {
437
381
  warnings,
438
382
  errors
439
383
  };
440
- if (!result.warnings.length) {
441
- delete result.warnings;
442
- }
443
- if (!result.errors.length) {
444
- delete result.errors;
445
- }
384
+ if (!result.warnings.length) delete result.warnings;
385
+ if (!result.errors.length) delete result.errors;
446
386
  return result;
447
387
  };
448
388
  module.exports = validate;
449
- }));
450
-
451
- //#endregion
452
- //#region src/create/utils.ts
453
- var import_lib = /* @__PURE__ */ __toESM(require_lib(), 1);
389
+ })))(), 1);
454
390
  function copy(src, dest) {
455
- const stat = fs.statSync(src);
456
- if (stat.isDirectory()) {
457
- copyDir(src, dest);
458
- } else {
459
- fs.copyFileSync(src, dest);
460
- }
391
+ if (fs.statSync(src).isDirectory()) copyDir(src, dest);
392
+ else fs.copyFileSync(src, dest);
461
393
  }
462
394
  function copyDir(srcDir, destDir) {
463
395
  fs.mkdirSync(destDir, { recursive: true });
464
- for (const file of fs.readdirSync(srcDir)) {
465
- const srcFile = path.resolve(srcDir, file);
466
- const destFile = path.resolve(destDir, file);
467
- copy(srcFile, destFile);
468
- }
396
+ for (const file of fs.readdirSync(srcDir)) copy(path.resolve(srcDir, file), path.resolve(destDir, file));
469
397
  }
470
398
  /**
471
399
  * Format the target directory into a valid directory name and package name
@@ -492,20 +420,16 @@ function copyDir(srcDir, destDir) {
492
420
  function formatTargetDir(input) {
493
421
  let targetDir = path.normalize(input.trim());
494
422
  const parsed = path.parse(targetDir);
495
- if (parsed.root || path.isAbsolute(targetDir)) {
496
- return {
497
- directory: "",
498
- packageName: "",
499
- error: "Absolute path is not allowed"
500
- };
501
- }
502
- if (targetDir.includes("..")) {
503
- return {
504
- directory: "",
505
- packageName: "",
506
- error: "Relative path contains \"..\" which is not allowed"
507
- };
508
- }
423
+ if (parsed.root || path.isAbsolute(targetDir)) return {
424
+ directory: "",
425
+ packageName: "",
426
+ error: "Absolute path is not allowed"
427
+ };
428
+ if (targetDir.includes("..")) return {
429
+ directory: "",
430
+ packageName: "",
431
+ error: "Relative path contains \"..\" which is not allowed"
432
+ };
509
433
  let packageName = parsed.base;
510
434
  const parentName = path.basename(parsed.dir);
511
435
  if (parentName.startsWith("@")) {
@@ -527,9 +451,7 @@ function formatTargetDir(input) {
527
451
  };
528
452
  }
529
453
  function getProjectDirFromPackageName(packageName) {
530
- if (packageName.startsWith("@")) {
531
- return packageName.split("/")[1];
532
- }
454
+ if (packageName.startsWith("@")) return packageName.split("/")[1];
533
455
  return packageName;
534
456
  }
535
457
  function setPackageName(projectDir, packageName) {
@@ -540,15 +462,10 @@ function setPackageName(projectDir, packageName) {
540
462
  }
541
463
  function formatDisplayTargetDir(targetDir) {
542
464
  const normalized = targetDir.split(path.sep).join("/");
543
- if (normalized === "" || normalized === ".") {
544
- return "./";
545
- }
546
- if (normalized.startsWith("./") || normalized.startsWith("../") || normalized.startsWith("/") || normalized.startsWith("~")) {
547
- return normalized;
548
- }
465
+ if (normalized === "" || normalized === ".") return "./";
466
+ if (normalized.startsWith("./") || normalized.startsWith("../") || normalized.startsWith("/") || normalized.startsWith("~")) return normalized;
549
467
  return `./${normalized}`;
550
468
  }
551
-
552
469
  //#endregion
553
470
  //#region src/create/prompts.ts
554
471
  async function promptPackageNameAndTargetDir(defaultPackageName, interactive) {
@@ -560,19 +477,13 @@ async function promptPackageNameAndTargetDir(defaultPackageName, interactive) {
560
477
  placeholder: defaultPackageName,
561
478
  defaultValue: defaultPackageName,
562
479
  validate: (value) => {
563
- if (value == null || value.length === 0) {
564
- return;
565
- }
480
+ if (value == null || value.length === 0) return;
566
481
  const result = value ? (0, import_lib.default)(value) : null;
567
- if (result?.validForNewPackages) {
568
- return;
569
- }
482
+ if (result?.validForNewPackages) return;
570
483
  return result?.errors?.[0] ?? result?.warnings?.[0] ?? "Invalid package name";
571
484
  }
572
485
  });
573
- if (Ct(selected)) {
574
- cancelAndExit();
575
- }
486
+ if (Ct(selected)) cancelAndExit();
576
487
  packageName = selected;
577
488
  targetDir = getProjectDirFromPackageName(packageName);
578
489
  } else {
@@ -586,9 +497,7 @@ async function promptPackageNameAndTargetDir(defaultPackageName, interactive) {
586
497
  };
587
498
  }
588
499
  async function checkProjectDirExists(projectDirFullPath, interactive) {
589
- if (!fs.existsSync(projectDirFullPath) || isEmpty(projectDirFullPath)) {
590
- return;
591
- }
500
+ if (!fs.existsSync(projectDirFullPath) || isEmpty(projectDirFullPath)) return;
592
501
  if (!interactive) {
593
502
  log.info("Use --directory to specify a different location or remove the directory first");
594
503
  cancelAndExit(`Target directory "${projectDirFullPath}" is not empty`, 1);
@@ -603,9 +512,7 @@ async function checkProjectDirExists(projectDirFullPath, interactive) {
603
512
  value: "yes"
604
513
  }]
605
514
  });
606
- if (Ct(overwrite)) {
607
- cancelAndExit();
608
- }
515
+ if (Ct(overwrite)) cancelAndExit();
609
516
  switch (overwrite) {
610
517
  case "yes":
611
518
  emptyDir(projectDirFullPath);
@@ -622,20 +529,15 @@ function isEmpty(path) {
622
529
  return files.length === 0 || files.length === 1 && files[0] === ".git";
623
530
  }
624
531
  function emptyDir(dir) {
625
- if (!fs.existsSync(dir)) {
626
- return;
627
- }
532
+ if (!fs.existsSync(dir)) return;
628
533
  for (const file of fs.readdirSync(dir)) {
629
- if (file === ".git") {
630
- continue;
631
- }
534
+ if (file === ".git") continue;
632
535
  fs.rmSync(path.resolve(dir, file), {
633
536
  recursive: true,
634
537
  force: true
635
538
  });
636
539
  }
637
540
  }
638
-
639
541
  //#endregion
640
542
  //#region ../../node_modules/.pnpm/@nkzw+safe-word-list@3.1.0/node_modules/@nkzw/safe-word-list/index.js
641
543
  const words = [
@@ -3372,16 +3274,15 @@ const random = (min, max) => Math.floor(min + Math.random() * (max - min + 1));
3372
3274
  function getRandomWord() {
3373
3275
  return words[random(0, words.length - 1)];
3374
3276
  }
3375
-
3376
3277
  //#endregion
3377
3278
  //#region src/create/random-name.ts
3378
3279
  const isTest = process.env.VITE_PLUS_CLI_TEST === "1";
3379
3280
  function getRandomWords() {
3380
3281
  const first = getRandomWord();
3381
3282
  let second;
3382
- do {
3283
+ do
3383
3284
  second = getRandomWord();
3384
- } while (second === first);
3285
+ while (second === first);
3385
3286
  return [first, second];
3386
3287
  }
3387
3288
  function getRandomProjectName(options = {}) {
@@ -3389,11 +3290,10 @@ function getRandomProjectName(options = {}) {
3389
3290
  const projectName = isTest && fallbackName ? fallbackName : getRandomWords().join("-");
3390
3291
  return scope ? `${scope}/${projectName}` : projectName;
3391
3292
  }
3392
-
3393
3293
  //#endregion
3394
3294
  //#region src/create/templates/generator.ts
3395
- async function executeGeneratorScaffold(workspaceInfo, templateInfo) {
3396
- log.step("Creating generator scaffold...");
3295
+ async function executeGeneratorScaffold(workspaceInfo, templateInfo, options) {
3296
+ if (!options?.silent) log.step("Creating generator scaffold...");
3397
3297
  let description;
3398
3298
  if (templateInfo.interactive) {
3399
3299
  const defaultDescription = "Generate new components for our monorepo";
@@ -3402,49 +3302,42 @@ async function executeGeneratorScaffold(workspaceInfo, templateInfo) {
3402
3302
  placeholder: defaultDescription,
3403
3303
  defaultValue: defaultDescription
3404
3304
  });
3405
- if (!Ct(descPrompt)) {
3406
- description = descPrompt;
3407
- }
3305
+ if (!Ct(descPrompt)) description = descPrompt;
3408
3306
  }
3409
3307
  const fullPath = path.join(workspaceInfo.rootDir, templateInfo.targetDir);
3410
- const templateDir = path.join(templatesDir, "generator");
3411
- copyDir(templateDir, fullPath);
3308
+ copyDir(path.join(templatesDir, "generator"), fullPath);
3412
3309
  fs.chmodSync(path.join(fullPath, "bin/index.ts"), "755");
3413
3310
  editJsonFile(path.join(fullPath, "package.json"), (pkg) => {
3414
3311
  pkg.name = templateInfo.packageName;
3415
- if (description) {
3416
- pkg.description = description;
3417
- }
3312
+ if (description) pkg.description = description;
3418
3313
  return pkg;
3419
3314
  });
3420
- log.success("Generator scaffold created");
3315
+ if (!options?.silent) log.success("Generator scaffold created");
3421
3316
  return {
3422
3317
  exitCode: 0,
3423
3318
  projectDir: templateInfo.targetDir
3424
3319
  };
3425
3320
  }
3426
-
3427
3321
  //#endregion
3428
3322
  //#region src/create/templates/remote.ts
3429
3323
  const { gray, yellow } = colors;
3430
- async function executeRemoteTemplate(workspaceInfo, templateInfo) {
3431
- log.step("Generating project…");
3324
+ async function executeRemoteTemplate(workspaceInfo, templateInfo, options) {
3325
+ const silent = options?.silent ?? false;
3326
+ if (!silent) log.step("Generating project…");
3432
3327
  let isGitHubTemplate = templateInfo.command === "degit";
3433
3328
  let result;
3434
3329
  if (templateInfo.command === "node") {
3435
3330
  const command = templateInfo.command;
3436
3331
  const args = templateInfo.args;
3437
3332
  const envs = templateInfo.envs;
3438
- log.info(`Running: ${gray(`${command} ${args.join(" ")}`)}`);
3333
+ if (!silent) log.info(`Running: ${gray(`${command} ${args.join(" ")}`)}`);
3439
3334
  result = await runCommandAndDetectProjectDir({
3440
3335
  command,
3441
3336
  args,
3442
3337
  cwd: workspaceInfo.rootDir,
3443
3338
  envs
3444
3339
  }, templateInfo.parentDir);
3445
- } else {
3446
- result = await runRemoteTemplateCommand(workspaceInfo, workspaceInfo.rootDir, templateInfo, true);
3447
- }
3340
+ } else result = await runRemoteTemplateCommand(workspaceInfo, workspaceInfo.rootDir, templateInfo, true, silent);
3448
3341
  const exitCode = result.exitCode;
3449
3342
  if (exitCode === 127) {
3450
3343
  log.info(yellow("\nTroubleshooting:"));
@@ -3457,21 +3350,25 @@ async function executeRemoteTemplate(workspaceInfo, templateInfo) {
3457
3350
  }
3458
3351
  return result;
3459
3352
  }
3460
- async function runRemoteTemplateCommand(workspaceInfo, cwd, templateInfo, detectCreatedProjectDir) {
3353
+ async function runRemoteTemplateCommand(workspaceInfo, cwd, templateInfo, detectCreatedProjectDir, silent = false) {
3461
3354
  autoFixRemoteTemplateCommand(templateInfo, workspaceInfo);
3462
3355
  const remotePackageName = templateInfo.command;
3463
3356
  const execArgs = [...templateInfo.args];
3464
3357
  const envs = templateInfo.envs;
3465
3358
  const { command, args } = formatDlxCommand(remotePackageName, execArgs, workspaceInfo);
3466
- log.info(`Running: ${gray(`${command} ${args.join(" ")}`)}`);
3467
- if (detectCreatedProjectDir) {
3468
- return await runCommandAndDetectProjectDir({
3469
- command,
3470
- args,
3471
- cwd,
3472
- envs
3473
- }, templateInfo.parentDir);
3474
- }
3359
+ if (!silent) log.info(`Running: ${gray(`${command} ${args.join(" ")}`)}`);
3360
+ if (detectCreatedProjectDir) return await runCommandAndDetectProjectDir({
3361
+ command,
3362
+ args,
3363
+ cwd,
3364
+ envs
3365
+ }, templateInfo.parentDir);
3366
+ if (silent) return await runCommandSilently({
3367
+ command,
3368
+ args,
3369
+ cwd,
3370
+ envs
3371
+ });
3475
3372
  return await runCommand$1({
3476
3373
  command,
3477
3374
  args,
@@ -3482,9 +3379,7 @@ async function runRemoteTemplateCommand(workspaceInfo, cwd, templateInfo, detect
3482
3379
  function autoFixRemoteTemplateCommand(templateInfo, workspaceInfo) {
3483
3380
  let packageName = templateInfo.command;
3484
3381
  const indexOfAt = packageName.indexOf("@", 2);
3485
- if (indexOfAt !== -1) {
3486
- packageName = packageName.substring(0, indexOfAt);
3487
- }
3382
+ if (indexOfAt !== -1) packageName = packageName.substring(0, indexOfAt);
3488
3383
  if (packageName === "create-vite") {
3489
3384
  templateInfo.args.push("--no-immediate");
3490
3385
  templateInfo.args.push("--no-rolldown");
@@ -3493,49 +3388,37 @@ function autoFixRemoteTemplateCommand(templateInfo, workspaceInfo) {
3493
3388
  templateInfo.args.push("--no-toolchain");
3494
3389
  }
3495
3390
  if (workspaceInfo.isMonorepo) {
3496
- if (packageName === "create-nuxt") {
3497
- templateInfo.args.push("--no-gitInit");
3498
- } else if (packageName === "@tanstack/create-start") {
3499
- templateInfo.args.push("--no-git");
3500
- }
3391
+ if (packageName === "create-nuxt") templateInfo.args.push("--no-gitInit");
3392
+ else if (packageName === "@tanstack/create-start") templateInfo.args.push("--no-git");
3501
3393
  }
3502
3394
  }
3503
-
3504
3395
  //#endregion
3505
3396
  //#region src/create/templates/builtin.ts
3506
- async function executeBuiltinTemplate(workspaceInfo, templateInfo) {
3397
+ async function executeBuiltinTemplate(workspaceInfo, templateInfo, options) {
3507
3398
  assert(templateInfo.targetDir, "targetDir is required");
3508
3399
  assert(templateInfo.packageName, "packageName is required");
3509
- if (templateInfo.command === BuiltinTemplate.generator) {
3510
- return await executeGeneratorScaffold(workspaceInfo, templateInfo);
3511
- }
3400
+ if (templateInfo.command === BuiltinTemplate.generator) return await executeGeneratorScaffold(workspaceInfo, templateInfo, options);
3512
3401
  if (templateInfo.command === BuiltinTemplate.application) {
3513
3402
  templateInfo.command = "create-vite@latest";
3514
- if (!templateInfo.interactive) {
3515
- templateInfo.args.push("--no-interactive");
3516
- }
3403
+ if (!templateInfo.interactive) templateInfo.args.push("--no-interactive");
3517
3404
  } else if (templateInfo.command === BuiltinTemplate.library) {
3518
3405
  templateInfo.command = "create-tsdown@latest";
3519
3406
  if (!templateInfo.interactive) {
3520
- if (!templateInfo.args.find((arg) => arg.startsWith("--template") || arg.startsWith("-t"))) {
3521
- templateInfo.args.push("--template", "default");
3522
- }
3407
+ if (!templateInfo.args.find((arg) => arg.startsWith("--template") || arg.startsWith("-t"))) templateInfo.args.push("--template", "default");
3523
3408
  }
3524
3409
  }
3525
3410
  templateInfo.args.unshift(templateInfo.targetDir);
3526
- const result = await runRemoteTemplateCommand(workspaceInfo, workspaceInfo.rootDir, templateInfo, false);
3527
- const fullPath = path.join(workspaceInfo.rootDir, templateInfo.targetDir);
3528
- setPackageName(fullPath, templateInfo.packageName);
3411
+ const result = await runRemoteTemplateCommand(workspaceInfo, workspaceInfo.rootDir, templateInfo, false, options?.silent ?? false);
3412
+ setPackageName(path.join(workspaceInfo.rootDir, templateInfo.targetDir), templateInfo.packageName);
3529
3413
  return {
3530
3414
  ...result,
3531
3415
  projectDir: templateInfo.targetDir
3532
3416
  };
3533
3417
  }
3534
-
3535
3418
  //#endregion
3536
3419
  //#region src/create/templates/monorepo.ts
3537
3420
  const InitialMonorepoAppDir = "apps/website";
3538
- async function executeMonorepoTemplate(workspaceInfo, templateInfo, interactive) {
3421
+ async function executeMonorepoTemplate(workspaceInfo, templateInfo, interactive, options) {
3539
3422
  assert(templateInfo.packageName, "packageName is required");
3540
3423
  assert(templateInfo.targetDir, "targetDir is required");
3541
3424
  workspaceInfo.monorepoScope = getScopeFromPackageName(templateInfo.packageName);
@@ -3549,16 +3432,13 @@ async function executeMonorepoTemplate(workspaceInfo, templateInfo, interactive)
3549
3432
  if (Ct(selected)) {
3550
3433
  log.info("Operation cancelled. Skipping git initialization");
3551
3434
  initGit = false;
3552
- } else {
3553
- initGit = selected;
3554
- }
3555
- } else {
3556
- log.info(`Initializing git repository (default: yes)`);
3435
+ } else initGit = selected;
3436
+ } else if (!options?.silent) log.info(`Initializing git repository (default: yes)`);
3437
+ if (!options?.silent) {
3438
+ log.info(`Target directory: ${formatDisplayTargetDir(templateInfo.targetDir)}`);
3439
+ log.step("Creating Vite+ monorepo...");
3557
3440
  }
3558
- log.info(`Target directory: ${formatDisplayTargetDir(templateInfo.targetDir)}`);
3559
- log.step("Creating Vite+ monorepo...");
3560
- const templateDir = path.join(templatesDir, "monorepo");
3561
- copyDir(templateDir, fullPath);
3441
+ copyDir(path.join(templatesDir, "monorepo"), fullPath);
3562
3442
  renameFiles(fullPath);
3563
3443
  editJsonFile(path.join(fullPath, "package.json"), (pkg) => {
3564
3444
  pkg.name = templateInfo.packageName;
@@ -3566,60 +3446,49 @@ async function executeMonorepoTemplate(workspaceInfo, templateInfo, interactive)
3566
3446
  });
3567
3447
  if (workspaceInfo.packageManager === PackageManager.pnpm) {
3568
3448
  editJsonFile(path.join(fullPath, "package.json"), (pkg) => {
3569
- pkg.workspaces = undefined;
3570
- pkg.resolutions = undefined;
3449
+ pkg.workspaces = void 0;
3450
+ pkg.resolutions = void 0;
3571
3451
  return pkg;
3572
3452
  });
3573
3453
  const yarnrcPath = path.join(fullPath, ".yarnrc.yml");
3574
- if (fs.existsSync(yarnrcPath)) {
3575
- fs.unlinkSync(yarnrcPath);
3576
- }
3454
+ if (fs.existsSync(yarnrcPath)) fs.unlinkSync(yarnrcPath);
3577
3455
  } else if (workspaceInfo.packageManager === PackageManager.yarn) {
3578
3456
  editJsonFile(path.join(fullPath, "package.json"), (pkg) => {
3579
- pkg.pnpm = undefined;
3457
+ pkg.pnpm = void 0;
3580
3458
  return pkg;
3581
3459
  });
3582
3460
  const pnpmWorkspacePath = path.join(fullPath, "pnpm-workspace.yaml");
3583
- if (fs.existsSync(pnpmWorkspacePath)) {
3584
- fs.unlinkSync(pnpmWorkspacePath);
3585
- }
3461
+ if (fs.existsSync(pnpmWorkspacePath)) fs.unlinkSync(pnpmWorkspacePath);
3586
3462
  } else {
3587
3463
  editJsonFile(path.join(fullPath, "package.json"), (pkg) => {
3588
- pkg.pnpm = undefined;
3464
+ pkg.pnpm = void 0;
3589
3465
  return pkg;
3590
3466
  });
3591
3467
  const pnpmWorkspacePath = path.join(fullPath, "pnpm-workspace.yaml");
3592
- if (fs.existsSync(pnpmWorkspacePath)) {
3593
- fs.unlinkSync(pnpmWorkspacePath);
3594
- }
3468
+ if (fs.existsSync(pnpmWorkspacePath)) fs.unlinkSync(pnpmWorkspacePath);
3595
3469
  const yarnrcPath = path.join(fullPath, ".yarnrc.yml");
3596
- if (fs.existsSync(yarnrcPath)) {
3597
- fs.unlinkSync(yarnrcPath);
3598
- }
3470
+ if (fs.existsSync(yarnrcPath)) fs.unlinkSync(yarnrcPath);
3599
3471
  }
3600
- log.success("Monorepo template created");
3472
+ if (!options?.silent) log.success("Monorepo template created");
3601
3473
  if (initGit) {
3602
3474
  const gitResult = spawn.sync("git", ["init"], {
3603
3475
  stdio: "pipe",
3604
3476
  cwd: fullPath
3605
3477
  });
3606
3478
  if (gitResult.status === 0) {
3607
- log.success("Git repository initialized");
3479
+ if (!options?.silent) log.success("Git repository initialized");
3608
3480
  } else {
3609
3481
  log.warn("Failed to initialize git repository");
3610
- if (gitResult.stderr) {
3611
- log.info(gitResult.stderr.toString());
3612
- }
3482
+ if (gitResult.stderr) log.info(gitResult.stderr.toString());
3613
3483
  }
3614
3484
  }
3615
- log.step("Creating default application in apps/website...");
3616
- const appTemplateInfo = discoverTemplate("create-vite@latest", [
3485
+ if (!options?.silent) log.step("Creating default application in apps/website...");
3486
+ const appResult = await runRemoteTemplateCommand(workspaceInfo, fullPath, discoverTemplate("create-vite@latest", [
3617
3487
  InitialMonorepoAppDir,
3618
3488
  "--template",
3619
3489
  "vanilla-ts",
3620
3490
  "--no-interactive"
3621
- ], workspaceInfo);
3622
- const appResult = await runRemoteTemplateCommand(workspaceInfo, fullPath, appTemplateInfo);
3491
+ ], workspaceInfo), false, options?.silent ?? false);
3623
3492
  if (appResult.exitCode !== 0) {
3624
3493
  log.error(`Failed to create default application: ${appResult.exitCode}`);
3625
3494
  return appResult;
@@ -3627,15 +3496,14 @@ async function executeMonorepoTemplate(workspaceInfo, templateInfo, interactive)
3627
3496
  const appPackageName = workspaceInfo.monorepoScope ? `${workspaceInfo.monorepoScope}/website` : "website";
3628
3497
  const appProjectPath = path.join(fullPath, InitialMonorepoAppDir);
3629
3498
  setPackageName(appProjectPath, appPackageName);
3630
- rewriteMonorepoProject(appProjectPath, workspaceInfo.packageManager);
3631
- log.step("Creating default library in packages/utils...");
3499
+ rewriteMonorepoProject(appProjectPath, workspaceInfo.packageManager, void 0, options?.silent ?? false);
3500
+ if (!options?.silent) log.step("Creating default library in packages/utils...");
3632
3501
  const libraryDir = "packages/utils";
3633
- const libraryTemplateInfo = discoverTemplate("create-tsdown@latest", [
3502
+ const libraryResult = await runRemoteTemplateCommand(workspaceInfo, fullPath, discoverTemplate("create-tsdown@latest", [
3634
3503
  libraryDir,
3635
3504
  "--template",
3636
3505
  "default"
3637
- ], workspaceInfo);
3638
- const libraryResult = await runRemoteTemplateCommand(workspaceInfo, fullPath, libraryTemplateInfo);
3506
+ ], workspaceInfo), false, options?.silent ?? false);
3639
3507
  if (libraryResult.exitCode !== 0) {
3640
3508
  log.error(`Failed to create default library, exit code: ${libraryResult.exitCode}`);
3641
3509
  return libraryResult;
@@ -3643,7 +3511,7 @@ async function executeMonorepoTemplate(workspaceInfo, templateInfo, interactive)
3643
3511
  const libraryPackageName = workspaceInfo.monorepoScope ? `${workspaceInfo.monorepoScope}/utils` : "utils";
3644
3512
  const libraryProjectPath = path.join(fullPath, libraryDir);
3645
3513
  setPackageName(libraryProjectPath, libraryPackageName);
3646
- rewriteMonorepoProject(libraryProjectPath, workspaceInfo.packageManager);
3514
+ rewriteMonorepoProject(libraryProjectPath, workspaceInfo.packageManager, void 0, options?.silent ?? false);
3647
3515
  return {
3648
3516
  exitCode: 0,
3649
3517
  projectDir: templateInfo.targetDir
@@ -3657,18 +3525,13 @@ const RENAME_FILES = {
3657
3525
  function renameFiles(projectDir) {
3658
3526
  for (const [from, to] of Object.entries(RENAME_FILES)) {
3659
3527
  const fromPath = path.join(projectDir, from);
3660
- if (fs.existsSync(fromPath)) {
3661
- fs.renameSync(fromPath, path.join(projectDir, to));
3662
- }
3528
+ if (fs.existsSync(fromPath)) fs.renameSync(fromPath, path.join(projectDir, to));
3663
3529
  }
3664
3530
  }
3665
3531
  function getScopeFromPackageName(packageName) {
3666
- if (packageName.startsWith("@")) {
3667
- return packageName.split("/")[0];
3668
- }
3532
+ if (packageName.startsWith("@")) return packageName.split("/")[0];
3669
3533
  return "";
3670
3534
  }
3671
-
3672
3535
  //#endregion
3673
3536
  //#region src/create/bin.ts
3674
3537
  const helpMessage = renderCliDoc({
@@ -3711,6 +3574,10 @@ const helpMessage = renderCliDoc({
3711
3574
  label: "--no-hooks",
3712
3575
  description: "Skip pre-commit hooks setup"
3713
3576
  },
3577
+ {
3578
+ label: "--verbose",
3579
+ description: "Show detailed scaffolding output"
3580
+ },
3714
3581
  {
3715
3582
  label: "--no-interactive",
3716
3583
  description: "Run in non-interactive mode"
@@ -3838,7 +3705,8 @@ function parseArgs() {
3838
3705
  "list",
3839
3706
  "all",
3840
3707
  "interactive",
3841
- "hooks"
3708
+ "hooks",
3709
+ "verbose"
3842
3710
  ],
3843
3711
  string: [
3844
3712
  "directory",
@@ -3847,14 +3715,14 @@ function parseArgs() {
3847
3715
  ],
3848
3716
  default: { interactive: defaultInteractive() }
3849
3717
  });
3850
- const templateName = parsed._[0];
3851
3718
  return {
3852
- templateName,
3719
+ templateName: parsed._[0],
3853
3720
  options: {
3854
3721
  directory: parsed.directory,
3855
3722
  interactive: parsed.interactive,
3856
3723
  list: parsed.list || false,
3857
3724
  help: parsed.help || false,
3725
+ verbose: parsed.verbose || false,
3858
3726
  agent: parsed.agent,
3859
3727
  editor: parsed.editor,
3860
3728
  hooks: parsed.hooks
@@ -3862,8 +3730,56 @@ function parseArgs() {
3862
3730
  templateArgs
3863
3731
  };
3864
3732
  }
3733
+ function describeScaffold(templateName, templateArgs) {
3734
+ if (templateName === BuiltinTemplate.monorepo) return "Vite+ monorepo";
3735
+ if (templateName === BuiltinTemplate.generator) return "generator scaffold";
3736
+ if (templateName === BuiltinTemplate.library) return "TypeScript library";
3737
+ const selectedTemplate = getTemplateOption(templateArgs);
3738
+ if (selectedTemplate) return formatTemplateName(selectedTemplate);
3739
+ if (templateName === BuiltinTemplate.application) return "Vite application";
3740
+ }
3741
+ function getTemplateOption(args) {
3742
+ for (let index = 0; index < args.length; index++) {
3743
+ const arg = args[index];
3744
+ if (arg === "--template" || arg === "-t") return args[index + 1];
3745
+ if (arg.startsWith("--template=")) return arg.slice(11);
3746
+ }
3747
+ }
3748
+ function formatTemplateName(templateName) {
3749
+ const templateAliases = {
3750
+ lit: "Lit",
3751
+ preact: "Preact",
3752
+ react: "React",
3753
+ "react-router": "React Router",
3754
+ solid: "Solid",
3755
+ svelte: "Svelte",
3756
+ vanilla: "Vanilla",
3757
+ vue: "Vue"
3758
+ };
3759
+ const isTypeScript = templateName.endsWith("-ts");
3760
+ const baseName = isTypeScript ? templateName.slice(0, -3) : templateName;
3761
+ return `${templateAliases[baseName] ?? baseName.split(/[-_]/).map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1)).join(" ")} + ${isTypeScript ? "TypeScript" : "JavaScript"}`;
3762
+ }
3763
+ function formatDuration(durationMs) {
3764
+ if (durationMs < 1e3) return `${Math.max(1, durationMs)}ms`;
3765
+ const durationSeconds = durationMs / 1e3;
3766
+ if (durationSeconds < 10) return `${durationSeconds.toFixed(1)}s`;
3767
+ return `${Math.round(durationSeconds)}s`;
3768
+ }
3769
+ function getNextCommand(projectDir, command) {
3770
+ if (!projectDir || projectDir === ".") return command;
3771
+ return `cd ${projectDir} && ${command}`;
3772
+ }
3773
+ function showCreateSummary(options) {
3774
+ const { description, installSummary, nextCommand, packageManager, packageManagerVersion, projectDir } = options;
3775
+ log$1(`${styleText("magenta", "◇")} Scaffolded ${accent(projectDir)}${description ? ` with ${description}` : ""}`);
3776
+ log$1(`${styleText("gray", "•")} Node ${process.versions.node} ${packageManager} ${packageManagerVersion}`);
3777
+ if (installSummary?.status === "installed") log$1(`${styleText("green", "✓")} Dependencies installed in ${formatDuration(installSummary.durationMs)}`);
3778
+ log$1(`${styleText("blue", "→")} Next: ${accent(nextCommand)}`);
3779
+ }
3865
3780
  async function main() {
3866
3781
  const { templateName, options, templateArgs } = parseArgs();
3782
+ const compactOutput = !options.verbose;
3867
3783
  if (options.help) {
3868
3784
  log$1(vitePlusHeader() + "\n");
3869
3785
  log$1(helpMessage);
@@ -3887,7 +3803,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
3887
3803
  `);
3888
3804
  process.exit(1);
3889
3805
  }
3890
- intro(vitePlusHeader());
3806
+ if (options.interactive) intro(vitePlusHeader());
3891
3807
  let targetDir = "";
3892
3808
  let packageName = "";
3893
3809
  if (options.directory) {
@@ -3902,9 +3818,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
3902
3818
  const cwd = process.cwd();
3903
3819
  const workspaceInfoOptional = await detectWorkspace$1(cwd);
3904
3820
  const isMonorepo = workspaceInfoOptional.isMonorepo;
3905
- if (!isMonorepo) {
3906
- workspaceInfoOptional.rootDir = cwd;
3907
- }
3821
+ if (!isMonorepo) workspaceInfoOptional.rootDir = cwd;
3908
3822
  const cwdRelativeToRoot = isMonorepo && workspaceInfoOptional.rootDir !== cwd ? displayRelative(cwd, workspaceInfoOptional.rootDir) : "";
3909
3823
  const isInSubdirectory = cwdRelativeToRoot !== "";
3910
3824
  const cwdUnderParentDir = isInSubdirectory ? workspaceInfoOptional.parentDirs.some((dir) => cwdRelativeToRoot === dir || cwdRelativeToRoot.startsWith(`${dir}/`)) : true;
@@ -3914,25 +3828,20 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
3914
3828
  let selectedAgentTargetPaths;
3915
3829
  let selectedEditor;
3916
3830
  let selectedParentDir;
3831
+ let shouldSetupHooks = false;
3917
3832
  if (!selectedTemplateName) {
3918
3833
  const templates = [];
3919
3834
  if (isMonorepo) {
3920
- for (const pkg of workspaceInfoOptional.packages) {
3921
- if (pkg.isTemplatePackage) {
3922
- templates.push({
3923
- label: pkg.name,
3924
- value: pkg.name,
3925
- hint: pkg.description ?? pkg.path
3926
- });
3927
- }
3928
- }
3929
- } else {
3930
- templates.push({
3931
- label: "Vite+ Monorepo",
3932
- value: BuiltinTemplate.monorepo,
3933
- hint: "Create a new Vite+ monorepo project"
3835
+ for (const pkg of workspaceInfoOptional.packages) if (pkg.isTemplatePackage) templates.push({
3836
+ label: pkg.name,
3837
+ value: pkg.name,
3838
+ hint: pkg.description ?? pkg.path
3934
3839
  });
3935
- }
3840
+ } else templates.push({
3841
+ label: "Vite+ Monorepo",
3842
+ value: BuiltinTemplate.monorepo,
3843
+ hint: "Create a new Vite+ monorepo project"
3844
+ });
3936
3845
  const template = await select({
3937
3846
  message: "",
3938
3847
  options: [
@@ -3964,71 +3873,51 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
3964
3873
  }
3965
3874
  ]
3966
3875
  });
3967
- if (Ct(template)) {
3968
- cancelAndExit();
3969
- }
3876
+ if (Ct(template)) cancelAndExit();
3970
3877
  if (template === "other") {
3971
3878
  const customTemplate = await text({
3972
3879
  message: "Enter the template package name:",
3973
3880
  placeholder: "e.g., create-next-app, create-nuxt",
3974
3881
  validate: (value) => {
3975
- if (!value || value.trim().length === 0) {
3976
- return "Template name is required";
3977
- }
3882
+ if (!value || value.trim().length === 0) return "Template name is required";
3978
3883
  }
3979
3884
  });
3980
- if (Ct(customTemplate)) {
3981
- cancelAndExit();
3982
- }
3885
+ if (Ct(customTemplate)) cancelAndExit();
3983
3886
  selectedTemplateName = customTemplate;
3984
- } else {
3985
- selectedTemplateName = template;
3986
- }
3887
+ } else selectedTemplateName = template;
3987
3888
  }
3988
3889
  const isBuiltinTemplate = selectedTemplateName.startsWith("vite:");
3989
- if (targetDir && !isBuiltinTemplate) {
3990
- cancelAndExit("The --directory option is only available for builtin templates", 1);
3991
- }
3890
+ if (targetDir && !isBuiltinTemplate) cancelAndExit("The --directory option is only available for builtin templates", 1);
3992
3891
  if (selectedTemplateName === BuiltinTemplate.monorepo && isMonorepo) {
3993
3892
  log.info("You are already in a monorepo workspace.\nUse a different template or run this command outside the monorepo");
3994
3893
  cancelAndExit("Cannot create a monorepo inside an existing monorepo", 1);
3995
3894
  }
3996
- if (isInSubdirectory) {
3997
- log.info(`Detected monorepo root at ${accent(workspaceInfoOptional.rootDir)}`);
3998
- }
3895
+ if (isInSubdirectory && !compactOutput) log.info(`Detected monorepo root at ${accent(workspaceInfoOptional.rootDir)}`);
3999
3896
  if (isMonorepo && options.interactive && !targetDir) {
4000
3897
  let parentDir;
4001
- const hasParentDirs = workspaceInfoOptional.parentDirs.length > 0;
4002
- if (hasParentDirs || isInSubdirectory) {
3898
+ if (workspaceInfoOptional.parentDirs.length > 0 || isInSubdirectory) {
4003
3899
  const dirOptions = workspaceInfoOptional.parentDirs.map((dir) => ({
4004
3900
  label: `${dir}/`,
4005
3901
  value: dir,
4006
3902
  hint: ""
4007
3903
  }));
4008
- if (shouldOfferCwdOption) {
4009
- dirOptions.push({
4010
- label: `${cwdRelativeToRoot}/ (current directory)`,
4011
- value: cwdRelativeToRoot,
4012
- hint: ""
4013
- });
4014
- }
3904
+ if (shouldOfferCwdOption) dirOptions.push({
3905
+ label: `${cwdRelativeToRoot}/ (current directory)`,
3906
+ value: cwdRelativeToRoot,
3907
+ hint: ""
3908
+ });
4015
3909
  dirOptions.push({
4016
3910
  label: "other directory",
4017
3911
  value: "other",
4018
3912
  hint: "Enter a custom target directory"
4019
3913
  });
4020
- const defaultParentDir = shouldOfferCwdOption ? cwdRelativeToRoot : inferParentDir(selectedTemplateName, workspaceInfoOptional) ?? workspaceInfoOptional.parentDirs[0];
4021
3914
  const selected = await select({
4022
3915
  message: "Where should the new package be added to the monorepo:",
4023
3916
  options: dirOptions,
4024
- initialValue: defaultParentDir
3917
+ initialValue: shouldOfferCwdOption ? cwdRelativeToRoot : inferParentDir(selectedTemplateName, workspaceInfoOptional) ?? workspaceInfoOptional.parentDirs[0]
4025
3918
  });
4026
- if (Ct(selected)) {
4027
- cancelAndExit();
4028
- }
4029
- if (selected !== "other") {
4030
- parentDir = selected;
4031
- }
3919
+ if (Ct(selected)) cancelAndExit();
3920
+ if (selected !== "other") parentDir = selected;
4032
3921
  }
4033
3922
  if (!parentDir) {
4034
3923
  const customTargetDir = await text({
@@ -4038,142 +3927,124 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
4038
3927
  return value ? formatTargetDir(value).error : "Target directory is required";
4039
3928
  }
4040
3929
  });
4041
- if (Ct(customTargetDir)) {
4042
- cancelAndExit();
4043
- }
3930
+ if (Ct(customTargetDir)) cancelAndExit();
4044
3931
  parentDir = customTargetDir;
4045
3932
  }
4046
3933
  selectedParentDir = parentDir;
4047
3934
  }
4048
3935
  if (isMonorepo && !options.interactive && !targetDir) {
4049
- if (isInSubdirectory) {
4050
- log.info(`Use ${accent("--directory")} to specify a different target location.`);
4051
- }
4052
- const inferredParentDir = inferParentDir(selectedTemplateName, workspaceInfoOptional) ?? workspaceInfoOptional.parentDirs[0];
4053
- selectedParentDir = inferredParentDir;
3936
+ if (isInSubdirectory && !compactOutput) log.info(`Use ${accent("--directory")} to specify a different target location.`);
3937
+ selectedParentDir = inferParentDir(selectedTemplateName, workspaceInfoOptional) ?? workspaceInfoOptional.parentDirs[0];
4054
3938
  }
4055
- if (isBuiltinTemplate && !targetDir) {
4056
- if (selectedTemplateName === BuiltinTemplate.monorepo) {
4057
- const selected = await promptPackageNameAndTargetDir(getRandomProjectName({ fallbackName: "vite-plus-monorepo" }), options.interactive);
4058
- packageName = selected.packageName;
4059
- targetDir = selected.targetDir;
4060
- } else {
4061
- const defaultPackageName = getRandomProjectName({
4062
- scope: workspaceInfoOptional.monorepoScope,
4063
- fallbackName: `vite-plus-${selectedTemplateName.split(":")[1]}`
4064
- });
4065
- const selected = await promptPackageNameAndTargetDir(defaultPackageName, options.interactive);
4066
- packageName = selected.packageName;
4067
- targetDir = selectedParentDir ? path.join(selectedParentDir, selected.targetDir) : selected.targetDir;
4068
- }
3939
+ if (isBuiltinTemplate && !targetDir) if (selectedTemplateName === BuiltinTemplate.monorepo) {
3940
+ const selected = await promptPackageNameAndTargetDir(getRandomProjectName({ fallbackName: "vite-plus-monorepo" }), options.interactive);
3941
+ packageName = selected.packageName;
3942
+ targetDir = selected.targetDir;
3943
+ } else {
3944
+ const selected = await promptPackageNameAndTargetDir(getRandomProjectName({
3945
+ scope: workspaceInfoOptional.monorepoScope,
3946
+ fallbackName: `vite-plus-${selectedTemplateName.split(":")[1]}`
3947
+ }), options.interactive);
3948
+ packageName = selected.packageName;
3949
+ targetDir = selectedParentDir ? path.join(selectedParentDir, selected.targetDir) : selected.targetDir;
4069
3950
  }
4070
- const packageManager = workspaceInfoOptional.packageManager ?? await selectPackageManager(options.interactive);
4071
- const shouldSilencePackageManagerInstallLog = isMonorepo && workspaceInfoOptional.packageManager !== undefined;
3951
+ const packageManager = workspaceInfoOptional.packageManager ?? await selectPackageManager(options.interactive, compactOutput);
3952
+ const shouldSilencePackageManagerInstallLog = compactOutput || isMonorepo && workspaceInfoOptional.packageManager !== void 0;
4072
3953
  const downloadResult = await downloadPackageManager$1(packageManager, workspaceInfoOptional.packageManagerVersion, options.interactive, shouldSilencePackageManagerInstallLog);
4073
3954
  const workspaceInfo = {
4074
3955
  ...workspaceInfoOptional,
4075
3956
  packageManager,
4076
3957
  downloadPackageManager: downloadResult
4077
3958
  };
4078
- const existingAgentTargetPaths = options.agent !== undefined || !options.interactive ? undefined : detectExistingAgentTargetPaths(workspaceInfoOptional.rootDir);
4079
- selectedAgentTargetPaths = existingAgentTargetPaths !== undefined ? existingAgentTargetPaths : await selectAgentTargetPaths({
3959
+ const existingAgentTargetPaths = options.agent !== void 0 || !options.interactive ? void 0 : detectExistingAgentTargetPaths(workspaceInfoOptional.rootDir);
3960
+ selectedAgentTargetPaths = existingAgentTargetPaths !== void 0 ? existingAgentTargetPaths : await selectAgentTargetPaths({
4080
3961
  interactive: options.interactive,
4081
3962
  agent: options.agent,
4082
3963
  onCancel: () => cancelAndExit()
4083
3964
  });
4084
- const existingEditor = options.editor || !options.interactive ? undefined : detectExistingEditor(workspaceInfoOptional.rootDir);
4085
- selectedEditor = existingEditor ?? await selectEditor({
3965
+ selectedEditor = (options.editor || !options.interactive ? void 0 : detectExistingEditor(workspaceInfoOptional.rootDir)) ?? await selectEditor({
4086
3966
  interactive: options.interactive,
4087
3967
  editor: options.editor,
4088
3968
  onCancel: () => cancelAndExit()
4089
3969
  });
3970
+ shouldSetupHooks = await promptGitHooks(options);
4090
3971
  const templateInfo = discoverTemplate(selectedTemplateName, selectedTemplateArgs, workspaceInfo, options.interactive);
4091
- if (selectedParentDir) {
4092
- templateInfo.parentDir = selectedParentDir;
4093
- }
4094
- if (targetDir) {
4095
- templateInfo.parentDir = undefined;
4096
- }
3972
+ if (selectedParentDir) templateInfo.parentDir = selectedParentDir;
3973
+ if (targetDir) templateInfo.parentDir = void 0;
4097
3974
  if (templateInfo.command === BuiltinTemplate.monorepo) {
4098
3975
  await checkProjectDirExists(path.join(workspaceInfo.rootDir, targetDir), options.interactive);
4099
3976
  const result = await executeMonorepoTemplate(workspaceInfo, {
4100
3977
  ...templateInfo,
4101
3978
  packageName,
4102
3979
  targetDir
4103
- }, options.interactive);
3980
+ }, options.interactive, { silent: compactOutput });
4104
3981
  const { projectDir } = result;
4105
- if (result.exitCode !== 0 || !projectDir) {
4106
- cancelAndExit(`Failed to create monorepo, exit code: ${result.exitCode}`, result.exitCode);
4107
- }
3982
+ if (result.exitCode !== 0 || !projectDir) cancelAndExit(`Failed to create monorepo, exit code: ${result.exitCode}`, result.exitCode);
4108
3983
  const fullPath = path.join(workspaceInfo.rootDir, projectDir);
4109
3984
  await writeAgentInstructions({
4110
3985
  projectRoot: fullPath,
4111
3986
  targetPaths: selectedAgentTargetPaths,
4112
- interactive: options.interactive
3987
+ interactive: options.interactive,
3988
+ silent: compactOutput
4113
3989
  });
4114
3990
  await writeEditorConfigs({
4115
3991
  projectRoot: fullPath,
4116
3992
  editorId: selectedEditor,
4117
- interactive: options.interactive
3993
+ interactive: options.interactive,
3994
+ silent: compactOutput
4118
3995
  });
4119
3996
  workspaceInfo.rootDir = fullPath;
4120
- rewriteMonorepo(workspaceInfo);
4121
- const shouldSetupHooks = await promptGitHooks(options);
4122
- if (shouldSetupHooks) {
4123
- installGitHooks(fullPath);
4124
- }
4125
- await runViteInstall(fullPath, options.interactive);
4126
- await runViteFmt(fullPath, options.interactive);
4127
- outro(`✔ Created ${accent(projectDir)}!`);
4128
- log$1(styleText("bold", "Next steps:"));
4129
- log$1(` ${accent(`cd ${projectDir}`)}`);
4130
- log$1(` ${accent(`vp dev ${InitialMonorepoAppDir}`)}`);
3997
+ rewriteMonorepo(workspaceInfo, void 0, compactOutput);
3998
+ if (shouldSetupHooks) installGitHooks(fullPath, compactOutput);
3999
+ const installSummary = await runViteInstall(fullPath, options.interactive, void 0, { silent: compactOutput });
4000
+ await runViteFmt(fullPath, options.interactive, void 0, { silent: compactOutput });
4001
+ showCreateSummary({
4002
+ description: describeScaffold(selectedTemplateName, selectedTemplateArgs),
4003
+ installSummary,
4004
+ nextCommand: getNextCommand(projectDir, `vp dev ${InitialMonorepoAppDir}`),
4005
+ packageManager: workspaceInfo.packageManager,
4006
+ packageManagerVersion: workspaceInfo.downloadPackageManager.version,
4007
+ projectDir
4008
+ });
4131
4009
  return;
4132
4010
  }
4133
4011
  let result;
4134
4012
  if (templateInfo.type === TemplateType.builtin) {
4135
4013
  if (!targetDir) {
4136
- const defaultPackageName = getRandomProjectName({
4014
+ const selected = await promptPackageNameAndTargetDir(getRandomProjectName({
4137
4015
  scope: workspaceInfo.monorepoScope,
4138
4016
  fallbackName: `vite-plus-${templateInfo.command.split(":")[1]}`
4139
- });
4140
- const selected = await promptPackageNameAndTargetDir(defaultPackageName, options.interactive);
4017
+ }), options.interactive);
4141
4018
  packageName = selected.packageName;
4142
4019
  targetDir = templateInfo.parentDir ? path.join(templateInfo.parentDir, selected.targetDir) : selected.targetDir;
4143
4020
  }
4144
4021
  await checkProjectDirExists(targetDir, options.interactive);
4145
- log.info(`Target directory: ${accent(formatDisplayTargetDir(targetDir))}`);
4146
4022
  result = await executeBuiltinTemplate(workspaceInfo, {
4147
4023
  ...templateInfo,
4148
4024
  packageName,
4149
4025
  targetDir
4150
- });
4151
- } else {
4152
- result = await executeRemoteTemplate(workspaceInfo, templateInfo);
4153
- }
4154
- if (result.exitCode !== 0) {
4155
- process.exit(result.exitCode);
4156
- }
4026
+ }, { silent: compactOutput });
4027
+ } else result = await executeRemoteTemplate(workspaceInfo, templateInfo, { silent: compactOutput });
4028
+ if (result.exitCode !== 0) process.exit(result.exitCode);
4157
4029
  const projectDir = result.projectDir;
4158
- if (!projectDir) {
4159
- process.exit(0);
4160
- }
4161
- log.success(`Project directory: ${accent(projectDir)}`);
4030
+ if (!projectDir) process.exit(0);
4162
4031
  const fullPath = path.join(workspaceInfo.rootDir, projectDir);
4163
- const agentInstructionsRoot = isMonorepo ? workspaceInfo.rootDir : fullPath;
4164
4032
  await writeAgentInstructions({
4165
- projectRoot: agentInstructionsRoot,
4033
+ projectRoot: isMonorepo ? workspaceInfo.rootDir : fullPath,
4166
4034
  targetPaths: selectedAgentTargetPaths,
4167
- interactive: options.interactive
4035
+ interactive: options.interactive,
4036
+ silent: compactOutput
4168
4037
  });
4169
4038
  await writeEditorConfigs({
4170
4039
  projectRoot: fullPath,
4171
4040
  editorId: selectedEditor,
4172
- interactive: options.interactive
4041
+ interactive: options.interactive,
4042
+ silent: compactOutput
4173
4043
  });
4044
+ let installSummary;
4174
4045
  if (isMonorepo) {
4175
- log.step("Monorepo integration...");
4176
- rewriteMonorepoProject(fullPath, workspaceInfo.packageManager);
4046
+ if (!compactOutput) log.step("Monorepo integration...");
4047
+ rewriteMonorepoProject(fullPath, workspaceInfo.packageManager, void 0, compactOutput);
4177
4048
  if (workspaceInfo.packages.length > 0) {
4178
4049
  if (options.interactive) {
4179
4050
  const selectedDepTypeOptions = await multiselect({
@@ -4187,9 +4058,7 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
4187
4058
  required: false
4188
4059
  });
4189
4060
  let selectedDepTypes = [];
4190
- if (!Ct(selectedDepTypeOptions)) {
4191
- selectedDepTypes = selectedDepTypeOptions;
4192
- }
4061
+ if (!Ct(selectedDepTypeOptions)) selectedDepTypes = selectedDepTypeOptions;
4193
4062
  for (const selectedDepType of selectedDepTypes) {
4194
4063
  const selected = await multiselect({
4195
4064
  message: `Which packages should be added as ${selectedDepType} to ${success(projectDir)}?`,
@@ -4200,39 +4069,28 @@ Use \`vp create --list\` to list all available templates, or run \`vp create --h
4200
4069
  required: false
4201
4070
  });
4202
4071
  let selectedDeps = [];
4203
- if (!Ct(selected)) {
4204
- selectedDeps = selected;
4205
- }
4206
- if (selectedDeps.length > 0) {
4207
- updatePackageJsonWithDeps(workspaceInfo.rootDir, projectDir, selectedDeps, selectedDepType);
4208
- }
4072
+ if (!Ct(selected)) selectedDeps = selected;
4073
+ if (selectedDeps.length > 0) updatePackageJsonWithDeps(workspaceInfo.rootDir, projectDir, selectedDeps, selectedDepType);
4209
4074
  }
4210
4075
  }
4211
4076
  }
4212
4077
  updateWorkspaceConfig(projectDir, workspaceInfo);
4213
- await runViteInstall(workspaceInfo.rootDir, options.interactive);
4214
- await runViteFmt(workspaceInfo.rootDir, options.interactive, [projectDir]);
4078
+ installSummary = await runViteInstall(workspaceInfo.rootDir, options.interactive, void 0, { silent: compactOutput });
4079
+ await runViteFmt(workspaceInfo.rootDir, options.interactive, [projectDir], { silent: compactOutput });
4215
4080
  } else {
4216
- rewriteStandaloneProject(fullPath, workspaceInfo);
4217
- const shouldSetupHooks = await promptGitHooks(options);
4218
- if (shouldSetupHooks) {
4219
- installGitHooks(fullPath);
4220
- }
4221
- await runViteInstall(fullPath, options.interactive);
4222
- await runViteFmt(fullPath, options.interactive);
4081
+ rewriteStandaloneProject(fullPath, workspaceInfo, void 0, compactOutput);
4082
+ if (shouldSetupHooks) installGitHooks(fullPath, compactOutput);
4083
+ installSummary = await runViteInstall(fullPath, options.interactive, void 0, { silent: compactOutput });
4084
+ await runViteFmt(fullPath, options.interactive, void 0, { silent: compactOutput });
4223
4085
  }
4224
- outro(`✔ Created ${accent(projectDir)}!`);
4225
- showNextSteps(projectDir, isMonorepo);
4226
- }
4227
- function showNextSteps(projectDir, isMonorepo) {
4228
- log$1(styleText("bold", "Next steps:"));
4229
- if (isMonorepo) {
4230
- log$1(` ${accent(`vp dev ${projectDir}`)}`);
4231
- } else {
4232
- log$1(` ${accent(`cd ${projectDir}`)}`);
4233
- log$1(` ${accent("vp dev")}`);
4234
- }
4235
- log$1("");
4086
+ showCreateSummary({
4087
+ description: describeScaffold(selectedTemplateName, selectedTemplateArgs),
4088
+ installSummary,
4089
+ nextCommand: isMonorepo ? `vp dev ${projectDir}` : getNextCommand(projectDir, "vp dev"),
4090
+ packageManager: workspaceInfo.packageManager,
4091
+ packageManagerVersion: workspaceInfo.downloadPackageManager.version,
4092
+ projectDir
4093
+ });
4236
4094
  }
4237
4095
  async function showAvailableTemplates() {
4238
4096
  log$1(vitePlusHeader() + "\n");
@@ -4243,5 +4101,4 @@ main().catch((err) => {
4243
4101
  console.error(err);
4244
4102
  cancelAndExit(`Failed to generate code: ${err.message}`, 1);
4245
4103
  });
4246
-
4247
- //#endregion
4104
+ //#endregion