Skip to content

Commit

Permalink
refactor: tailor turbopack suggestion message
Browse files Browse the repository at this point in the history
  • Loading branch information
devjiwonchoi committed Oct 7, 2024
1 parent 80d5b0d commit 55a9060
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 add "--turbo" to your dev command manually.',
initial: devScript,
},
{ onCancel }
Expand Down

0 comments on commit 55a9060

Please sign in to comment.