1.0.7 • Published 7 years ago
ngxs-schematics
Licence
MIT
Version
1.0.7
Deps
3
Size
55 kB
Vulns
0
Weekly
0
DeprecatedThis package is deprecated
Schematics
This repository contains schematics for generating NGXS Store in Angular apps using the Angular CLI.
Installation
Install Angular CLI
You should be using @angular/cli@6.1.0 or newer.
npm i -g @angular/cli
Install NGXS Schematics
npm i -g @ngxs/schematics
Usage
Creating a new project
To generate new Angular project with NGXS Store, you can use ng new with @ngxs/schematics specified as the schematics collection.
ng new --collection=@ngxs/schematics my-app
Create a NGXS Store
To generate store with @ngxs/schematics:
ng generate @ngxs/schematics:store --name todo
Result:
CREATE src/todo/todo.actions.ts
CREATE src/todo/todo.state.ts
Or with spec:
ng generate @ngxs/schematics:store --name todo --spec
Result:
CREATE src/todo/todo.actions.ts
CREATE src/todo/todo.state.spec.ts
CREATE src/todo/todo.state.ts
Create a NGXS State
To generate state with @ngxs/schematics:
ng generate @ngxs/schematics:state --name todo
Result:
CREATE src/todo/todo.state.ts
Or with spec:
ng generate @ngxs/schematics:state --name todo --spec
Result:
CREATE src/todo/todo.state.spec.ts
CREATE src/todo/todo.state.ts
Create a NGXS Actions
To generate state with @ngxs/schematics:
ng generate @ngxs/schematics:actions --name todo
Result:
CREATE src/todo/todo.actions.ts
NGXS Starter Kit
Usage
To generate store with @ngxs/schematics:starter-kit:
ng generate @ngxs/schematics:starter-kit
Result:
CREATE src/store/store.config.ts
CREATE src/store/store.module.ts
CREATE src/store/auth/auth.actions.ts
CREATE src/store/auth/auth.state.ts
CREATE src/store/auth/model/auth.model.ts
CREATE src/store/dashboard/index.ts
CREATE src/store/dashboard/states/dictionary/dictionary.actions.ts
CREATE src/store/dashboard/states/dictionary/dictionary.state.ts
CREATE src/store/dashboard/states/dictionary/model/dictionary-response.model.ts
CREATE src/store/dashboard/states/user/user.actions.ts
CREATE src/store/dashboard/states/user/user.state.ts
CREATE src/store/dashboard/states/user/model/person.model.ts
Or with spec:
ng generate @ngxs/schematics:starter-kit --spec
Result:
CREATE src/store/store.config.ts
CREATE src/store/store.module.ts
CREATE src/store/auth/auth.actions.ts
CREATE src/store/auth/auth.state.spec.ts
CREATE src/store/auth/auth.state.ts
CREATE src/store/auth/model/auth.model.ts
CREATE src/store/dashboard/index.ts
CREATE src/store/dashboard/states/dictionary/dictionary.actions.ts
CREATE src/store/dashboard/states/dictionary/dictionary.state.spec.ts
CREATE src/store/dashboard/states/dictionary/dictionary.state.ts
CREATE src/store/dashboard/states/dictionary/model/dictionary-response.model.ts
CREATE src/store/dashboard/states/user/user.actions.ts
CREATE src/store/dashboard/states/user/user.state.spec.ts
CREATE src/store/dashboard/states/user/user.state.ts
CREATE src/store/dashboard/states/user/model/person.model.ts