与你相遇好幸运,制作自己的Yeoman Generator
使用别人写好的生成器:
npm install -g yo
npm install -g generator-angular
yo angular
如何自己制作符合自己心仪的生成器呢:
https://github.com/yeoman/generator-generator
运行 yo generateor
制作完请食用npm link更佳
提示:
prompting() {
var self = this;
return this.prompt([
{
type : 'confirm',
name : 'php',
message : 'I hope that you can agree that the PHP is the best languages in the world !'
}
,
{
type: 'input',
name: 'projectName',
message: 'Please input project name (service):',
default: 'service'
},
{
type: 'list',
name: 'projectLicense',
message: 'Please choose license:',
choices: ['MIT', 'ISC', 'Apache-2.0', 'AGPL-3.0']
}
]).then((answers) => {
self.props = answers;
});
},
模板渲染:
this.fs.copyTpl(
this.templatePath('package.json'),
this.destinationPath('package.json'),
this.props
);
文件目录复制:
this.fs.copy(
this.templatePath('src/'),
this.destinationPath('src/')
);
安装依赖:
this.installDependencies({bower: false});
流程:
initializing - 初始化一些状态之类的,通常是和用户输入的 options 或者 arguments 打交道
prompting - 和用户交互的时候(命令行问答之类的)调用。
configuring - 保存配置文件(如 .babelrc 等)。
default - 其他方法都会在这里按顺序统一调用。
writing - 在这里写一些模板文件。
conflicts - 处理文件冲突,比如当前目录下已经有了同名文件。
install - 开始安装依赖。
end - 结束
写到这不行了, 我要吐槽~~网上的教程不能运行啊,一定要看官网啊
与你相遇好幸运,制作自己的Yeoman Generator的更多相关文章
- 与你相遇好幸运,使用redis设置定时任务
参考链接: Nodejs中使用Redis来完成定时任务 自己在 window 7下编码实现: 1 > 首先查看redis版本: redis-server -v , 版本要求大于等于2.8 2&g ...
- 与你相遇好幸运,gen8安装
gen8到手后,立马去买了 SSD https://item.jd.com/2010277.html 支架 https://item.jd.com/2671609.html NAS盘 https:// ...
- 与你相遇好幸运,德淘gen8历程
应该是十月底了 , 在浏览色魔张大妈(smzdm) http://www.smzdm.com/p/6517684/ 的时候看见了这个 , 以前大学就想买个这个 , 苦于没钱.... 然后当时打算买 , ...
- 与你相遇好幸运,用sinopia搭建npm私服
需求: >在企业内部搭建私有npm服务器,企业开发人员上传下载自己开发的npm包 >私有npm服务器包不存在时,找npm或者taobao的镜像站点 >服务器硬盘有限,希望只缓存下载过 ...
- 与你相遇好幸运,Postman设置Header不生效问题解决
POstMan安装地址 安装完 , Postman 设置Header的Referer不生效 , 提示 Restricted Header (use postman interceptor) 时 , 要 ...
- 与你相遇好幸运,服务器node环境安装
>服务器更改root密码 sudo passwd root >服务器ubuntu安装ssh apt-get install openssh-server >服务器开启root用户密码 ...
- 与你相遇好幸运,使用gulp流程化Typescript后端开发
tsc --init { "compilerOptions": { "module": "commonjs", ...
- 与你相遇好幸运,Postgresql和postgis安装
笔者开发环境: windows 7 x86_64 一开始安装的是官网最新版 PostgreSQL 9.6 ,安装成功 之后安装PostGIS Bundle 2.2 for PostgreSQL x64 ...
- 与你相遇好幸运,mocha接口测试
var rest = require('restler');var assert = require("assert");var systemID;var userID; cons ...
随机推荐
- MYSQL、PHP基础、面向对象基础简单复习总结
一.MYSQL 1.配置MySql 第一步安装服务器(apache). 第二部安装MySql界面程序 2 ...
- nginx配置ssl证书的方法
Nginx (读音"engine x") 是一个高性能的HTTP和反向代理服务器,比Apache占用更少的内存,同时也像Apache一样支持HTTPS方式访问(SSL加密).本教程 ...
- redis-window 集群配置
参考文章: 1.http://www.cnblogs.com/zr520/p/5057141.html (主从配置) 2.http://www.cnblogs.com/lori/p/5825691.h ...
- shc
A tool for encrytion of bash shell scripts . Install: wget http://www.datsi.fi.upm.es/~frosal/sourc ...
- Android之ListView性能优化——使用ConvertView和ViewHolder
使用ConvertView和ViewHolder的优化是针对ListView的Adapter(BaseAdapter)的.这种优化的优点如下: 1)重用了ConveertView,在很大程度上减少了内 ...
- 第3月第15天 afconvert lame
1. //CAF 转换成MP3 (可以) afconvert -f mp4f -d aac -b 128000 /Users/amarishuyi/Desktop/sound1.caf/Users/a ...
- hdu 4329
problem:http://acm.hdu.edu.cn/showproblem.php?pid=4329 题意:模拟 a. p(r)= R'/i rel(r)=(1||0) R ...
- Android 学习资源收集
1.2015最流行的Android组件.工具.框架大全 地址 http://www.open-open.com/lib/view/open1436262653692.html
- Eclipse设置黑色主题
1点击help--->install new software 2输入 http://eclipse-color-theme.github.com/update 3下载安装eclipse col ...
- sql奇进偶舍函数
create function sslr(@num numeric(20,10),@i int) --@i保留的小数位 --@num传入的数据 returns varchar(2 ...