()
| 96 | } |
| 97 | |
| 98 | async start(): Promise<void> { |
| 99 | // Validate watch path |
| 100 | if (!fs.existsSync(this.options.watchPath)) { |
| 101 | throw new Error(`Watch path does not exist: ${this.options.watchPath}`) |
| 102 | } |
| 103 | |
| 104 | // Validate target directory exists (should have been created by createApp) |
| 105 | if (!fs.existsSync(this.options.targetDir)) { |
| 106 | throw new Error( |
| 107 | `Target directory does not exist: ${this.options.targetDir}`, |
| 108 | ) |
| 109 | } |
| 110 | |
| 111 | if (this.options.cliOptions.install === false) { |
| 112 | throw new Error('Cannot use the --no-install flag when using --dev-watch') |
| 113 | } |
| 114 | |
| 115 | // Log startup with tree style |
| 116 | console.log() |
| 117 | console.log(chalk.bold('dev-watch')) |
| 118 | this.log.tree('', `watching: ${chalk.cyan(this.options.watchPath)}`) |
| 119 | this.log.tree('', `target: ${chalk.cyan(this.options.targetDir)}`) |
| 120 | if (this.options.runDevCommand) { |
| 121 | this.log.tree('', `app dev server: ${chalk.cyan('enabled')}`) |
| 122 | } |
| 123 | this.log.tree('', 'ready', true) |
| 124 | |
| 125 | // Setup signal handlers |
| 126 | process.on('SIGINT', () => this.cleanup()) |
| 127 | process.on('SIGTERM', () => this.cleanup()) |
| 128 | |
| 129 | // Start watching |
| 130 | this.startWatcher() |
| 131 | |
| 132 | if (this.options.runDevCommand) { |
| 133 | this.startAppDevServer() |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | async stop(): Promise<void> { |
| 138 | console.log() |
no test coverage detected