Skip to content

Commit

Permalink
fix(gen:route): fix jscodeshift calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Awk34 committed Jul 14, 2018
1 parent 59813f5 commit b854fda
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/generators/route/module-transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function addModule(sourceText, moduleName, modulePath) {
const source = jscodeshift.withParser('flow')(sourceText);

const ngModules = source
.find(jscodeshift.ClassDeclaration, path => path.decorators.some(decorator => decorator.callee.name === 'NgModule'));
.find(jscodeshift.ClassDeclaration, path => path.decorators.some(decorator => decorator.expression.callee.name === 'NgModule'));

if(ngModules.size() === 0) {
throw new NoModulesError();
Expand All @@ -34,8 +34,8 @@ export function addModule(sourceText, moduleName, modulePath) {
}

const ngModuleClass = ngModules.get();
const ngModule = ngModuleClass.value.decorators.find(decorator => decorator.callee.name === 'NgModule');
const imports = ngModule.arguments[0].properties.find(prop => prop.key.name === 'imports');
const ngModule = ngModuleClass.value.decorators.find(decorator => decorator.expression.callee.name === 'NgModule');
const imports = ngModule.expression.arguments[0].properties.find(prop => prop.key.name === 'imports');

if(!imports) {
console.info('No \'imports\' property? Strange..');
Expand Down

0 comments on commit b854fda

Please sign in to comment.