Skip to content

Commit

Permalink
update require node/npm to 8.0.0 and 5.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jchip committed Jul 15, 2018
1 parent a218547 commit 8514847
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 28 deletions.
15 changes: 5 additions & 10 deletions packages/ignite-core/lib/util/check-env.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ module.exports = Object.assign(Lib, {

node: function node(version) {
const message =
semverCompare(version, "6.0.0") >= 0
semverCompare(version, "8.0.0") >= 0
? `Electrode should work for you.`
: `We recommend use Node LTS version 6.`;
: `Electrode uses async/await and requires Node LTS version 8 or later.`;
logger.log(chalk.yellow(`You are using Node version ${version}. ${message}`), "\n");
},

Expand All @@ -26,15 +26,10 @@ module.exports = Object.assign(Lib, {
* electrode-ignite is facing an incorrect installation issue under npm v5.4.x
*/
let message = "";
if (semverCompare(version, "5.4.0") >= 0 && semverCompare(version, "5.5.0") < 0) {
message = `Electrode should work for you.` +
` Note: Please avoid npm version v5.4.x,` +
` it may cause an incorrect installation while using electrode ignite.`;
if (semverCompare(version, "5.6.0") >= 0) {
message = `Electrode should work for you.`;
} else {
message =
semverCompare(version, "3.0.0") >= 0
? `Electrode should work for you.`
: `Electrode requires npm version 3 and up.`;
message = `Electrode requires npm version 5.6.0 or later.`;
}
logger.log(chalk.yellow(`You are using npm version ${version}. ${message}`));
}
Expand Down
30 changes: 12 additions & 18 deletions packages/ignite-core/test/spec/util/check-env.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ describe("check-env", function() {
logStub.restore();
});

it("electrode should work for node >= 6.0.0.", () => {
it("electrode should work for node >= 8.0.0.", () => {
logs = [];
checkEnv.node("6.0.0");
expect(logs[0]).includes("You are using Node version 6.0.0. Electrode should work for you.");
checkEnv.node("8.0.0");
expect(logs[0]).includes("You are using Node version 8.0.0. Electrode should work for you.");
});

it("electrode should not work for node < 6.0.0.", () => {
it("electrode should not work for node < 8.0.0.", () => {
logs = [];
checkEnv.node("5.0.0");
checkEnv.node("6.0.0");
expect(logs[0]).includes(
"You are using Node version 5.0.0. We recommend use Node LTS version 6."
"You are using Node version 6.0.0. Electrode uses async/await and requires Node LTS version 8 or later."
);
});
});
Expand All @@ -47,23 +47,17 @@ describe("check-env", function() {
logStub.restore();
});

it("electrode should work for npm >= 3.0.0.", () => {
logs = [];
checkEnv.npm("3.0.0");
expect(logs[0]).includes("You are using npm version 3.0.0. Electrode should work for you.");
});

it("should prompt a hint message with npm version v5.4.x", () => {
it("electrode should work for npm >= 5.6.0.", () => {
logs = [];
checkEnv.npm("5.4.2");
expect(logs[0]).includes("Note: Please avoid npm version v5.4.x, it may cause an incorrect installation while using electrode ignite.");
checkEnv.npm("5.6.0");
expect(logs[0]).includes("You are using npm version 5.6.0. Electrode should work for you.");
});

it("electrode should not work for node < 3.0.0.", () => {
it("electrode should not work for npm < 5.6.0.", () => {
logs = [];
checkEnv.npm("2.0.0");
checkEnv.npm("5.0.0");
expect(logs[0]).includes(
"You are using npm version 2.0.0. Electrode requires npm version 3 and up."
"You are using npm version 5.0.0. Electrode requires npm version 5.6.0 or later."
);
});
});
Expand Down

0 comments on commit 8514847

Please sign in to comment.