From 220e556cb5561ac8cd8940420cc78f61c8e4e866 Mon Sep 17 00:00:00 2001 From: Tim Deschryver <28659384+timdeschryver@users.noreply.github.com> Date: Wed, 3 Apr 2024 20:06:22 +0200 Subject: [PATCH] fix(schematics): correct module while generating a feature --- modules/schematics/src/effect/index.ts | 8 +++----- modules/schematics/src/feature/index.spec.ts | 2 +- modules/schematics/src/reducer/index.ts | 9 ++++----- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/modules/schematics/src/effect/index.ts b/modules/schematics/src/effect/index.ts index 55b947a150..5c0ae15a5f 100644 --- a/modules/schematics/src/effect/index.ts +++ b/modules/schematics/src/effect/index.ts @@ -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')) diff --git a/modules/schematics/src/feature/index.spec.ts b/modules/schematics/src/feature/index.spec.ts index 7fb1349c8d..ac1ecd2273 100644 --- a/modules/schematics/src/feature/index.spec.ts +++ b/modules/schematics/src/feature/index.spec.ts @@ -183,7 +183,7 @@ describe('Feature Schematic', () => { ...defaultOptions, name: 'foo/Foo', group: true, - module: 'app', + module: '../app', }; const tree = await schematicRunner.runSchematic( diff --git a/modules/schematics/src/reducer/index.ts b/modules/schematics/src/reducer/index.ts index 7eb0564a8b..6c23eb7a9a 100644 --- a/modules/schematics/src/reducer/index.ts +++ b/modules/schematics/src/reducer/index.ts @@ -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) =>