2018.8 @AlloVince
npm install -g yo generator-webapp
yo webapp
npm install -g yo generator-generator
yo generator
npm link
├── generators/
│ └── app/
│ ├── index.js
│ └── templates/
│ └── dummyfile.txt
├── .editorconfig
├── .eslintignore
├── .gitattributes
├── .gitignore
├── .travis.yml
├── .yo-rc.json
├── LICENSE
├── README.md
├── package.json
└── __tests__/
└── app.js
- project root
- run loop
- destinationRoot / destinationPath
- composeWith()
- initializing
- prompting
- configuring
- default
- writing
- conflicts
- install
- end
const Generator = require('yeoman-generator');
module.exports = class extends Generator {
prompting() {
const prompts = [
{
type: 'confirm',
name: 'someAnswer',
message: 'Would you like to enable this option?',
default: true
}
];
return this.prompt(prompts).then(props => {
this.props = props;
});
}
writing() {
this.fs.copy(
this.templatePath('dummyfile.txt'),
this.destinationPath('dummyfile.txt')
);
}
install() {
this.installDependencies();
}
}
class A extends Generator {
prompting() {
//doing A
}
}
class B extends Generator {
prompting() {
this.composeWith(A)
//doing B
}
}
- read / write / move / copy / exists
- commit
- extendJSON
- copyTpl
- npmInstall / bowerInstall / yarnInstall
yo typelibrary
输入项目名
选择LICENSE
yo evaengine
输入项目名
选择LICENSE
是否支持EvaQueue
yo android-app
输入项目名
是否支持离线包
是否支持RN
是否支持热更新
是否接入sentry
CI配置
Bugtags配置