Skip to content
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

CLI not respecting default schematics #16857

Closed
1 of 15 tasks
gabrieltaets opened this issue Feb 6, 2020 · 7 comments · Fixed by #16924
Closed
1 of 15 tasks

CLI not respecting default schematics #16857

gabrieltaets opened this issue Feb 6, 2020 · 7 comments · Fixed by #16924

Comments

@gabrieltaets
Copy link

gabrieltaets commented Feb 6, 2020

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • xi18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Yes, the previous version in which this bug was not present was: Angular 8

A clear and concise description of the problem...

On Angular 9, even though I have my default schematics set to use .scss and not generate spec files, when using ng generate, the CLI ignores my preferences.

This used to work fine on Angular 8.

image

image

🔬 Minimal Reproduction

Set a schematics for styleext on angular.json and run ng generate.

🌍 Your Environment


Angular CLI: 9.0.0-rc.10
Node: 10.16.3
OS: linux x64

Angular: 9.0.0-rc.10
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router, upgrade
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.900.0-rc.10
@angular-devkit/build-angular     0.900.0-rc.10
@angular-devkit/build-optimizer   0.900.0-rc.10
@angular-devkit/build-webpack     0.900.0-rc.10
@angular-devkit/core              9.0.0-rc.10
@angular-devkit/schematics        9.0.0-rc.10
@angular/cdk                      8.2.3
@angular/flex-layout              8.0.0-beta.27
@angular/material                 8.2.3
@ngtools/webpack                  9.0.0-rc.10
@schematics/angular               9.0.0-rc.10
@schematics/update                0.900.0-rc.10
rxjs                              6.5.3
typescript                        3.7.5
webpack                           4.41.2

Anything else relevant?

@gabrieltaets
Copy link
Author

explicitly stating the collection does not seem to help:
image

@sacgrover
Copy link
Contributor

sacgrover commented Feb 7, 2020

@gabrieltaets
In Angular 9, Deprecated schematics options have been removed.

Old way:

 "@schematics/angular:component": {
          "styleext": "scss",
          "spec": false
        }

New way:

 "@schematics/angular:component": {
          "style": "scss",
          "skipTests": true
        }

You can get more details from here : https://angular.io/cli/generate#component-command

@sacgrover
Copy link
Contributor

@filipesilva @mgechev Although, ng update from 8 to 9 should take care of it. It should replace deprecated/removed options to new corresponding options. Currently, It's not doing it.

@gabrieltaets
Copy link
Author

@gabrieltaets
In Angular 9, Deprecated schematics options have been removed.

Old way:

 "@schematics/angular:component": {
          "styleext": "scss",
          "spec": true
        }

New way:

 "@schematics/angular:component": {
          "style": "scss",
          "skipTests": true
        }

You can get more details from here : https://angular.io/cli/generate#component-command

Yup, that did the trick. Thanks, I spent quite some time trying to figure this out. Maybe a warning on the CLI for deprecated/unknown options in angular.json could be helpful, I had no idea these were deprecated and removed.

@kmjungersen
Copy link

kmjungersen commented Feb 10, 2020

Thanks @sacgrover for the resolution. Also I'm confirming ng update is not updating these config values as expected.

Also it's important to note that the boolean logic has flipped for spec vs. skipTests, which I missed at first:

"@schematics/angular:component": {
    // true => DO generate spec files, false => DON'T generate them
    "spec": false    
}

"@schematics/angular:component": {
    // true => DON'T generate spec files, false => DO generate them
    "skipTests": true    
}

@benjamin-wilson
Copy link

Bump, just upgraded to v9 and had to change"styleext" to "style" for component generation to work as expected

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Mar 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants