Skip to content

Commit a074bd9

Browse files
committed
update node version checks to throw on node <4
1 parent b7a48c0 commit a074bd9

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

bin/kpm.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,13 @@
99
* of patent rights can be found in the PATENTS file in the same directory.
1010
*/
1111

12-
if (require("semver").satisfies(process.versions.node, ">5.0.0")) {
13-
require("../lib/cli");
12+
var semver = require("semver");
13+
var ver = process.versions.node;
14+
15+
if (semver.satisfies(ver, ">=5.0.0")) {
16+
module.exports = require("./lib/cli/idndex.js");
17+
} else if (semver.satisfies(ver, ">=4.0.0")) {
18+
module.exports = require("./lib-legacy/cli/idndex.js");
1419
} else {
15-
require("../lib-legacy/cli");
20+
throw new Error("Node version " + ver + " is not supported");
1621
}

index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@
77
* of patent rights can be found in the PATENTS file in the same directory.
88
*/
99

10-
if (require("semver").satisfies(process.versions.node, ">=5.0.0")) {
10+
var semver = require("semver");
11+
var ver = process.versions.node;
12+
13+
if (semver.satisfies(ver, ">=5.0.0")) {
1114
module.exports = require("./lib/api.js");
12-
} else {
15+
} else if (semver.satisfies(ver, ">=4.0.0")) {
1316
module.exports = require("./lib-legacy/api.js");
17+
} else {
18+
throw new Error("Node version " + ver + " is not supported");
1419
}

0 commit comments

Comments
 (0)