Skip to content

danielwhelansb/bob

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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. - -
updep Upgrade all dependencies to latest version. Only use this if you want exact dependencies. - -
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
complexity Run code complexity checker against *.js files in lib/ directory. plato (default), jscheckstyle bin, opts, files
test Execute unit test files in test/ directory. If {scripts.test} is configured in package.json, then npm test will be executed instead. mocha (default), buster, nodeunit, vows bin, opts, files
coverage Check code coverage. mocha (default), buster-istanbul, vows bin, opts, files
test-integrationexperimental Execute integration test files in test-integration/ directory. mocha (default), buster bin, opts, files
test-acceptanceexperimental Execute acceptance test files in test-acceptance/ directory. mocha (default), cucumber bin, opts, files
doc Generate code documentation. dox-foundation (default) bin, opts, files
depgraph Generate module dependencies graph. madge (default) bin, opts, files
package Create a package file in .bob/artifact/ directory, along with md5 and sha1 checksums of the artifact file. tar.gz (default), zip src, bin, opts
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

About

Convention-based build tool for Node.js projects

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%