Skip to content

Commit

Permalink
less obtrusive warning about modules hash
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed May 21, 2011
1 parent 2e9e3f8 commit 13b6f33
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/utils/read-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ function jsonParseFail (ex, file, cb) {
throw e
}

var modulesWarned = {}
function processObject (opts, cb) { return function (er, json) {

// slashes would be a security risk.
Expand Down Expand Up @@ -215,12 +216,14 @@ function processObject (opts, cb) { return function (er, json) {
json.keywords = kw
}

json._id = json.name+"@"+json.version

var tag = opts.tag
if (tag) json.version = tag//+"-"+json.version
if (tag) json.version = tag

if (json.modules) {
var e = new Error("modules object is deprecated")
log.error(e, "incorrect json: "+json.name)
if (json.modules && !modulesWarned[json._id]) {
log.warn("modules object is deprecated", json._id)
modulesWarned[json._id] = true
delete json.modules
}

Expand Down Expand Up @@ -278,7 +281,6 @@ function processObject (opts, cb) { return function (er, json) {
})
}

json._id = json.name+"@"+json.version
json = testEngine(json)
json = parsePeople(unParsePeople(json))
if ( json.bugs ) json.bugs = parsePerson(unParsePerson(json.bugs))
Expand Down

0 comments on commit 13b6f33

Please sign in to comment.