Unverified Commit 5b2a1700 authored by Jiwon Choi's avatar Jiwon Choi Committed by GitHub

refactor(next-upgrade): tailor turbopack suggestion message (#70931)

Lower a bit of certainty in stableness with Turbopack dev yet. Inform
user clearly to add `--turbo` manually if `next dev` wasn't found.
parent 710b0ae9
...@@ -153,14 +153,14 @@ function getInstalledNextVersion(): string { ...@@ -153,14 +153,14 @@ function getInstalledNextVersion(): string {
* showing the current dev command as the initial value. * showing the current dev command as the initial value.
*/ */
async function suggestTurbopack(packageJson: any): Promise<void> { async function suggestTurbopack(packageJson: any): Promise<void> {
const devScript = packageJson.scripts['dev'] const devScript: string = packageJson.scripts['dev']
if (devScript.includes('--turbo')) return if (devScript.includes('--turbo')) return
const responseTurbopack = await prompts( const responseTurbopack = await prompts(
{ {
type: 'confirm', type: 'confirm',
name: 'enable', name: 'enable',
message: 'Turbopack is now the stable default for dev mode. Enable it?', message: 'Enable Turbopack for next dev?',
initial: true, initial: true,
}, },
{ onCancel } { onCancel }
...@@ -178,11 +178,15 @@ async function suggestTurbopack(packageJson: any): Promise<void> { ...@@ -178,11 +178,15 @@ async function suggestTurbopack(packageJson: any): Promise<void> {
return return
} }
console.log(
`${chalk.yellow('⚠')} Could not find "${chalk.bold('next dev')}" in your dev script.`
)
const responseCustomDevScript = await prompts( const responseCustomDevScript = await prompts(
{ {
type: 'text', type: 'text',
name: 'customDevScript', name: 'customDevScript',
message: 'Please add `--turbo` to your dev command:', message: 'Please manually add "--turbo" to your dev command.',
initial: devScript, initial: devScript,
}, },
{ onCancel } { onCancel }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment