(projectName: string, options: CliOptions)
| 463 | } |
| 464 | |
| 465 | async function startDevWatchMode(projectName: string, options: CliOptions) { |
| 466 | // Validate dev watch options |
| 467 | const validation = validateDevWatchOptions({ ...options, projectName }) |
| 468 | if (!validation.valid) { |
| 469 | throw new Error(validation.error) |
| 470 | } |
| 471 | |
| 472 | // Enter dev watch mode |
| 473 | if (!projectName && !options.targetDir) { |
| 474 | throw new Error('Project name/target directory is required for dev watch mode') |
| 475 | } |
| 476 | |
| 477 | if (!options.framework) { |
| 478 | throw new Error('Failed to detect framework') |
| 479 | } |
| 480 | |
| 481 | const framework = getFrameworkByName(options.framework) |
| 482 | if (!framework) { |
| 483 | throw new Error('Failed to detect framework') |
| 484 | } |
| 485 | |
| 486 | // First, create the app normally using the standard flow |
| 487 | const normalizedOpts = await normalizeOptions( |
| 488 | { |
| 489 | ...options, |
| 490 | projectName, |
| 491 | framework: framework.id, |
| 492 | }, |
| 493 | forcedAddOns, |
| 494 | ) |
| 495 | |
| 496 | if (!normalizedOpts) { |
| 497 | throw new Error('Failed to normalize options') |
| 498 | } |
| 499 | |
| 500 | currentTelemetry?.mergeProperties( |
| 501 | getResolvedCreateTelemetryProperties(normalizedOpts, options), |
| 502 | ) |
| 503 | |
| 504 | normalizedOpts.targetDir = resolve(normalizedOpts.targetDir) |
| 505 | |
| 506 | // Create the initial app with minimal output for dev watch mode |
| 507 | console.log(chalk.bold('\ndev-watch')) |
| 508 | console.log(chalk.gray('├─') + ' ' + `creating initial ${appName} app...`) |
| 509 | if (normalizedOpts.install !== false) { |
| 510 | console.log( |
| 511 | chalk.gray('├─') + ' ' + chalk.yellow('⟳') + ' installing packages...', |
| 512 | ) |
| 513 | } |
| 514 | const silentEnvironment = createUIEnvironment(appName, true, () => currentTelemetry) |
| 515 | await confirmTargetDirectorySafety(normalizedOpts.targetDir, options.force) |
| 516 | await createApp(silentEnvironment, normalizedOpts) |
| 517 | console.log(chalk.gray('└─') + ' ' + chalk.green('✓') + ` app created`) |
| 518 | |
| 519 | // Now start the dev watch mode |
| 520 | const manager = new DevWatchManager({ |
| 521 | watchPath: options.devWatch!, |
| 522 | targetDir: normalizedOpts.targetDir, |
no test coverage detected