@@ -72,14 +72,14 @@ function endMessage() {
7272 )
7373}
7474
75- const CWD = process . cwd ( )
75+ const cwd = process . cwd ( )
7676
7777export async function runUpgrade (
7878 revision : string | undefined ,
7979 options : { verbose : boolean }
8080) : Promise < void > {
8181 const { verbose } = options
82- const appPackageJsonPath = path . resolve ( CWD , 'package.json' )
82+ const appPackageJsonPath = path . resolve ( cwd , 'package.json' )
8383 let appPackageJson = JSON . parse ( fs . readFileSync ( appPackageJsonPath , 'utf8' ) )
8484
8585 let targetNextPackageJson : {
@@ -128,8 +128,8 @@ export async function runUpgrade(
128128 console . log ( ` - Next.js: v${ installedNextVersion } ` )
129129 let shouldStayOnReact18 = false
130130
131- const usesAppDir = isUsingAppDir ( CWD )
132- const usesPagesDir = isUsingPagesDir ( CWD )
131+ const usesAppDir = isUsingAppDir ( cwd )
132+ const usesPagesDir = isUsingPagesDir ( cwd )
133133
134134 const isPureAppRouter = usesAppDir && ! usesPagesDir
135135 const isMixedApp = usesPagesDir && usesAppDir
@@ -185,7 +185,7 @@ export async function runUpgrade(
185185 installedNextVersion ,
186186 targetNextVersion
187187 )
188- const packageManager : PackageManager = getPkgManager ( CWD )
188+ const packageManager : PackageManager = getPkgManager ( cwd )
189189
190190 let shouldRunReactCodemods = false
191191 let shouldRunReactTypesCodemods = false
@@ -323,7 +323,7 @@ export async function runUpgrade(
323323 runInstallation ( packageManager )
324324
325325 for ( const codemod of codemods ) {
326- await runTransform ( codemod , CWD , { force : true , verbose } )
326+ await runTransform ( codemod , cwd , { force : true , verbose } )
327327 }
328328
329329 // To reduce user-side burden of selecting which codemods to run as it needs additional
@@ -357,12 +357,12 @@ function getInstalledNextVersion(): string {
357357 try {
358358 return require (
359359 require . resolve ( 'next/package.json' , {
360- paths : [ CWD ] ,
360+ paths : [ cwd ] ,
361361 } )
362362 ) . version
363363 } catch ( error ) {
364364 throw new BadInput (
365- `Failed to get the installed Next.js version at "${ CWD } ".\nIf you're using a monorepo, please run this command from the Next.js app directory.` ,
365+ `Failed to get the installed Next.js version at "${ cwd } ".\nIf you're using a monorepo, please run this command from the Next.js app directory.` ,
366366 {
367367 cause : error ,
368368 }
@@ -374,12 +374,12 @@ function getInstalledReactVersion(): string {
374374 try {
375375 return require (
376376 require . resolve ( 'react/package.json' , {
377- paths : [ CWD ] ,
377+ paths : [ cwd ] ,
378378 } )
379379 ) . version
380380 } catch ( error ) {
381381 throw new BadInput (
382- `Failed to detect the installed React version in "${ CWD } ".\nIf you're working in a monorepo, please run this command from the Next.js app directory.` ,
382+ `Failed to detect the installed React version in "${ cwd } ".\nIf you're working in a monorepo, please run this command from the Next.js app directory.` ,
383383 {
384384 cause : error ,
385385 }
0 commit comments