Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Minimalist-omakase build tool for node.js projects
JavaScript

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bin
conf
lib
test
.gitignore
CHANGELOG.md
LICENSE
README.md
package.json

README.md

Bob

A minimalistic build tool for Node.js projects.

Overview

Bob provides common build targets (clean, checkstyle, lint, test, coverage, package, deploy, stop, start, status, restart) for Node.js libs/apps. It essentially allows multiple projects to use the same Makefile stored in a global node_modules.

Installation

npm install -g bob

Config

Bob reads package.json file, please note that each property under "bob" is optional.

{
    "name": "myproject",
    "version": "0.0.1",
    "bob": {
        "src": {
            "dir": "mysrc/"
        },
        "checkstyle": {
            "files": "foo.js bar/",
            "opts": "--checkstyle"
        },
        "hint": {
            "files": "foo.js bar/",
            "opts": "--jslint-reporter --config path/to/hintconfig.js"
        },
        "lint": {
            "files": "foo.js bar/",
            "opts": "--reporter path/to/lintreporter.js --config path/to/lintconfig.js"
        },
        "test": {
            "files": "bar/*.js",
            "opts": "--dot-matrix"
        },
        "coverage": {
            "files": "bar/*.js",
            "opts": "--cover-html"
        },
        "deploy": {
            "host": "myremotehost",
            "port": 22,
            "dir": "/remote/path/to/myproject"
        }
    }
}

Project convention:

  • Uses jscheckstyle, jshint, nodelint, and vows as choices of tools
  • package.json - project descriptor
  • lib/ - .js library files
  • test/ - .js test files
  • build/ - reserved and generated by Bob to store buildtime reports/artifacts
  • run/ - reserved and generated by Bob to store runtime logs/pids
  • (optional, only relevant when your project is an app) {name}.js - main app file, must support node {name}.js start|stop|restart|status, e.g. using learnboost/cluster

Usage

Install required tools. (per Bob installation)

bob tools

Install project dependencies. (per Node.js project)

bob dep

Run Bob from project directory.

bob target1 target2 target3 ...

Run Bob with specific environment. (by default it uses NODE_ENV=development)

NODE_ENV=production bob start

Run Bob in robot mode (generate XML reports)

BOB_MODE=robot bob checkstyle hint test

Targets

  • clean - Delete build/ and run/ directories, along with any nohup.* and *.log files
  • checkstyle - Run jscheckstyle against all .js files under lib/ directory, configurable via {bob.checkstyle.files}
  • lint - Run nodelint against all .js files under lib/ and test/ directories, configurable via {bob.lint.files}
  • hint - Run jshint against all .js files under lib/ and test/ directories, configurable via {bob.hint.files}
  • test - Run vows against all .js files under test/ directory, configurable via {bob.test.files}
  • coverage - Run vows against all .js files under test/ directory with coverage flag, configurable via {bob.coverage.files}
  • package - Create a source .tar.gz package at build/artifact/ directory
  • stop - Stop the app
  • start - Start the app
  • restart - Restart the app
  • status - Display app status
  • nuke - Kill all processes with command containing the word 'node'
  • deploy - Deploy the package to {bob.deploy.host}:{bob.deploy.port} at {bob.deploy.dir}
  • deploy-r - Deploy the package and then remotely restart the app
Something went wrong with that request. Please try again.