Commit b7e40292 authored by Tobias Koppers's avatar Tobias Koppers

Fix: declare --experimental-project as a Commander option instead of allowUnknownOption

allowUnknownOption() silently swallows all unrecognised flags, which broke the
existing CLI test 'should warn when unknown argument provided' (it passes --random
and expects Commander's 'error: unknown option' output on stderr).

The correct fix is to declare --experimental-project as a hidden option so
Commander accepts it without rejecting it as unknown. getProjectGroups() still
does its own raw argv parsing to handle repetition, per-project --port/--turbopack/
--webpack flags, etc.
Co-Authored-By: 's avatarClaude <noreply@anthropic.com>
parent fc4618f8
...@@ -234,9 +234,12 @@ program ...@@ -234,9 +234,12 @@ program
'Internal: connect to turbopack daemon' 'Internal: connect to turbopack daemon'
).hideHelp() ).hideHelp()
) )
// --experimental-project flags are parsed manually by getProjectGroups() .addOption(
// before Commander sees them, so we must allow unknown options here. new Option(
.allowUnknownOption() '--experimental-project <dir>',
'Experimental: share a Turbopack daemon across multiple projects. Pass once per project directory. Actual parsing is done by getProjectGroups() from raw argv.'
).hideHelp()
)
.action((directory: string, options: NextBuildOptions) => { .action((directory: string, options: NextBuildOptions) => {
if (options.debugPrerender) { if (options.debugPrerender) {
// @ts-expect-error not readonly // @ts-expect-error not readonly
...@@ -407,9 +410,12 @@ program ...@@ -407,9 +410,12 @@ program
'Internal: connect to turbopack daemon' 'Internal: connect to turbopack daemon'
).hideHelp() ).hideHelp()
) )
// --experimental-project flags are parsed manually by getProjectGroups() .addOption(
// before Commander sees them, so we must allow unknown options here. new Option(
.allowUnknownOption() '--experimental-project <dir>',
'Experimental: share a Turbopack daemon across multiple projects. Pass once per project directory. Actual parsing is done by getProjectGroups() from raw argv.'
).hideHelp()
)
.action( .action(
(directory: string, options: NextDevOptions, { _optionValueSources }) => { (directory: string, options: NextDevOptions, { _optionValueSources }) => {
if (options.experimentalNextConfigStripTypes) { if (options.experimentalNextConfigStripTypes) {
......
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