Skip to content

Commit

Permalink
fix: support yeoman generator app/index.js folder
Browse files Browse the repository at this point in the history
  • Loading branch information
cpselvis committed Sep 8, 2017
1 parent 45b64d6 commit bedfaa9
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions lib/internal/generator/generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,24 @@ class Generator {
name && self.run(name, ctx);
});
} else {
log.warn('检测到你还未安装任何模板,请先安装后再进行项目初始化,参考文档:https://github.com/iv-web/feflow-cli/blob/master/README.md')
log.warn(
'检测到你还未安装任何模板,请先安装后再进行项目初始化,' +
'参考文档:https://github.com/iv-web/feflow-cli/blob/master/README.md'
);
}
});
}

run(name) {
const ctx = this.ctx;

const pluginDir = ctx.pluginDir;
let path = pathFn.join(pluginDir, name, 'app/index.js');

const path = pathFn.join(pluginDir, name, 'generators/app/index.js');
if (!fs.existsSync(path)) {
path = pathFn.join(pluginDir, name, 'generators', 'app/index.js');
}

yeomanEnv.register(require.resolve(path), name);

yeomanEnv.run(name, { 'skip-install': true }, err => {});
}

Expand Down Expand Up @@ -88,10 +92,7 @@ class Generator {
const json = JSON.parse(content);
const desc = json.description;

return {
name,
desc
};
return { name, desc };
});
});
}
Expand Down

0 comments on commit bedfaa9

Please sign in to comment.