j3lamp / runninator

A generic runner ideal for a front-end hot reload server and application server.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Runninator

A generic runner ideal for a front-end hot reload server and application server.

Runninator is designed for running things like your application server along with a webpack development server, or similar. This is not designed for running build tasks but rather a way to start multiple servers required for development together while providing the ability to control them individually.

Install

npm install --save-dev runninator

Usage

runninator <config file>

Once launched runninator will start each of the commands listed in the configuration file and provide a prompt for controlling them. Allowing individual commands to be restarted, stopped, and started again.

Configuring

Runninator expects a JavaScript file that exports a configuration object.

Example

module.exports = {
    app: {command: ["node", "app.js"],
          color:   "green"},
    wp:  {command: ["npm", "run", "webpack"],
          color:   "blue"}
};

Each entry maps the name runninator will use to the actual command to be run. The color field id optional and one will be picked automatically if omitted or invalid. Valid colors are:

  • green
  • blue
  • cyan
  • magenta
  • yellow

Red is reserved for displaying errors.

Limitations

  • Not tested on Windows, but in theory it should work.
  • With node.js 4 commands cannot always be stopped, for example any command started using an npm script. This is due to a documented bug that was fixed in later versions. nodejs/node#2098
  • Not tested with node.js versions prior to 4.

Example Run

Starting app...
Starting wp...
app | $ open http://127.0.0.1:7001
wp  | Listening at http://localhost:7002/
run > help
Control Commands:
    start <command name>    Start a stopped command.
    stop <command name>     Stop a running command.
    restart <command name>  Restart a running command.

  Note: Control commands and command names can be entered in reverse order.
        The special command names 'all' and '*' can be used to control all the
        commands together.

Global Control Commands:
    status  Print the status of all commands.
    quit    Stop all commands and quit this.
    help    Print this help.

Commands:
    app  node app.js
    wp   node dev-server.js
wp  | Hash: cb9b46aed96961bfa659
wp  | Version: webpack 1.13.1
wp  | Time: 2829ms
wp  |     Asset     Size  Chunks             Chunk Names
wp  | bundle.js  1.08 MB       0  [emitted]  main
wp  | chunk    {0} bundle.js (main) 945 kB [rendered]
wp  |     [0] multi main 52 bytes {0} [built]
wp  |     [1] (webpack)-dev-server/client?http://localhost:7002 2.67 kB {0} [built]
wp  |     [2] ./~/url/url.js 22.3 kB {0} [built]
wp  |     [3] ./~/url/~/punycode/punycode.js 14.6 kB {0} [built]
wp  |     [4] (webpack)/buildin/module.js 251 bytes {0} [built]
wp  |     [5] ./~/querystring/index.js 127 bytes {0} [built]

wp  |   [255] ./~/component-emitter/index.js 3 kB {0} [built]
wp  |   [256] ./~/reduce-component/index.js 405 bytes {0} [built]
wp  |   [257] ./public/javascripts/components/footer.js 3.38 kB {0} [built]
wp  |   [258] ./public/javascripts/components/todo_list.js 2.93 kB {0} [built]
wp  |   [259] ./public/javascripts/components/todo.js 3.63 kB {0} [built]
wp  |   [260] ./~/classnames/index.js 1.1 kB {0} [built]
wp  | webpack: bundle is now VALID.
app |   <-- GET /tasks
app |   --> GET /tasks 200 15ms -
run > status
Process status:
  app running
  wp  running
app |   <-- GET /tasks
app |   --> GET /tasks 200 5ms -
run > stop wp
Stopping wp...
run > restart app
Restarting app...
app | $ open http://127.0.0.1:7001
run > status
Process status:
  app running
  wp  stopped
run > start wp
Starting wp...
wp  | Listening at http://localhost:7002/
wp  | Hash: cb9b46aed96961bfa659
wp  | Version: webpack 1.13.1
wp  | Time: 2845ms
wp  |     Asset     Size  Chunks             Chunk Names
wp  | bundle.js  1.08 MB       0  [emitted]  main
wp  | chunk    {0} bundle.js (main) 945 kB [rendered]
wp  |     [0] multi main 52 bytes {0} [built]
wp  |     [1] (webpack)-dev-server/client?http://localhost:7002 2.67 kB {0} [built]
wp  |     [2] ./~/url/url.js 22.3 kB {0} [built]
wp  |     [3] ./~/url/~/punycode/punycode.js 14.6 kB {0} [built]
wp  |     [4] (webpack)/buildin/module.js 251 bytes {0} [built]
wp  |     [5] ./~/querystring/index.js 127 bytes {0} [built]

wp  |   [255] ./~/component-emitter/index.js 3 kB {0} [built]
wp  |   [256] ./~/reduce-component/index.js 405 bytes {0} [built]
wp  |   [257] ./public/javascripts/components/footer.js 3.38 kB {0} [built]
wp  |   [258] ./public/javascripts/components/todo_list.js 2.93 kB {0} [built]
wp  |   [259] ./public/javascripts/components/todo.js 3.63 kB {0} [built]
wp  |   [260] ./~/classnames/index.js 1.1 kB {0} [built]
wp  | webpack: bundle is now VALID.
run > quit
Stopping app...
Stopping wp...
run >

License

© John Lamp

MIT license

About

A generic runner ideal for a front-end hot reload server and application server.

License:MIT License


Languages

Language:JavaScript 75.2%Language:CSS 20.4%Language:Makefile 2.8%Language:HTML 1.6%