简单的yoman generator

Posted 阿琼的学习笔记

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了简单的yoman generator相关的知识,希望对你有一定的参考价值。

这两天用yoman做了两个generator

The available priorities are (in running order):

  1. initializing - Your initialization methods (checking current project state, getting configs, etc)
  2. prompting - Where you prompt users for options (where you‘d call this.prompt())
  3. configuring - Saving configurations and configure the project (creating .editorconfig files and other metadata files)
  4. default - If the method name doesn‘t match a priority, it will be pushed to this group.
  5. writing - Where you write the generator specific files (routes, controllers, etc)
  6. conflicts - Where conflicts are handled (used internally)
  7. install - Where installation are run (npm, bower)
  8. 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的主要内容,如果未能解决你的问题,请参考以下文章

mvn命令异常:An error has occurred in Javadoc report generation: Unable to find javadoc command异常已解决(代码片段

mvn命令异常:An error has occurred in Javadoc report generation: Unable to find javadoc command异常已解决(代码片段

[React Testing] Use Generated Data in Tests with tests-data-bot to Improve Test Maintainability(代码片段

node.js 开发博客系统

带有静音片段的 Pyaudio

ES7-Es8 js代码片段