Repository navigation
Closed
Labels
area: @angular/clifreq1: lowOnly reported by a handful of users who observe it rarelyseverity5: regressiontype: bug/fix
Description
🐞 Bug report
Command (mark with an x)
- [x ] new
- build
- serve
- test
- e2e
- generate
- add
- update
- lint
- extract-i18n
- run
- config
- help
- version
- doc
Is this a regression?
Yes, before you could use --collection to run a custom schematic for ng new.
Description
The schematic in --collection is ran, but options are based on @schematics/angular:ng-new instead of --colleciton.
The issue is how collectionNameFromArgs is extracted from the options:
https://github.com/angular/angular-cli/blob/main/packages/angular/cli/src/commands/new/cli.ts#L48
const {
options: { collectionNameFromArgs },
} = this.context.args;
If this line is changed to:
const {
options: { collection: collectionNameFromArgs },
} = this.context.args;
The options from --collection are used correctly.
🔬 Minimal Reproduction
Try to use ng new --collection with a collection that has arguments not in @schematics/angular:ng-new
🔥 Exception or Error
Only options for @shematics/angular:ng-new are recognized.
Error: Unknown arguments: ngrx, mock-api, snap-oauth, mock-oauth
🌍 Your Environment
```
$ ng version
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 14.0.1
Node: 16.13.1
Package Manager: yarn 1.22.17
OS: win32 x64
Angular:
...
Package Version
------------------------------------------------------
@angular-devkit/architect 0.1400.1 (cli-only)
@angular-devkit/core 14.0.1 (cli-only)
@angular-devkit/schematics 14.0.1 (cli-only)
@schematics/angular 14.0.1 (cli-only)
Metadata
Metadata
Assignees
Labels
area: @angular/clifreq1: lowOnly reported by a handful of users who observe it rarelyseverity5: regressiontype: bug/fix
Activity
alan-agius4 commentedon Jun 22, 2022
@jaschwartzkopf, your investigation looks good. Want to try to land a PR?
fix(@angular/cli): correctly handle `--collection` option in `ng new`
fix(@angular/cli): correctly handle `--collection` option in `ng new`
fix(@angular/cli): correctly handle `--collection` option in `ng new`
Lipata commentedon Jun 30, 2022
Hi, @alan-agius4. This is now working, thank you for the fix! Still I think there is similar problem with the
ng gcommand:"ng g @custom-schematics:schematic-name --custom-schematic-property=value" is throwing
Error: Unknown arguments: custom-schematic-property
alan-agius4 commentedon Jun 30, 2022
@Lipata, that seems to be an unrelated issued.
Please open a new issue with a minimal reproduction.
Thanks.
angular-automatic-lock-bot commentedon Jul 31, 2022
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.