Skip to content

Commit

Permalink
fix(schematics): correct module while generating a feature (#4289)
Browse files Browse the repository at this point in the history
Closes #4281
  • Loading branch information
timdeschryver authored Apr 8, 2024
1 parent 092076c commit 7ecffe8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
8 changes: 3 additions & 5 deletions modules/schematics/src/effect/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,15 @@ function getEffectStart(name: string, effectPrefix: string): string {
export default function (options: EffectOptions): Rule {
return (host: Tree, context: SchematicContext) => {
options.path = getProjectPath(host, options);

const parsedPath = parseName(options.path, options.name || '');
options.name = parsedPath.name;
options.path = parsedPath.path;
options.prefix = getPrefix(options);

if (options.module) {
options.module = findModuleFromOptions(host, options);
}

const parsedPath = parseName(options.path, options.name || '');
options.name = parsedPath.name;
options.path = parsedPath.path;

const templateSource = apply(url('./files'), [
options.skipTests
? filter((path) => !path.endsWith('.spec.ts.template'))
Expand Down
2 changes: 1 addition & 1 deletion modules/schematics/src/feature/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ describe('Feature Schematic', () => {
...defaultOptions,
name: 'foo/Foo',
group: true,
module: 'app',
module: '../app',
};

const tree = await schematicRunner.runSchematic(
Expand Down
9 changes: 4 additions & 5 deletions modules/schematics/src/reducer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,16 @@ export default function (options: ReducerOptions): Rule {
return (host: Tree, context: SchematicContext) => {
const projectConfig = getProject(host, options);
options.path = getProjectPath(host, options);

options.prefix = getPrefix(options);

if (options.module) {
options.module = findModuleFromOptions(host, options);
}

const parsedPath = parseName(options.path, options.name);
options.name = parsedPath.name;
options.path = parsedPath.path;

if (options.module) {
options.module = findModuleFromOptions(host, options);
}

const templateOptions = {
...stringUtils,
'if-flat': (s: string) =>
Expand Down

0 comments on commit 7ecffe8

Please sign in to comment.