Skip to content

Regression on command line arguments parser #23397

@JohannesHoppe

Description

@JohannesHoppe

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

This worked in v13 of the CLI

Description

We are working on updating our ng deploy schematic for Angular 14, unfortunately some command line arguments are no longer detected correctly. Arguments like noBuild, noSilent, noDotFiles no longer work, but buildTarget and dryRun do. I assume this is related with #22778 and the fact that Yargs supports --no-flags. In the past, the word no had no meaning, now it has one: https://github.com/yargs/yargs/blob/main/docs/tricks.md#negate

In Angular 13 i was able write no-build as an argument and it was used as it-is, but now this is interpreted as the negation of build – which is an unknown argument. This breaks a couple of builders that all share some code/ideas and use the same argument called no-build.

🔬 Minimal Reproduction

Please follow our README for contributors, which is essentially:

  1. Clone the project

    git clone https://github.com/angular-schule/angular-cli-ghpages.git
    cd angular-cli-ghpages
  2. Install the dependencies

    cd src
    npm install
  3. Build the project:

    npm run build
  4. Create a local npm link:

    cd dist
    npm link
  5. Go to a new folder and create a fresh angular project:

    ng new test
    cd test
  6. Add the local version of angular-cli-ghpages.

    npm link angular-cli-ghpages
  7. Now execute the ng-add schematic.

    ng add angular-cli-ghpages
  8. This will work, but will complain about a missing git configuration (which is fine here)

    ng deploy
    ng deploy --dry-run
  9. But this will NOT work, same for all other arguments with a "no" in the name

    ng deploy --no-build

🔥 Exception or Error

ng deploy --no-build
Error: Unknown argument: build

🌍 Your Environment

Angular CLI: 14.0.2
Node: 16.15.1
Package Manager: npm 8.11.0
OS: darwin arm64

Angular: 14.0.2
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1400.2
@angular-devkit/build-angular   14.0.2
@angular-devkit/core            14.0.2
@angular-devkit/schematics      14.0.2
@schematics/angular             14.0.2
rxjs                            7.5.5
typescript                      4.7.4

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions