Appearance
Yeoman通用脚手架工具
一个通用的脚手架工具。
Yeoman 之类工具作用
- 公用的脚手架平台,可以创立出我们自己想要的项目模板。我们如果要用vue直接vue-cli就可以,但是在不同的项目中也有共同点,也会想要根据共同点再封装一个脚手架,这个时候Yeoman就是有用的。
- vue-cli create-reate-app 更多的是创建针对性的项目(“限制”)
优点 & 缺点
优点 & 缺点 | 内容 |
---|---|
优点 | 更像脚手架的运行平台,Yeoman 搭配不同的generator 可以创建任何类型的项目,我们可以根据自己的generator 定制自己的前端脚手架 |
缺点 | 优点即缺点,过于通用不够专注 |
安装起步
yarn
安装
bash
# 安装yarn工具进行安装
npm install -g yarn
# 查看yarn是否安装好
yarn -v
# 1.22.5
# 全局安装yeoman
yarn global add yo
# 搭配使用node的generator才算安装完毕
yarn global add generator-node
npm
安装
bash
npm install -g yo
npm install -g generator-node
基本使用
bash
yo node
会出现下面的提问
bash
# 模块名称
? Module Name my_modules
# (node:13036) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated
# 已经在npm上存在,是否选择别的?
? The name above already exists on npm, choose another? No
# 描述
? Description node_modules
# 工程主页
? Project homepage url https://gitee.com/burningQiQi/
# 作者名称
? Authors Name csf
# 作者邮箱
? Authors Email shuangfeng1993@163.com
# 作者主页
? Authors Homepage https://gitee.com/burningQiQi/
# 关键词
? Package keywords (comma to split) node,modules,yeoman
# 是否发送代码覆盖率到一个平台上?
? Send coverage reports to coveralls No
# 使用node版本,不写就是所有的
? Enter Node versions (comma separated)
# GitHub名称和组织者
? GitHub username or organization csf
# 项目license
? Which license do you want to use? MIT
# create package.json
# force .yo-rc.json
# force C:\Users\韵七七\.yo-rc-global.json
# create README.md
# create .editorconfig
# create .gitattributes
# create .gitignore
# create .travis.yml
# create .eslintignore
# create lib\index.js
# create LICENSE
# create lib\__tests__\myModules.test.js
安装完成之后,项目目录中自动就有了下面的配置文件