首页 > 代码库 > 简单的yoman generator
简单的yoman generator
这两天用yoman做了两个generator
The available priorities are (in running order):
initializing
- Your initialization methods (checking current project state, getting configs, etc)prompting
- Where you prompt users for options (where you‘d callthis.prompt()
)configuring
- Saving configurations and configure the project (creating.editorconfig
files and other metadata files)default
- If the method name doesn‘t match a priority, it will be pushed to this group.writing
- Where you write the generator specific files (routes, controllers, etc)conflicts
- Where conflicts are handled (used internally)install
- Where installation are run (npm, bower)end
- Called last, cleanup, say good bye, etc
Follow these priorities guidelines and your generator will play nice with others.
以上钩子依次执行,私有方法可以‘_‘开头。
在prompting里做一些询问,比如工程名啊,description
在writing里写文件
在install里做npm或者yarn的安装
在end里画个退出字符画
昨天是个值得纪念的日子
希望以后的每一年
看到这里都会觉得很暖很开心
简单的yoman generator
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。