Skip to content
This repository

Minimalist-omakase build tool for node.js projects

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 bin
Octocat-spinner-32 conf
Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .travis.yml
Octocat-spinner-32 CHANGELOG.md
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 package.json
README.md

Bob http://travis-ci.org/cliffano/bob

Convention-based build tool for Node.js projects.

This is handy for building (linting, testing the code, checking test code coverage, generating documentation, packaging artifact, etc) a Node.js project, with a minimal-or-zero configuration, by following a set of common convention.

There are two Bob modes, human and robot. By default Bob runs in human mode, generating output in human-readable format (e.g. test result in a plain text list). When robot mode is used, Bob will generate output in machine-parsable format (e.g. test result in XML), which is handy when you're using a continuous integration server that consumes XML files for rendering reports and charts.

Bob works where ever you can run make.

Installation

npm install -g bob

Project Convention

A project must contain:

  • package.json file, with at least name and version info
  • lib/ directory, containing *.js source files
  • test/ directory, containing *.js test files

Usage

Run Bob from project directory: (same level as package.json file)

bob clean lint test coverage ...

Run Bob in robot mode: (if unspecified, BOB_MODE defaults to human)

BOB_MODE=robot bob clean lint test coverage

Run Bob with verbose output: (display make arguments and shell commands)

BOB_MODE=robot bob --verbose clean lint test coverage

Run Bob with specific environment: (if unspecified, NODE_ENV defaults to development)

NODE_ENV=production bob start

Targets

Target Description Types Parameters
dep Install dependencies specified in package.json file by executing npm install . . - -
rmdep Remove dependencies in node_modules directory. - -
tools Global install the tools used by Bob (e.g. jshint, nodelint, mocha, vows, etc). - -
rmtools Remove global installation of those tools. - -
clean Delete .bob directory and *.log files. - -
lint Lint *.js files in lib/ and test/ directories. jshint (default), nodelint, esvalidate bin, opts, files
style Run style checker against *.js files in lib/ directory. jscheckstyle (default) bin, opts, files
test Execute *.js test files in test/ directory. If {scripts.test} is configured in package.json, then npm test will be executed instead. mocha (default), nodeunit, vows bin, opts, files
coverage Check code coverage. mocha (default), vows bin, opts, files
test-integrationexperimental Execute *.js integration test files in test-integration/ directory. mocha (default) bin, opts, files
test-acceptanceexperimental Execute *.js acceptance test files in test-acceptance/ directory. mocha (default) bin, opts, files
depgraph Generate module dependencies graph. madge (default) bin, opts, files
package Create a .tar.gz package file in .bob/artifact/ directory, along with md5 and sha1 checksums of the artifact file. - src
publish Publish artifact file to an artifact repository. npm (default), ivy ivy: user, key, host, port, dir
send Send the artifact file to a remote server. scp (default), ftp user, key, host, port, dir
stop Stop the app by executing node {name}.js stop . If scripts.stop is configured in package.json, then npm stop will be executed instead. - -
start Start the app by executing node {name}.js start . If scripts.start is configured in package.json, then npm start will be executed instead. - -
restart Restart the app by executing node {name}.js restart . If scripts.restart is configured in package.json, then npm restart will be executed instead. - -
status Display app status by executing node {name}.js status . - -
versionup Upgrade patch version number in package.json file. - -
versionup-minor Upgrade minor version number in package.json file. - -
versionup-major Upgrade major version number in package.json file. - -
nuke Kill all processes with command containing the word 'node' . - -

Config

To override the default setting, create .bob.json file in project directory (same level as package.json file). Target type and parameters can be overridden, here are some examples:

To use nodelint instead of the default jshint when running bob lint:

{
  "lint": {
    "type": "nodelint"
  }
}

To use nodelint instead of the default jshint, and to lint the files in src directory instead of the default lib and test directories, when running bob lint:

{
  "lint": {
    "type": "nodelint",
    "files": "src"
  }
}

To add an alias target (called build) which executes clean lint test coverage targets:

{
  "build": "clean lint test coverage"
}

Continuous Integration

Travis CI

Configure Bob in .travis.yml file:

before_install: "npm install -g bob"
script: "bob clean lint test coverage"

Jenkins CI

Configure Bob in a Jenkins job with shell script build step:

npm install -g bob
bob clean lint test coverage
Something went wrong with that request. Please try again.