MCPcopy Create free account
hub / github.com/TanStack/cli / startDevWatchMode

Function startDevWatchMode

packages/cli/src/cli.ts:465–532  ·  view source on GitHub ↗
(projectName: string, options: CliOptions)

Source from the content-addressed store, hash-verified

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,

Callers 2

handleCreateFunction · 0.85
cliFunction · 0.85

Calls 10

startMethod · 0.95
getFrameworkByNameFunction · 0.90
createAppFunction · 0.90
validateDevWatchOptionsFunction · 0.85
normalizeOptionsFunction · 0.85
createUIEnvironmentFunction · 0.85
mergePropertiesMethod · 0.80
logMethod · 0.80

Tested by

no test coverage detected