Skip to content

Commit

Permalink
fix(generate): revert change to component dir in generate module, as …
Browse files Browse the repository at this point in the history
…it caused component declaration to go to parent module (#3158)
  • Loading branch information
Meligy authored and filipesilva committed Nov 17, 2016
1 parent 633ece0 commit 71bf855
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 6 additions & 2 deletions packages/angular-cli/blueprints/module/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,12 @@ module.exports = {
},

afterInstall: function (options) {
options.entity.name = path.relative(this.dynamicPath.appRoot, this.generatePath);
options.flat = false;
// Note that `this.generatePath` already contains `this.dasherizedModuleName`
// So, the path will end like `name/name`,
// which is correct for `name.component.ts` created in module `name`
var componentPath = path.join(this.generatePath, this.dasherizedModuleName);
options.entity.name = path.relative(this.dynamicPath.appRoot, componentPath);
options.flat = true;
options.route = false;
options.inlineTemplate = false;
options.inlineStyle = false;
Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/tests/generate/module/module-basic.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {join} from 'path';
import {ng} from '../../../utils/process';
import {expectFileToExist} from '../../../utils/fs';
import {expectFileToExist, expectFileToMatch} from '../../../utils/fs';
import {expectToFail} from '../../../utils/utils';


Expand All @@ -15,6 +15,7 @@ export default function() {
.then(() => expectFileToExist(join(moduleDir, 'test-module.component.spec.ts')))
.then(() => expectFileToExist(join(moduleDir, 'test-module.component.html')))
.then(() => expectFileToExist(join(moduleDir, 'test-module.component.css')))
.then(() => expectFileToMatch(join(moduleDir, 'test-module.module.ts'), 'TestModuleComponent'))

// Try to run the unit tests.
.then(() => ng('test', '--single-run'));
Expand Down

0 comments on commit 71bf855

Please sign in to comment.