Comparing version 1.3.13 to 1.3.14
{ | ||
"name": "depsync", | ||
"version": "1.3.13", | ||
"version": "1.3.14", | ||
"author": "Dom Chen", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/domchen/depsync", |
@@ -141,26 +141,2 @@ ////////////////////////////////////////////////////////////////////////////////////// | ||
function compareVersion(versionA, versionB) { | ||
if (versionA === versionB) { | ||
return 0; | ||
} | ||
let listA = versionA.split("."); | ||
let listB = versionB.split("."); | ||
let length = Math.max(listA.length, listB.length); | ||
for (let i = 0; i < length; i++) { | ||
if (listA.length <= i) { | ||
return -1; | ||
} | ||
let a = parseInt(listA[i]); | ||
if (listB.length <= i) { | ||
return 1; | ||
} | ||
let b = parseInt(listB[i]); | ||
if (a === b) { | ||
continue; | ||
} | ||
return a > b ? 1 : -1; | ||
} | ||
return 0; | ||
} | ||
function parse(configFileName, version, platform) { | ||
@@ -175,3 +151,3 @@ if (!fs.existsSync(configFileName)) { | ||
} catch (e) { | ||
if (jsonText.trimLeft().indexOf("{") === 0) { | ||
if (jsonText.trim().indexOf("{") === 0) { | ||
Utils.error("The DEPS config file is not a valid JSON file: " + configFileName); | ||
@@ -184,3 +160,3 @@ } | ||
config.version = data.version ? data.version : "0.0.0"; | ||
if (compareVersion(version, config.version) < 0) { | ||
if (Utils.compareVersion(version, config.version) < 0) { | ||
Utils.error("The DEPS config requires a higher version of depsync tool: " + configFileName); | ||
@@ -187,0 +163,0 @@ Utils.error("Requires version: " + config.version); |
@@ -66,2 +66,7 @@ ////////////////////////////////////////////////////////////////////////////////////// | ||
function run(args) { | ||
let version = process.versions.node; | ||
if (Utils.compareVersion(version, "14.14.0") < 0) { | ||
Utils.error("Node.js version must be greater than or equal to 14.14.0\n"); | ||
process.exit(1); | ||
} | ||
let commandOptions = CommandLine.parse(args); | ||
@@ -68,0 +73,0 @@ if (commandOptions.errors.length > 0) { |
@@ -226,2 +226,26 @@ ////////////////////////////////////////////////////////////////////////////////////// | ||
function compareVersion(versionA, versionB) { | ||
if (versionA === versionB) { | ||
return 0; | ||
} | ||
let listA = versionA.split("."); | ||
let listB = versionB.split("."); | ||
let length = Math.max(listA.length, listB.length); | ||
for (let i = 0; i < length; i++) { | ||
if (listA.length <= i) { | ||
return -1; | ||
} | ||
let a = parseInt(listA[i]); | ||
if (listB.length <= i) { | ||
return 1; | ||
} | ||
let b = parseInt(listB[i]); | ||
if (a === b) { | ||
continue; | ||
} | ||
return a > b ? 1 : -1; | ||
} | ||
return 0; | ||
} | ||
function addLineBreaker() { | ||
@@ -241,2 +265,3 @@ hasLineBreaker = true; | ||
exports.error = error; | ||
exports.compareVersion = compareVersion; | ||
exports.addLineBreaker = addLineBreaker; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53421
1232