Skip to content

Commit

Permalink
Close npm#843 install dev-deps locally
Browse files Browse the repository at this point in the history
When installing or linking at the top-level, install the
devDependencies, since that's typically done in a development folder.
  • Loading branch information
isaacs committed Apr 27, 2011
1 parent 08e287c commit e9b1c2a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ function install (args, cb) {
if (!args.length) {
if (npm.config.get("global")) args = ["."]
else return readJson( path.resolve(where, "package.json")
, { dev: true }
, function (er, data) {
if (er) return log.er(cb, "Couldn't read dependencies.")(er)
var deps = Object.keys(data.dependencies || {})
Expand Down
2 changes: 1 addition & 1 deletion lib/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function linkPkg (folder, cb_) {
var gp = npm.config.get("prefix")
, me = folder || npm.prefix
, readJson = require("./utils/read-json")
readJson(path.resolve(me, "package.json"), function (er, d) {
readJson(path.resolve(me, "package.json"), { dev: true }, function (er, d) {
function cb (er) {
return cb_(er, [[target, d && d._id]])
}
Expand Down
4 changes: 3 additions & 1 deletion lib/utils/read-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,12 @@ function processObject (opts, cb) { return function (er, json) {
json.devDependencies = json["dev-dependencies"]
delete json["dev-dependencies"]
}

;["dependencies", "devDependencies"].forEach(function (d) {
json[d] = json[d] ? depObjectify(json[d]) : {}
})
if (npm.config.get("dev") || npm.config.get("npat")) {

if (opts.dev || npm.config.get("dev") || npm.config.get("npat")) {
Object.keys(json.devDependencies || {}).forEach(function (d) {
json.dependencies[d] = json.devDependencies[d]
})
Expand Down

0 comments on commit e9b1c2a

Please sign in to comment.