Skip to content

Commit 38d5f2c

Browse files
Meligyhansl
authored andcommitted
fix(generate): fix module component path if module is created in child folder (#3066)
fixes #3063
1 parent 28925dc commit 38d5f2c

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

packages/angular-cli/blueprints/module/index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ module.exports = {
5858
},
5959

6060
afterInstall: function (options) {
61-
options.entity.name = path.join(this.dasherizedModuleName, this.dasherizedModuleName);
62-
options.flat = true;
61+
options.entity.name = path.relative(this.dynamicPath.appRoot, this.generatePath);
62+
options.flat = false;
6363
options.route = false;
6464
options.inlineTemplate = false;
6565
options.inlineStyle = false;

tests/acceptance/generate-module.spec.js

+10
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,14 @@ describe('Acceptance: ng generate module', function () {
5151
expect(existsSync(path.join(testPath, 'two-word', 'two-word.module.spec.ts'))).to.equal(false);
5252
});
5353
});
54+
55+
it('ng generate module parent/child', function () {
56+
return ng(['generate', 'module', 'parent']).then(() =>
57+
ng(['generate', 'module', 'parent/child']).then(() => {
58+
expect(existsSync(path.join(testPath, 'parent/child', 'child.module.ts'))).to.equal(true);
59+
expect(existsSync(path.join(testPath, 'parent/child', 'child.module.spec.ts'))).to.equal(false);
60+
expect(existsSync(path.join(testPath, 'parent/child', 'child.component.ts'))).to.equal(true);
61+
})
62+
);
63+
});
5464
});

0 commit comments

Comments
 (0)