Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(generate): revert change to component dir in generate module #3158

Merged
merged 1 commit into from
Nov 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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