Skip to content

schematics(ng-add): cannot add collection when section is not yet available in angular.json #3468

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 of 2 tasks
fmalcher opened this issue Jun 26, 2022 · 1 comment · Fixed by #3470
Closed
1 of 2 tasks
Labels

Comments

@fmalcher
Copy link
Contributor

fmalcher commented Jun 26, 2022

Minimal reproduction of the bug/regression with instructions

When installing the NgRx schematics with defaultCollection set, adding to schematicCollections fails when the section is missing in angular.json.

Expected:
The script should create the section automatically if it's not there yet. @angular-eslint/schematics implements it like this.

Minimal reproduction of the bug/regression with instructions

Create a fresh new NG14 project, then add the ngrx schematics with defaultCollection:

ng new foo --routing --style=css
cd foo
ng add @ngrx/schematics --default-collection

Output:

➜  foo git:(main) ng add @ngrx/schematics --default-collection

ℹ Using package manager: npm
✔ Found compatible package version: @ngrx/[email protected].
✔ Package information loaded.

The package @ngrx/[email protected] will be installed and executed.
Would you like to proceed? Yes
✔ Packages successfully installed.
schematicCollections is not defined in the global cli options

Versions of NgRx, Angular, Node, affected browser(s) and operating system(s)

Angular: 14.0.3
Node: 14.19.3
NgRx: 14.0.0

Other information

This has been discussed here:

@timdeschryver I think throwing would be better, it probably means that the user didn't upgrade Angular.

However, a new Angular 14 project does not have the schematicCollections section by default.

I would be willing to submit a PR to fix this issue

  • Yes
  • No
@fmalcher fmalcher added the bug label Jun 26, 2022
@timdeschryver
Copy link
Member

However, a new Angular 14 project does not have the schematicCollections section by default.

Thanks @fmalcher , I didn't expect that to happen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants