Skip to content

Commit

Permalink
fix(schematics): Use prefix option in feature schematic
Browse files Browse the repository at this point in the history
Previously, passing --prefix when generating a feature would
make changes only in the generated action. This passes the prefix
option to the effect and reducers as well.

Fixes ngrx#3116
  • Loading branch information
hemangsk committed Sep 5, 2021
1 parent 304a2ad commit 1ddec0f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/schematics/src/feature/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default function (options: FeatureOptions): Rule {
skipTests: options.skipTests,
api: options.api,
creators: options.creators,
prefix: options.prefix,
}),
schematic('reducer', {
flat: options.flat,
Expand All @@ -32,6 +33,7 @@ export default function (options: FeatureOptions): Rule {
feature: true,
api: options.api,
creators: options.creators,
prefix: options.prefix,
}),
schematic('effect', {
flat: options.flat,
Expand All @@ -44,6 +46,7 @@ export default function (options: FeatureOptions): Rule {
feature: true,
api: options.api,
creators: options.creators,
prefix: options.prefix,
}),
schematic('selector', {
flat: options.flat,
Expand Down
6 changes: 6 additions & 0 deletions modules/schematics/src/feature/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@
"description": "Specifies if the actions, reducers, and effects should be created using creator functions",
"aliases": ["c"],
"x-prompt": "Do you want to use the create functions?"
},
"prefix": {
"description": "The prefix of the action, effect and reducer.",
"type": "string",
"default": "load",
"x-prompt": "What should be the prefix of the action, effect and reducer?"
}
},
"required": []
Expand Down
2 changes: 2 additions & 0 deletions modules/schematics/src/feature/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,6 @@ export interface Schema {
* Specifies whether to use creator functions for actions, reducers, and effects.
*/
creators?: boolean;

prefix?: string;
}

0 comments on commit 1ddec0f

Please sign in to comment.