schematics icon indicating copy to clipboard operation
schematics copied to clipboard

Consistent Behavior: support --project, treat first arg as --name

Open xmlking opened this issue 5 years ago • 2 comments

  1. in monorepo setup, when --project is provided, schematics should derive sourceRoot and projectType from angular.json for that project.
ng g @ngxs/schematics:store --name=store/auth --spec --project=auth  -d

should generate:

CREATE libs/auth/src/libs/store/auth/auth.actions.ts
CREATE libs/auth/src/libs/store/auth/auth.state.spec.ts
CREATE libs/auth/src/libs/store/auth/auth.state.ts 

Workaround

ng g @ngxs/schematics:store --name=store/auth --spec --project=auth  --sourceRoot=libs/auth/src/libs -d
  1. when --name consists path, it should not add extra path prefix. i.e., store/auth/auth.actions.ts -> store/auth.actions.ts
ng g @ngxs/schematics:store --name=store/auth --spec --project=auth  -d

should generate

CREATE libs/auth/src/libs/store/auth.actions.ts 
CREATE libs/auth/src/libs/store/auth.state.spec.ts 
CREATE libs/auth/src/libs/store/auth.state.ts
  1. when --name is not provided, first arg should be treated as --name
ng g @ngxs/schematics:store store/auth --spec --project=auth  -d
  1. --spec=true should be default. if users don't need spec , they can provide --spec=false

xmlking avatar Dec 01 '18 19:12 xmlking

All of these sound right to me

markwhitfeld avatar Dec 01 '18 19:12 markwhitfeld

@markwhitfeld any update on this ?

xmlking avatar May 26 '19 18:05 xmlking