schematics
schematics copied to clipboard
Behave more similarly to Angular's schematics
I'm submitting a...
- [ ] Regression (a behavior that used to work and stopped working in a new release)
- [ ] Bug report
- [ ] Performance issue
- [x] Feature request
- [ ] Documentation issue or request
- [ ] Support request => https://github.com/ngxs/store/blob/master/CONTRIBUTING.md
- [ ] Other... Please describe:
Current behavior
ng g @ngxs/schematics:state states/test
CREATE src/states/test/test.state.spec.ts (685 bytes)
CREATE src/states/test/test.state.ts (337 bytes)
Expected behavior
ng g @ngxs/schematics:state states/test
CREATE src/app/states/test.state.spec.ts (146 bytes)
CREATE src/app/states/test.state.ts (22 bytes)
What is the motivation / use case for changing the behavior?
I'd like to be able to use NGXS' schematics the same way I use Angular's schematics. Right now, if I want the same result, I have to run a command like this :
ng g @ngxs/schematics:actions --name logout --sourceRoot src/app --path actions --spec true
With Angular's schematics, the commands looks like this :
ng g class classes/test
Additionaly I hope, that it also will behave more like angular schematics when using in IntelliJ. When I generate components they are generated inside the folder I want them to be created. When I to the same with ngxs/schematics I get the full path from root generated in the folder I want the files to be placed in. So from the example above when trying to generate files in src/app/states
I get the files in src/app/states/src/app/states/test
.
I added schematics configuration to angular.json and it partially solves the problem.
"@ngxs/schematics:action": {
"spec": false,
"sourceRoot": "src/app"
},
"@ngxs/schematics:store": {
"spec": false,
"sourceRoot": "src/app"
},
"@ngxs/schematics:state": {
"spec": false,
"sourceRoot": "src/app"
},
"@ngxs/schematics:actions": {
"spec": false,
"sourceRoot": "src/app"
}