We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
随着团队的扩大,项目的增多,脚手架的缺失显得愈发地不可忍受。其问题主要有二:
一开始我是想自己写一个的,思路是这样的:
var generators = require('yeoman-generator'); // 调用shell命令 var process = require('child_process'); var exec = process.exec; module.exports = generators.Base.extend({ constructor: function (args, options, config) { generators.Base.apply(this, arguments); }, init: function () { // 这里还没想好怎么优化,只能先嵌套了! console.log('start copy'); var copy = exec('cp -r ' + __dirname + "/demo/. " + this.options.env.cwd); copy.on('exit', function (code) { console.log('copy done!'); console.log('start install bower dependiences'); var bowerInstall = exec('bower install'); bowerInstall.on('exit', function (code) { console.log('bower dependiences install done.'); console.log('start install npm dependiences'); var npmInstall = exec('npm install'); npmInstall.on('exit', function (code) { console.log('npm dependiences install done.'); console.log('start gulp'); var gulp = exec('gulp'); gulp.on('exit', function (code) { console.log('gulp done.'); console.log('start the app....'); var start = exec("npm run start"); console.log("please visit http://localhost:3000"); }) }) }); }); } });
现在回头看这段代码,真的是惨不忍睹。。。
参考资料:
The text was updated successfully, but these errors were encountered:
No branches or pull requests
事出有因
随着团队的扩大,项目的增多,脚手架的缺失显得愈发地不可忍受。其问题主要有二:
yeoman的初尝试
一开始我是想自己写一个的,思路是这样的:
嗯,一切都规划地蛮好的。但是,有一个问题我一直没想通,也没google到,那就是,我如何让终端识别某个我自定义的命令generate-smart呢?也就是说,为啥我 npm install gulp -g之后,在终端输入gulp就能找到这个命令?一番挣扎无果之后我找到了yeoman,忽然发现这就是我要做的东西。一番欣喜若狂之后按照文档和api做了个demo出来。
现在回头看这段代码,真的是惨不忍睹。。。
反思
于是,贼心不死的我在学习了 inquirer 终端交互——inquire.js #41 之后,又开始准备自己再写一次脚手架了。
参考资料:
The text was updated successfully, but these errors were encountered: