()
| 495 | } |
| 496 | |
| 497 | private startAppDevServer(): void { |
| 498 | if (this.appDevProcess) { |
| 499 | return |
| 500 | } |
| 501 | |
| 502 | const { command, args } = this.getDevCommandForPackageManager( |
| 503 | this.options.packageManager, |
| 504 | ) |
| 505 | |
| 506 | this.log.section('app dev server') |
| 507 | this.log.tree(' ', `starting: ${chalk.cyan([command, ...args].join(' '))}`) |
| 508 | |
| 509 | this.appDevProcess = spawn(command, args, { |
| 510 | cwd: this.options.targetDir, |
| 511 | stdio: 'inherit', |
| 512 | shell: process.platform === 'win32', |
| 513 | env: process.env, |
| 514 | }) |
| 515 | |
| 516 | this.appDevProcess.on('exit', (code, signal) => { |
| 517 | if (signal) { |
| 518 | this.log.warning(`app dev server exited via signal ${signal}`) |
| 519 | } else if (code && code !== 0) { |
| 520 | this.log.warning(`app dev server exited with code ${code}`) |
| 521 | } |
| 522 | this.appDevProcess = null |
| 523 | }) |
| 524 | |
| 525 | this.appDevProcess.on('error', (error) => { |
| 526 | this.log.error(`Failed to start app dev server: ${error.message}`) |
| 527 | this.appDevProcess = null |
| 528 | }) |
| 529 | } |
| 530 | |
| 531 | private getDevCommandForPackageManager(packageManager: string): { |
| 532 | command: string |
no test coverage detected