diff options
Diffstat (limited to 'lib/utils/read-json.js')
-rw-r--r-- | lib/utils/read-json.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/utils/read-json.js b/lib/utils/read-json.js index daf6edf1f..7abe278ce 100644 --- a/lib/utils/read-json.js +++ b/lib/utils/read-json.js @@ -8,8 +8,10 @@ var fs = require("fs") function readJson (jsonFile, opts, cb) { if (typeof cb !== "function") cb = opts, opts = {} - fs.stat(path.join(path.dirname(jsonFile), "wscript"), function (er) { - opts.wscript = !er + fs.readFile(path.join(path.dirname(jsonFile), "wscript"), function (er, data) { + if (er) opts.wscript = false + else opts.wscript = data.toString().match(/(^|\n)def build\b/) + && data.toString().match(/(^|\n)def configure\b/) fs.readFile(jsonFile, processJson(opts, cb)) }) } @@ -86,7 +88,7 @@ function processObject (opts, cb) { return function (er, json) { var scripts = json.scripts = json.scripts || {} if (!scripts.install && !scripts.preinstall) { // don't fail if it was unexpected, just try. - scripts.preinstall = "node-waf configure build || true" + scripts.preinstall = "node-waf configure build" } } |