Skip to content

npm and generators

Sunday, Aug 12, 2012

Today I learned that npm (the node.js package manager) has support for arbitrary commands and chained commands. I guess I always knew this (how else can you trigger make && make install after download automatically?), but I finally looked into it. Now that I’m aware of this voodoo, I was able to create a generator for actionHero.

If you are familiar with rails, you are familiar all the scaffolding rails has (including the creation of a new project). actionHero isn’t nearly as complex as a modern rails project, but I really like the notion of a single command that sets up a new project for you. Here’s actionHero’s version:

npm install actionHero; npm run-script actionHero generate; npm start

This will get you started with some basic actions and a task, as well as launching the server locally for http, https, web sockets, and tcp.

Enjoy!

Last updated: