Repository: vitejs/vite
File: packages/create-vite/src/index.ts (TypeScript)

Code before:
  }
}

function install(root: string, agent: string) {
  if (process.env._VITE_TEST_CLI) {
    console.log(`\nInstalling dependencies with ${agent}... (skipped in test)`)
    return
  }
  console.log(`\nInstalling dependencies with ${agent}...`)
  run(agent, agent === 'yarn' ? [] : ['install'], {
    stdio: 'inherit',
    cwd: root,
  })
}

function start(root: string, agent: string) {
  if (process.env._VITE_TEST_CLI) {
    console.log('\nStarting dev server... (skipped in test)')
    return
  }
  console.log('\nStarting dev server...')
  run(agent, agent === 'npm' ? ['run', 'dev'] : ['dev'], {
    stdio: 'inherit',
    cwd: root,
  })
}

async function init() {
  const argTargetDir = argv._[0]
    ? formatTargetDir(String(argv._[0]))
    : undefined
  const argTemplate = argv.template
  const argOverwrite = argv.overwrite
  const argImmediate = argv.immediate

  const help = argv.help
  if (help) {
    console.log(helpMessage)
    return
  }

  const pkgInfo = pkgFromUserAgent(process.env.npm_config_user_agent)
  const cancel = () => prompts.cancel('Operation cancelled')

  // 1. Get project name and target dir
  let targetDir = argTargetDir
  if (!targetDir) {
    const projectName = await prompts.text({
      message: 'Project name:',
      defaultValue: defaultTargetDir,
      placeholder: defaultTargetDir,

Review comment (suggestion):
Maybe we should use clack prompts logging functions so the install steps are consistent with the other messages (e.g. the "scaffolding project ..." message)
```suggestion
function install(root: string, agent: string) {
  if (process.env._VITE_TEST_CLI) {
    prompts.log.step(`Installing dependencies with ${agent}... (skipped in test)`)
    return
  }
  prompts.log.step(`Installing dependencies with ${agent}...`)
  run(agent, agent === 'yarn' ? [] : ['install'], {
    stdio: 'inherit',
    cwd: root,
  })
}

function start(root: string, agent: string) {
  if (process.env._VITE_TEST_CLI) {
    prompts.log.step('Starting dev server... (skipped in test)')
    return
  }
  prompts.log.step('Starting dev server...')
  run(agent, agent === 'npm' ? ['run', 'dev'] : ['dev'], {
    stdio: 'inherit',
    cwd: root,
  })
}
```

Code after:
    console.error(error)
    process.exit(1)
  }
}

function install(root: string, agent: string) {
  if (process.env._VITE_TEST_CLI) {
    prompts.log.step(
      `Installing dependencies with ${agent}... (skipped in test)`,
    )
    return
  }
  prompts.log.step(`Installing dependencies with ${agent}...`)
  run(agent, agent === 'yarn' ? [] : ['install'], {
    stdio: 'inherit',
    cwd: root,
  })
}

function start(root: string, agent: string) {
  if (process.env._VITE_TEST_CLI) {
    prompts.log.step('Starting dev server... (skipped in test)')
    return
  }
  prompts.log.step('Starting dev server...')
  run(agent, agent === 'npm' ? ['run', 'dev'] : ['dev'], {
    stdio: 'inherit',
    cwd: root,
  })
}

async function init() {
  const argTargetDir = argv._[0]
    ? formatTargetDir(String(argv._[0]))
    : undefined
  const argTemplate = argv.template
  const argOverwrite = argv.overwrite
  const argImmediate = argv.immediate
  const argRolldown = argv.rolldown
  const argInteractive = argv.interactive

  const help = argv.help
  if (help) {
    console.log(helpMessage)
    return
  }

  const interactive = argInteractive ?? process.stdin.isTTY

  const pkgInfo = pkgFromUserAgent(process.env.npm_config_user_agent)
  const cancel = () => prompts.cancel('Operation cancelled')