Generating a Yeoman Generator

After writing several Virgo recipes I thought about how to reduce the effort of creating the always same scaffold and I though to give yeoman a try.

Lucky me there is a Yeoman generator generator project available at GitHub: generator-generator .

Getting started seems easy - just two commands:

$ npm install -g generator-generator
$ yo generator

zsh: command not found: yo

Hm. We need yeoman itself, too. My fault:

$ npm install -g yo

Another little baby step...

$ export PATH=$PATH:/Users/fluffi/npm-global/bin

and off we go!

$ yo generator
? Your generator name generator-virgo-recipe
....
I'm all done. Running npm install for you to install the required dependencies. If this fails, try running the command yourself.
....

Let's check whether the generator skeleton is able to walk...

cd generator-virgo-recipe
npm test
....
  generator-virgo-recipe:app
  ✓ creates files
1 passing (221ms)
....

Nice. So everything is prepared for writing the actual generator. But that's a tale for another day.

Show Comments