From 04d1043b9785c9c09989fd1b5b773bd9b395931a Mon Sep 17 00:00:00 2001 From: "Isaac A. Murchie" Date: Wed, 18 Dec 2019 11:30:20 -0500 Subject: [PATCH 1/2] fix: make everything run on Node 10.0 --- lib/util.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/util.js b/lib/util.js index 49d8f9b3..4222c72c 100644 --- a/lib/util.js +++ b/lib/util.js @@ -8,6 +8,8 @@ import { quote as shellQuote } from 'shell-quote'; const W3C_WEB_ELEMENT_IDENTIFIER = 'element-6066-11e4-a52e-4f735466cecf'; +const NODE_VERSION = semver.coerce(process.version); + export function hasContent (val) { return _.isString(val) && val !== ''; } @@ -257,9 +259,17 @@ async function isSameDestination (path1, path2, ...pathN) { if (areAllItemsEqual(allPaths)) { return true; } - return areAllItemsEqual(await B.map(allPaths, async (x) => (await fs.stat(x, { - bigint: true - })).ino)); + + // Node 10.5.0 introduced bigint support in stat, which allows for more precision + // however below that the options get interpreted as the callback + // TODO: remove when Node 10 is no longer supported + let mapCb = async (x) => await fs.stat(x, { + bigint: true, + }).ino; + if (NODE_VERSION.major <= 10 && NODE_VERSION.minor < 5) { + mapCb = async (x) => await fs.stat(x).ino; + } + return areAllItemsEqual(await B.map(allPaths, mapCb)); } /** From 43fbc74149a1ba7ee77597e9d85e77b9b2329bef Mon Sep 17 00:00:00 2001 From: "Isaac A. Murchie" Date: Wed, 18 Dec 2019 11:45:43 -0500 Subject: [PATCH 2/2] refactor: use semver like a normal human being --- lib/util.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/util.js b/lib/util.js index 4222c72c..a2b3f8d7 100644 --- a/lib/util.js +++ b/lib/util.js @@ -6,9 +6,8 @@ import fs from './fs'; import semver from 'semver'; import { quote as shellQuote } from 'shell-quote'; -const W3C_WEB_ELEMENT_IDENTIFIER = 'element-6066-11e4-a52e-4f735466cecf'; -const NODE_VERSION = semver.coerce(process.version); +const W3C_WEB_ELEMENT_IDENTIFIER = 'element-6066-11e4-a52e-4f735466cecf'; export function hasContent (val) { return _.isString(val) && val !== ''; @@ -266,7 +265,7 @@ async function isSameDestination (path1, path2, ...pathN) { let mapCb = async (x) => await fs.stat(x, { bigint: true, }).ino; - if (NODE_VERSION.major <= 10 && NODE_VERSION.minor < 5) { + if (semver.lt(process.version, '10.5.0')) { mapCb = async (x) => await fs.stat(x).ino; } return areAllItemsEqual(await B.map(allPaths, mapCb));