schematics icon indicating copy to clipboard operation
schematics copied to clipboard

@schematics/angular:component not getting respected when using "defaultCollection": "@ngxs/schematics"

Open kuncevic opened this issue 5 years ago • 5 comments

I'm submitting a...


[ x] Bug report  

Current behavior

have "style":"scss" in angular.json

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

and

 "cli": {
    "defaultCollection": "@ngxs/schematics"
  }

ng g c xyz creating an component with css types of styles instead of scss:

CREATE src/app/xyz/xyz.component.html (22 bytes)
CREATE src/app/xyz/xyz.component.spec.ts (607 bytes)
CREATE src/app/xyz/xyz.component.ts (257 bytes)
CREATE src/app/xyz/xyz.component.css (0 bytes)

Expected behavior

component gets generated with scss styles type

CREATE src/app/xyz/xyz.component.html (22 bytes)
CREATE src/app/xyz/xyz.component.spec.ts (607 bytes)
CREATE src/app/xyz/xyz.component.ts (257 bytes)
CREATE src/app/xyz/xyz.component.scss (0 bytes)

Minimal reproduction of the problem with instructions

ng g my-app --style=scss ng add @ngxs/schematics ng g c xyz

What is the motivation / use case for changing the behavior?

respect the angular cli styles config:


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

Environment

OS: win32 x64 Angular: 7.2.8 ... animations, common, compiler, compiler-cli, core, forms ... language-service, platform-browser, platform-browser-dynamic ... router, service-worker

Package Version

@ngxs/schematics: ^0.0.1-alpha.5 @angular-devkit/architect 0.13.5 @angular-devkit/build-angular 0.13.5 @angular-devkit/build-optimizer 0.13.5 @angular-devkit/build-webpack 0.13.5 @angular-devkit/core 7.3.5 @angular-devkit/schematics 7.3.5 @angular/cdk 7.3.3 @angular/cli 7.3.5 @angular/fire 5.1.1 @angular/flex-layout 7.0.0-beta.23 @angular/material 7.3.3 @angular/pwa 0.13.5 @ngtools/webpack 7.3.5 @schematics/angular 7.3.5 @schematics/update 0.13.5 rxjs 6.4.0 typescript 3.2.4 webpack 4.29.0

For Tooling issues:

  • Node version: v10.14.2
  • Platform: Mac, Windows

kuncevic avatar Mar 07 '19 04:03 kuncevic

Do you have any leads on how to fix that?

eranshmil avatar Mar 26 '19 19:03 eranshmil

@eranshmil I just did remove "cli": { "defaultCollection": "@ngxs/schematics" } from my angular.json config as workaround

kuncevic avatar Mar 27 '19 22:03 kuncevic

i don't have "cli": { "defaultCollection": "@ngxs/schematics" } in my angular.json yet scss in styleext is no longer working for me either.

this worked for me in the past, and only broke in the past few months, perhaps upgrading to angular 9.

EDIT: angular cli works just fine. just not the angular.json schematics.

johnzondr avatar Apr 14 '20 13:04 johnzondr

i don't have "cli": { "defaultCollection": "@ngxs/schematics" } in my angular.json yet scss in styleext is no longer working for me either.

this worked for me in the past, and only broke in the past few months, perhaps upgrading to angular 9.

EDIT: angular cli works just fine. just not the angular.json schematics.

i found that the tags change in angular 8 & 9... try this out: spec now skipTests
styleext now style

"schematics": { "@schematics/angular:component": { "prefix": "app", "style": "scss", "skipTests": true, "inlineStyle": false }, "@schematics/angular:directive": { "prefix": "app" }, "@schematics/angular:service": { "skipTests": false }

wkjesus avatar Oct 23 '20 17:10 wkjesus

@wkjesus this did the trick!

johnzondr avatar Nov 10 '20 04:11 johnzondr