Skip to content

Commit

Permalink
Regression in dev/optional --save stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Apr 18, 2012
1 parent de80b21 commit e5d7817
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/install.js
Expand Up @@ -260,14 +260,18 @@ function save (where, installed, tree, pretty, cb) {
} catch (ex) {
er = ex
}
if (er) return cb(null, installed, tree, pretty)
if (er) {
return cb(null, installed, tree, pretty)

}

var deps = npm.config.get("save-optional") ? "optionalDependencies"
: npm.config.get("save-dev") ? "devDependencies"
: "dependencies"

data[deps] = data[deps] || {}
Object.keys(things).forEach(function (t) {
deps[t] = things[t]
data[deps][t] = things[t]
})
data = JSON.stringify(data, null, 2) + "\n"
fs.writeFile(saveTarget, data, function (er) {
Expand Down

0 comments on commit e5d7817

Please sign in to comment.