Skip to content

Commit 7ecffe8

Browse files
fix(schematics): correct module while generating a feature (#4289)
Closes #4281
1 parent 092076c commit 7ecffe8

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

modules/schematics/src/effect/index.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,17 +115,15 @@ function getEffectStart(name: string, effectPrefix: string): string {
115115
export default function (options: EffectOptions): Rule {
116116
return (host: Tree, context: SchematicContext) => {
117117
options.path = getProjectPath(host, options);
118-
118+
const parsedPath = parseName(options.path, options.name || '');
119+
options.name = parsedPath.name;
120+
options.path = parsedPath.path;
119121
options.prefix = getPrefix(options);
120122

121123
if (options.module) {
122124
options.module = findModuleFromOptions(host, options);
123125
}
124126

125-
const parsedPath = parseName(options.path, options.name || '');
126-
options.name = parsedPath.name;
127-
options.path = parsedPath.path;
128-
129127
const templateSource = apply(url('./files'), [
130128
options.skipTests
131129
? filter((path) => !path.endsWith('.spec.ts.template'))

modules/schematics/src/feature/index.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ describe('Feature Schematic', () => {
183183
...defaultOptions,
184184
name: 'foo/Foo',
185185
group: true,
186-
module: 'app',
186+
module: '../app',
187187
};
188188

189189
const tree = await schematicRunner.runSchematic(

modules/schematics/src/reducer/index.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,16 @@ export default function (options: ReducerOptions): Rule {
3030
return (host: Tree, context: SchematicContext) => {
3131
const projectConfig = getProject(host, options);
3232
options.path = getProjectPath(host, options);
33-
3433
options.prefix = getPrefix(options);
3534

36-
if (options.module) {
37-
options.module = findModuleFromOptions(host, options);
38-
}
39-
4035
const parsedPath = parseName(options.path, options.name);
4136
options.name = parsedPath.name;
4237
options.path = parsedPath.path;
4338

39+
if (options.module) {
40+
options.module = findModuleFromOptions(host, options);
41+
}
42+
4443
const templateOptions = {
4544
...stringUtils,
4645
'if-flat': (s: string) =>

0 commit comments

Comments
 (0)