Skip to content

Commit

Permalink
refactor(next-upgrade): tailor turbopack suggestion message (#70931)
Browse files Browse the repository at this point in the history
Lower a bit of certainty in stableness with Turbopack dev yet. Inform
user clearly to add `--turbo` manually if `next dev` wasn't found.
  • Loading branch information
devjiwonchoi authored and kdy1 committed Oct 10, 2024
1 parent 42dd3f4 commit dc04e41
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions packages/next-codemod/bin/upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,14 @@ function getInstalledNextVersion(): string {
* showing the current dev command as the initial value.
*/
async function suggestTurbopack(packageJson: any): Promise<void> {
const devScript = packageJson.scripts['dev']
const devScript: string = packageJson.scripts['dev']
if (devScript.includes('--turbo')) return

const responseTurbopack = await prompts(
{
type: 'confirm',
name: 'enable',
message: 'Turbopack is now the stable default for dev mode. Enable it?',
message: 'Enable Turbopack for next dev?',
initial: true,
},
{ onCancel }
Expand All @@ -178,11 +178,15 @@ async function suggestTurbopack(packageJson: any): Promise<void> {
return
}

console.log(
`${chalk.yellow('⚠')} Could not find "${chalk.bold('next dev')}" in your dev script.`
)

const responseCustomDevScript = await prompts(
{
type: 'text',
name: 'customDevScript',
message: 'Please add `--turbo` to your dev command:',
message: 'Please manually add "--turbo" to your dev command.',
initial: devScript,
},
{ onCancel }
Expand Down

0 comments on commit dc04e41

Please sign in to comment.