Skip to content

Commit

Permalink
Polish
Browse files Browse the repository at this point in the history
  • Loading branch information
sthzg committed Jul 18, 2016
1 parent e647e9d commit 9704515
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions generators/container/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@ class ContainerGenerator extends generators.Base {

constructor(...args) {
super(...args);
}

static hasCntPostfix(cntName) {
const regex = new RegExp('[c|C]ontainer$');
return regex.exec(cntName) !== null;
}

initializing() {

this.argument(
'cntName', {
Expand All @@ -37,6 +29,14 @@ class ContainerGenerator extends generators.Base {
desc: 'Create a Root Component and render it from the Container'
}
);
}

static hasCntPostfix(cntName) {
const regex = new RegExp('[c|C]ontainer$');
return regex.exec(cntName) !== null;
}

initializing() {

if (!ContainerGenerator.hasCntPostfix(this.cntName)) {
this.cntName = this.cntName + 'Container';
Expand All @@ -63,15 +63,15 @@ class ContainerGenerator extends generators.Base {

if (this.options.component) {

// Register transformation chain to swap the test file for the container with our customized template
// Register transformation chain to swap the test file for the container with our customized template
const tstFilter = gulpfilter(['**/*ContainerTest.js'], { restore: true });
this.registerTransformStream([
tstFilter,
createCntTest(this.cntName, this.cmpName, this.fs.read(this.templatePath('ContainerTest.js.ejs'))),
tstFilter.restore
]);

// Register transformation chain to modify the generated container to include our component.
// Register transformation chain to modify the generated container to include our component
const cntFilter = gulpfilter(['**/*Container.js'], { restore: true });
this.registerTransformStream([
cntFilter,
Expand Down

0 comments on commit 9704515

Please sign in to comment.