Skip to content

fix(angular-devkit): correctly parse inline boolean values in CLI options - #34201

Closed
alan-agius4 wants to merge 6 commits into
angular:mainfrom
alan-agius4:fix-parse-args
Closed

alan-agius4 wants to merge 6 commits into
angular:mainfrom
alan-agius4:fix-parse-args

Conversation

@alan-agius4

Copy link
Copy Markdown
Collaborator

When CLI options defined as boolean are provided with inline values like --debug=false or --dry-run=false, Node's node:util.parseArgs in non-strict mode returns string values ('false' / 'true') rather than booleans. This caused false values to evaluate as truthy.

Normalize string boolean values in CLI options for both @angular-devkit/schematics-cli and @angular-devkit/architect.

Closes #34199

…alues in CLI options

When CLI options defined as boolean are provided with inline values like '--debug=false' or '--dry-run=false', 'node:util.parseArgs' in non-strict mode returns string values ('false' / 'true') rather than booleans. This caused false values to be treated as truthy.

Normalize string boolean values in CLI options.

Closes angular#34199
… in CLI options

When CLI options defined as boolean are provided with inline values like '--verbose=false', 'node:util.parseArgs' in non-strict mode returns string values ('false' / 'true') rather than booleans.

Normalize string boolean values in CLI options.
@alan-agius4
alan-agius4 requested a review from clydin September 29, 2026 12:49
@alan-agius4 alan-agius4 added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release labels Sep 29, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces logic to parse explicit string representations of booleans ('true' and 'false') into actual boolean values within both the architect and schematics CLI parsers, accompanied by comprehensive unit tests. The feedback suggests simplifying this parsing logic in both files by removing the redundant typeof value === 'string' check, as strict equality comparisons with 'true' and 'false' already guarantee the type.

Comment thread packages/angular_devkit/architect/bin/architect.ts Outdated
Comment thread packages/angular_devkit/schematics_cli/bin/schematics.ts Outdated
Comment thread packages/angular_devkit/schematics_cli/bin/schematics.ts Outdated
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Sep 29, 2026
@alan-agius4

Copy link
Copy Markdown
Collaborator Author

This PR was merged into the repository. The changes were merged into the following branches:

alan-agius4 added a commit that referenced this pull request Sep 29, 2026
…alues in CLI options (#34201)

When CLI options defined as boolean are provided with inline values like '--debug=false' or '--dry-run=false', 'node:util.parseArgs' in non-strict mode returns string values ('false' / 'true') rather than booleans. This caused false values to be treated as truthy.

Normalize string boolean values in CLI options.

Closes #34199

PR Close #34201
alan-agius4 added a commit that referenced this pull request Sep 29, 2026
… in CLI options (#34201)

When CLI options defined as boolean are provided with inline values like '--verbose=false', 'node:util.parseArgs' in non-strict mode returns string values ('false' / 'true') rather than booleans.

Normalize string boolean values in CLI options.

PR Close #34201
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this pull request Sep 29, 2026
… in CLI options (angular#34201)

When CLI options defined as boolean are provided with inline values like '--verbose=false', 'node:util.parseArgs' in non-strict mode returns string values ('false' / 'true') rather than booleans.

Normalize string boolean values in CLI options.

PR Close angular#34201
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @angular-devkit/architect area: @angular-devkit/schematics-cli target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

schematics-cli: --dry-run=false, --debug=false and other built-in boolean flags are treated as true

2 participants