
There are such programs and utilities, taking advantage of which, the user will cry: “I don’t know how I could have lived without this tool before!”. In my opinion, the
Yeoman console utility, written on
Node.JS , belongs to the category of such indispensable tools. Why?
So, to begin with, let's determine what program code
Yeoman generates.
There is such a thing in programming - scaffolding (from English scaffold - “scaffolding”). It means the automatic construction of the project structure. I can be mistaken, but as memory prompts for the first time it was used in
Ruby on Rails . There was a special team in Rails that generated code for controllers and models.
')
What is the essence of this function? The work of a programmer outside creative highs and ingenious explorations is of the same type. It most often consists in introducing its own corrections to the already pre-established framework of a library, framework or engine to implement the necessary functionality.
Thus, the first step in the creation of something new in any system is the reproduction of the basic pattern of a particular structure, which lies in its foundation. For example, if you are building a website within the framework of a chosen framework, for example,
Laravel in
PHP , you will create controllers, models, migrations, views and so on in any way.
What do generators built into frameworks offer us? Get rid of the routine operation of replicating the source code. However, this possibility of generating a framework for parts of an application is not built into every system. Needless to say, in such popular old-timers as
WordPress, there is nothing like that yet.
Therefore, in the summer of 2012, the application saw the light in this material saw the light.
Meet:

The site of the program is quite informative:
http://yeoman.ioOn it you can find a lot of useful information.
For example, here’s a typical setup for a modern developer’s workspace:

- Generating an application skeleton with Yeoman
- Install additional scripts with Bower
- We start the web server and related useful utilities with Grunt (or Gulp , which was written a couple of days ago )
Let's learn the basics of working with
Yeoman , so that anyone who has not yet seen this program in action would understand its need for a daily workflow.
Installation
Our faithful helper is abbreviated
yo .
Therefore, its installation is as follows:
sudo npm i -g yo
You need to execute this code, as you already understood, in the terminal window:

That's it, the installation is complete.
Let's run this program now and see what it can do.
Beginning of work
Since we used the
-g
option when installing from the
npm
package manager, our trusty helper
YeoMan was installed globally. That is, it can be called from anywhere, whatever the current directory of your Terminal.
Otherwise, you would have to run the program only from the directory in which the installer was running.
Run the program by simply calling the
yo
command in the Terminal and see what it can do:

As you can see,
YeoMan meets the author of the article, greeting him by name. Next, the program offers to run one of the previously installed generators.
About how they are installed, a little later.
Let's select one of them for now and see how it works.
Start the
WordPress generator:

This generator installs the latest version of
WordPress.Before installation, he asks us to answer a series of questions - the website address, database settings, and so on:

Installing the latest version from
Git :

Write files:

Completion of work:

Thus, in less than a minute
Yeoman did the work for which we used to spend at least a few minutes and a lot of mouse clicks.
Generator installation
As could be understood from what was written above,
Yeoman is only a shell, an interface that performs the work of a variety of generators.
How to search and install the generators themselves?
It is possible through the official website:
http://yeoman.io/generators/And you can also via the console:


Conclusion
The objective of this publication was to demonstrate the work of
Yeoman and to awaken the reader’s interest in automating the development process. After all, ultimately, the more you think about optimization and use useful tools - the more free time you have for your personal needs.
Let the part of the work, the time of which we can spend on the family, make cars. And
Yeoman is a great helper in this.
Study, try, rejoice with us.
Official website of the program:
http://yeoman.ioPS The material is designed for those who have not yet used
Yeoman for any reason.
If you use this program, I ask in the comments to tell about your preferences and experience of working with it - it will be useful for everyone to find out.