gridsum-vue3-pc 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/create-vue3-pc.mjs +27 -0
- package/package.json +1 -1
package/bin/create-vue3-pc.mjs
CHANGED
|
@@ -134,6 +134,17 @@ function getInstallCommand(pkgManager) {
|
|
|
134
134
|
return args;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
function getRunCommand(pkgManager, script) {
|
|
138
|
+
switch (pkgManager) {
|
|
139
|
+
case 'yarn':
|
|
140
|
+
case 'pnpm':
|
|
141
|
+
case 'bun':
|
|
142
|
+
return [pkgManager, script];
|
|
143
|
+
default:
|
|
144
|
+
return [pkgManager, 'run', script];
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
137
148
|
function runCommand(command, options = {}) {
|
|
138
149
|
const [cmd, ...args] = command;
|
|
139
150
|
const result = spawn.sync(cmd, args, {
|
|
@@ -457,12 +468,28 @@ async function main() {
|
|
|
457
468
|
autoInstall = result;
|
|
458
469
|
}
|
|
459
470
|
|
|
471
|
+
let autoStart = argv['auto-start'];
|
|
472
|
+
if (autoStart === undefined && isInteractive && autoInstall) {
|
|
473
|
+
const result = await prompts.confirm({
|
|
474
|
+
message: 'Start dev server now?',
|
|
475
|
+
initialValue: false,
|
|
476
|
+
});
|
|
477
|
+
if (prompts.isCancel(result)) return cancel();
|
|
478
|
+
autoStart = result;
|
|
479
|
+
}
|
|
480
|
+
|
|
460
481
|
if (autoInstall && !process.env._CREATE_VUE3_PC_TEST) {
|
|
461
482
|
process.stdout.write(`\r\x1b[K${pc.dim('Installing dependencies...')}\n`);
|
|
462
483
|
runCommand(getInstallCommand(pkgManager), { cwd: root });
|
|
463
484
|
process.stdout.write(`${pc.green('✓')} Dependencies installed!\n`);
|
|
464
485
|
}
|
|
465
486
|
|
|
487
|
+
if (autoStart) {
|
|
488
|
+
prompts.log.step(`Starting dev server... (press ${pc.bold('Ctrl+C')} to stop)`);
|
|
489
|
+
runCommand(getRunCommand(pkgManager, 'dev'), { cwd: root });
|
|
490
|
+
return;
|
|
491
|
+
}
|
|
492
|
+
|
|
466
493
|
const cdProjectName = path.relative(process.cwd(), root);
|
|
467
494
|
let doneMessage = '';
|
|
468
495
|
|