diff options
author | isaacs <i@izs.me> | 2011-11-06 05:30:53 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2011-11-06 05:30:53 +0400 |
commit | 841e212073f92d983ffd363a2f8c2a9bd51d0446 (patch) | |
tree | 2160bf8ed7c71e211807c6093bf1b08dbc5d8d99 /lib/init.js | |
parent | 5ac0c969c50a74cb0d48adc5a0bcf8f0d8dcbd74 (diff) |
init: Make the engines.node default a bit looser
Diffstat (limited to 'lib/init.js')
-rw-r--r-- | lib/init.js | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/init.js b/lib/init.js index b3e61b291..950cb4588 100644 --- a/lib/init.js +++ b/lib/init.js @@ -40,10 +40,17 @@ function init (args, cb) { function init_ (data, folder, cb) { var nv = npm.config.get("node-version") - , eng = semver.parse(nv) + , p = semver.parse(nv) + , eng = "" + + if (!p[5]) eng = "~" + nv + else eng = "~" + [p[1], p[2], p[3]].join(".") + " || " + nv + + // node version 0.n is api-compatible with 0.(n+1) when n is odd. + if (p[2] % 2) { + eng += " || " + [p[1], +(p[2]) + 1].join(".") + } - if (!eng[5]) eng = "~" + nv - else eng = "~" + [eng[1], eng[2], eng[3]].join(".") + " || " + nv output.write( ["This utility will walk you through creating a package.json file." |