Skip to content

Commit

Permalink
next-codemod(upgrade): optional catch when missing dev script (#71598)
Browse files Browse the repository at this point in the history
### Why?

During the next-codemod upgrade, when the `dev` script is missing, it
throws while reading `.includes` the undefined value.

Fixes #71597

---------

Co-authored-by: Jiwon Choi <devjiwonchoi@gmail.com>
  • Loading branch information
imprakharshukla and devjiwonchoi authored Oct 23, 2024
1 parent 9fac077 commit e9b18d6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/next-codemod/bin/upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ function isUsingAppDir(projectPath: string): boolean {
*/
async function suggestTurbopack(packageJson: any): Promise<void> {
const devScript: string = packageJson.scripts['dev']
if (devScript.includes('--turbopack')) return
if (devScript?.includes('--turbopack')) return

const responseTurbopack = await prompts(
{
Expand Down

0 comments on commit e9b18d6

Please sign in to comment.