Angular-cli: CLI not respecting default schematics

Created on 6 Feb 2020  路  7Comments  路  Source: angular/angular-cli

馃悶 Bug report

Command (mark with an x)


  • [ ] new
  • [ ] build
  • [ ] serve
  • [ ] test
  • [ ] e2e
  • [x] 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?

schematicangular high regression bufix

Most helpful comment

@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.

All 7 comments

explicitly stating the collection does not seem to help:
image

@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

@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
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.

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    
}

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

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._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NCC1701M picture NCC1701M  路  3Comments

JanStureNielsen picture JanStureNielsen  路  3Comments

purushottamjha picture purushottamjha  路  3Comments

IngvarKofoed picture IngvarKofoed  路  3Comments

sysmat picture sysmat  路  3Comments