Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
17010ae8
Unverified
Commit
17010ae8
authored
Nov 26, 2025
by
Sebastian "Sebbie" Silbermann
Committed by
GitHub
Nov 26, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[next-upgrade] Fall back to `npx` if `yarn dlx` is not available (#86384)
parent
bb1a5728
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
8 deletions
+18
-8
upgrade.ts
packages/next-codemod/bin/upgrade.ts
+18
-8
No files found.
packages/next-codemod/bin/upgrade.ts
View file @
17010ae8
...
@@ -203,7 +203,7 @@ export async function runUpgrade(
...
@@ -203,7 +203,7 @@ export async function runUpgrade(
let
shouldRunReactCodemods
=
false
let
shouldRunReactCodemods
=
false
let
shouldRunReactTypesCodemods
=
false
let
shouldRunReactTypesCodemods
=
false
let
execCommand
=
'npx'
let
execCommand
=
'npx
--yes
'
// The following React codemods are for React 19
// The following React codemods are for React 19
if
(
if
(
!
shouldStayOnReact18
&&
!
shouldStayOnReact18
&&
...
@@ -213,13 +213,7 @@ export async function runUpgrade(
...
@@ -213,13 +213,7 @@ export async function runUpgrade(
shouldRunReactCodemods
=
await
suggestReactCodemods
()
shouldRunReactCodemods
=
await
suggestReactCodemods
()
shouldRunReactTypesCodemods
=
await
suggestReactTypesCodemods
()
shouldRunReactTypesCodemods
=
await
suggestReactTypesCodemods
()
const
execCommandMap
=
{
execCommand
=
getNpxCommand
(
packageManager
)
yarn
:
'yarn dlx'
,
pnpm
:
'pnpx'
,
bun
:
'bunx'
,
npm
:
'npx'
,
}
execCommand
=
execCommandMap
[
packageManager
]
}
}
fs
.
writeFileSync
(
appPackageJsonPath
,
JSON
.
stringify
(
appPackageJson
,
null
,
2
))
fs
.
writeFileSync
(
appPackageJsonPath
,
JSON
.
stringify
(
appPackageJson
,
null
,
2
))
...
@@ -740,3 +734,19 @@ function warnDependenciesOutOfRange(
...
@@ -740,3 +734,19 @@ function warnDependenciesOutOfRange(
})
})
}
}
}
}
function
getNpxCommand
(
pkgManager
:
PackageManager
)
{
let
command
=
'npx --yes'
if
(
pkgManager
===
'pnpm'
)
{
command
=
'pnpm --silent dlx'
}
else
if
(
pkgManager
===
'yarn'
)
{
try
{
execSync
(
'yarn dlx --help'
,
{
stdio
:
'ignore'
,
cwd
})
command
=
'yarn --quiet dlx'
}
catch
{}
}
else
if
(
pkgManager
===
'bun'
)
{
command
=
'bunx'
}
return
command
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment