Unverified Commit 920a7673 authored by Jiwon Choi's avatar Jiwon Choi Committed by GitHub

Honor non-interactive mode in upgrade codemod prompts (#98030)

### Why?

`@next/codemod upgrade --yes` accepts defaults for the upgrade command's
prompts, but `next-request-geo-ip` asked its own deployment question
inside `runTransform`. Because the non-interactive state was not
forwarded, automated upgrades could stop at that nested prompt despite
using `--yes`.

### How?

Pass the resolved non-interactive state from `runUpgrade` into each
transform. The geo/IP transform skips its deployment prompt in
non-interactive mode while preserving the existing prompt for direct
interactive runs.
parent 6fb98fae
...@@ -80,7 +80,7 @@ export async function runTransform( ...@@ -80,7 +80,7 @@ export async function runTransform(
transformer = res.transformer transformer = res.transformer
} }
if (transformer === 'next-request-geo-ip') { if (transformer === 'next-request-geo-ip' && !options.nonInteractive) {
const { isAppDeployedToVercel } = await prompts( const { isAppDeployedToVercel } = await prompts(
{ {
type: 'confirm', type: 'confirm',
......
...@@ -447,7 +447,11 @@ export async function runUpgrade( ...@@ -447,7 +447,11 @@ export async function runUpgrade(
runInstallation(packageManager, { cwd }) runInstallation(packageManager, { cwd })
for (const codemod of codemods) { for (const codemod of codemods) {
await runTransform(codemod, cwd, { force: true, verbose }) await runTransform(codemod, cwd, {
force: true,
verbose,
nonInteractive,
})
} }
// To reduce user-side burden of selecting which codemods to run as it needs additional // To reduce user-side burden of selecting which codemods to run as it needs additional
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment