gridsum-vue3-pc 1.0.3 → 1.0.4

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.
@@ -202,6 +202,8 @@ function runCommandAsync(command, options = {}) {
202
202
 
203
203
  function tryGitInit(root) {
204
204
  try {
205
+ const hasGit = spawn.sync('git', ['--version'], { stdio: 'ignore' });
206
+ if (hasGit.status !== 0) return;
205
207
  spawn.sync('git', ['init'], { cwd: root, stdio: 'ignore' });
206
208
  spawn.sync('git', ['add', '.'], { cwd: root, stdio: 'ignore' });
207
209
  spawn.sync('git', ['-c', 'user.name=gridsum-vue3-pc', '-c', 'user.email=gridsum-vue3-pc@local', 'commit', '-m', 'Initial project scaffolded by gridsum-vue3-pc'], {
@@ -481,6 +483,16 @@ async function main() {
481
483
  autoInstall = result;
482
484
  }
483
485
 
486
+ let autoStart = argv['auto-start'];
487
+ if (autoStart === undefined && isInteractive && autoInstall) {
488
+ const result = await prompts.confirm({
489
+ message: 'Start dev server now?',
490
+ initialValue: false,
491
+ });
492
+ if (prompts.isCancel(result)) return cancel();
493
+ autoStart = result;
494
+ }
495
+
484
496
  if (autoInstall && !process.env._CREATE_VUE3_PC_TEST) {
485
497
  process.stdout.write(`\r\x1b[K${pc.dim('Installing dependencies...')}\n`);
486
498
  runCommand(getInstallCommand(pkgManager), { cwd: root });
@@ -491,24 +503,10 @@ async function main() {
491
503
  tryGitInit(root);
492
504
  }
493
505
 
494
- let autoStart = argv['auto-start'];
495
- if (autoStart === undefined && isInteractive) {
496
- const result = await prompts.confirm({
497
- message: 'Start dev server now?',
498
- initialValue: false,
499
- });
500
- if (prompts.isCancel(result)) return cancel();
501
- autoStart = result;
502
- }
503
-
504
506
  if (autoStart) {
505
507
  prompts.log.step(`Starting dev server... (press ${pc.bold('Ctrl+C')} to stop)`);
506
- if (process.env._CREATE_VUE3_PC_TEST) {
507
- prompts.log.info('Dev server started (skipped in test)');
508
- } else {
509
- runCommand(getRunCommand(pkgManager, 'dev'), { cwd: root });
510
- return;
511
- }
508
+ runCommand(getRunCommand(pkgManager, 'dev'), { cwd: root });
509
+ return;
512
510
  }
513
511
 
514
512
  const cdProjectName = path.relative(process.cwd(), root);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gridsum-vue3-pc",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Gridsum Vue3 Vite PC Template Generator - 快速生成基于 Vue3 + Vite + TypeScript 的企业级 PC 端项目",
5
5
  "type": "module",
6
6
  "sideEffects": false,