Skip to content

Commit

Permalink
Add the 'rollback' flag to enable/suppress roll backs
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Apr 19, 2011
1 parent cf829c8 commit faa5bbd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
20 changes: 13 additions & 7 deletions doc/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,14 @@ The depth to go when recursing directories for `npm ls` and
* Default: true
* Type: Boolean

Whether or not to show the description in `npm search`
Show the description in `npm search`

### dev

* Default: false
* Type: Boolean

Whether or not to install `dev-dependencies` along with packages.
Install `dev-dependencies` along with packages.

Note that `dev-dependencies` are also installed if the `npat` flag is
set.
Expand Down Expand Up @@ -306,7 +306,7 @@ What level of logs to report. On failure, *all* logs are written to
* Default: false
* Type: Boolean

Whether or not to show extended information in `npm ls`
Show extended information in `npm ls`

### node-version

Expand All @@ -320,7 +320,7 @@ The node version to use when checking package's "engines" hash.
* Default: false
* Type: Boolean

Whether or not to run tests on installation and report results to the
Run tests on installation and report results to the
`npaturl`.

### npaturl
Expand Down Expand Up @@ -350,7 +350,7 @@ Where to write "normal" output. This has no effect on log output.
* Default: false
* Type: Boolean

Whether or not to output parseable results from commands that write to
Output parseable results from commands that write to
standard output.

### prefix
Expand All @@ -373,8 +373,7 @@ A proxy to use for outgoing http requests.
* Default: true
* Type: Boolean

Set to some truish value to rebuild bundled dependencies after
installation.
Rebuild bundled dependencies after installation.

### registry

Expand All @@ -383,6 +382,13 @@ installation.

The base URL of the npm package registry.

### rollback

* Default: true
* Type: Boolean

Remove failed installs.

### searchopts

* Default: ""
Expand Down
1 change: 1 addition & 0 deletions lib/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ function write (target, targetFolder, previously, cb_) {
function cb (er, data) {
if (!er) return cb_(er, data)
log.error(er, "error installing "+target._id)
if (false === npm.config.get("rollback")) return cb_(er)
npm.commands.unbuild([targetFolder], function (er2) {
if (er2) log.error(er2, "error rolling back "+target._id)
return cb_(er, data)
Expand Down
2 changes: 2 additions & 0 deletions lib/utils/config-defs.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ Object.defineProperty(exports, "defaults", {get: function () {
, proxy : process.env.HTTP_PROXY || process.env.http_proxy || null
, "rebuild-bundle" : true
, registry : "http://registry.npmjs.org/"
, rollback : true
, searchopts: ""
, searchexclude: null
, shell : process.env.SHELL || "bash"
Expand Down Expand Up @@ -121,6 +122,7 @@ exports.types =
, proxy : url
, "rebuild-bundle" : Boolean
, registry : url
, rollback : Boolean
, searchopts : String
, searchexclude: [null, String]
, shell : path
Expand Down

0 comments on commit faa5bbd

Please sign in to comment.