From 213a3e297cbf4494ac3ee591b481e213fe2f050a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Fri, 24 Mar 2017 17:28:23 +0100 Subject: [PATCH 1/5] Check node version --- app.js | 10 +++++++++- package.json | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app.js b/app.js index f6692d36..fe5d7468 100755 --- a/app.js +++ b/app.js @@ -2,8 +2,16 @@ var http = require('http'); var https = require('https'); var path = require('path'); var fs = require('fs'); - var _ = require('underscore'); +var semver = require('semver'); + +var ver = process.versions.node; +ver = ver.split('-')[0]; // explode and truncate tag from version #511 + +if (!semver.satisfies(ver, '>6.9.0')) { + console.log('Node version ' + ver + ' is not supported, please use Node.js 6.9 or higher.'); + process.exit(1); +} // jshint undef:false var log = console.log.bind(console); diff --git a/package.json b/package.json index 14d6d2f8..813c943d 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "queue-async": "~1.0.7", "redis-mpool": "0.4.1", "request": "~2.79.0", + "semver": "~5.3.0", "step": "~0.0.6", "step-profiler": "~0.3.0", "turbo-carto": "0.19.0", @@ -48,7 +49,6 @@ "mocha": "~1.21.4", "nock": "~2.11.0", "redis": "~0.12.1", - "semver": "~1.1.4", "strftime": "~0.8.2" }, "scripts": { From 2374711d6387fb10dd504361a3616cfbe0242227 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Fri, 24 Mar 2017 17:34:05 +0100 Subject: [PATCH 2/5] Remove reference to issue --- app.js | 2 +- yarn.lock | 22 +++++++++------------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/app.js b/app.js index fe5d7468..dde17dde 100755 --- a/app.js +++ b/app.js @@ -6,7 +6,7 @@ var _ = require('underscore'); var semver = require('semver'); var ver = process.versions.node; -ver = ver.split('-')[0]; // explode and truncate tag from version #511 +ver = ver.split('-')[0]; // explode and truncate tag from version if (!semver.satisfies(ver, '>6.9.0')) { console.log('Node version ' + ver + ' is not supported, please use Node.js 6.9 or higher.'); diff --git a/yarn.lock b/yarn.lock index df4c739d..89e0eb13 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,7 +2,7 @@ # yarn lockfile v1 -"abaculus@github:cartodb/abaculus#2.0.3-cdb1": +abaculus@cartodb/abaculus#2.0.3-cdb1: version "2.0.3-cdb1" resolved "https://codeload.github.com/cartodb/abaculus/tar.gz/f5f34e1c80cdd8d49edd1d6fe3b2220ab2e23aaf" dependencies: @@ -205,7 +205,7 @@ camshaft@0.50.3: dot "^1.0.3" request "^2.69.0" -"canvas@github:cartodb/node-canvas#1.6.2-cdb2": +canvas@cartodb/node-canvas#1.6.2-cdb2: version "1.6.2-cdb2" resolved "https://codeload.github.com/cartodb/node-canvas/tar.gz/8acf04557005c633f9e68524488a2657c04f3766" dependencies: @@ -223,15 +223,15 @@ carto@0.16.3: semver "^5.1.0" yargs "^4.2.0" -"carto@github:cartodb/carto#0.15.1-cdb1": +carto@CartoDB/carto#0.15.1-cdb1: version "0.15.1-cdb1" - resolved "https://codeload.github.com/cartodb/carto/tar.gz/8050ec843f1f32a6469e5d1cf49602773015d398" + resolved "https://codeload.github.com/CartoDB/carto/tar.gz/8050ec843f1f32a6469e5d1cf49602773015d398" dependencies: mapnik-reference "~6.0.2" optimist "~0.6.0" underscore "~1.6.0" -"carto@github:cartodb/carto#0.15.1-cdb3": +carto@cartodb/carto#0.15.1-cdb3: version "0.15.1-cdb3" resolved "https://codeload.github.com/cartodb/carto/tar.gz/945f5efb74fd1af1f5e1f69f409f9567f94fb5a7" dependencies: @@ -1509,7 +1509,7 @@ pg-types@1.*: postgres-date "~1.0.0" postgres-interval "~1.0.0" -"pg@github:cartodb/node-postgres#6.1.2-cdb1": +pg@cartodb/node-postgres#6.1.2-cdb1: version "6.1.2" resolved "https://codeload.github.com/cartodb/node-postgres/tar.gz/3c81aea432ce58d20a795786c58bbb14f68f9689" dependencies: @@ -1820,7 +1820,7 @@ safe-json-stringify@~1: version "1.0.4" resolved "https://registry.yarnpkg.com/safe-json-stringify/-/safe-json-stringify-1.0.4.tgz#81a098f447e4bbc3ff3312a243521bc060ef5911" -"semver@2 || 3 || 4 || 5", semver@^5.1.0, semver@^5.3.0: +"semver@2 || 3 || 4 || 5", semver@^5.1.0, semver@^5.3.0, semver@~5.3.0: version "5.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.3.0.tgz#9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f" @@ -1828,10 +1828,6 @@ semver@4.3.2: version "4.3.2" resolved "https://registry.yarnpkg.com/semver/-/semver-4.3.2.tgz#c7a07158a80bedd052355b770d82d6640f803be7" -semver@~1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/semver/-/semver-1.1.4.tgz#2e5a4e72bab03472cc97f72753b4508912ef5540" - semver@~4.3.3: version "4.3.6" resolved "https://registry.yarnpkg.com/semver/-/semver-4.3.6.tgz#300bc6e0e86374f7ba61068b5b1ecd57fc6532da" @@ -2084,7 +2080,7 @@ through@2: version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" -"tilelive-bridge@github:cartodb/tilelive-bridge#2.3.1-cdb1": +tilelive-bridge@cartodb/tilelive-bridge#2.3.1-cdb1: version "2.3.1-cdb1" resolved "https://codeload.github.com/cartodb/tilelive-bridge/tar.gz/3f76c278c782e93d79045870387a0a06bace720b" dependencies: @@ -2092,7 +2088,7 @@ through@2: mapnik-pool "~0.1.3" sphericalmercator "1.0.x" -"tilelive-mapnik@github:cartodb/tilelive-mapnik#0.6.18-cdb1": +tilelive-mapnik@cartodb/tilelive-mapnik#0.6.18-cdb1: version "0.6.18-cdb1" resolved "https://codeload.github.com/cartodb/tilelive-mapnik/tar.gz/cf7e5b4633db653a889a6c6e6a5ddcbcf4ddc3b5" dependencies: From 6a4b412cd31e19c1aa07e531f9eddc06c57d2140 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Garc=C3=ADa=20Aubert?= Date: Mon, 27 Mar 2017 18:27:55 +0200 Subject: [PATCH 3/5] Avoid lint --- app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.js b/app.js index dde17dde..759b87cc 100755 --- a/app.js +++ b/app.js @@ -8,12 +8,12 @@ var semver = require('semver'); var ver = process.versions.node; ver = ver.split('-')[0]; // explode and truncate tag from version +// jshint undef:false if (!semver.satisfies(ver, '>6.9.0')) { console.log('Node version ' + ver + ' is not supported, please use Node.js 6.9 or higher.'); process.exit(1); } -// jshint undef:false var log = console.log.bind(console); var logError = console.error.bind(console); // jshint undef:true From 66380197f464dae66a127a7a846c38606227fcfa Mon Sep 17 00:00:00 2001 From: Raul Ochoa Date: Mon, 25 Sep 2017 14:53:17 +0000 Subject: [PATCH 4/5] Do not explode by - token --- app.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app.js b/app.js index 6eb1ef3a..8305a1eb 100755 --- a/app.js +++ b/app.js @@ -5,12 +5,11 @@ var fs = require('fs'); var _ = require('underscore'); var semver = require('semver'); -var ver = process.versions.node; -ver = ver.split('-')[0]; // explode and truncate tag from version +var nodejsVersion = process.versions.node; // jshint undef:false -if (!semver.satisfies(ver, '>6.9.0')) { - console.log('Node version ' + ver + ' is not supported, please use Node.js 6.9 or higher.'); +if (!semver.satisfies(nodejsVersion, '>6.9.0')) { + console.log(`Node version ${nodejsVersion} is not supported, please use Node.js 6.9 or higher.`); process.exit(1); } From 3023111896217bd69f3a1d28b2f3f9a999f89a84 Mon Sep 17 00:00:00 2001 From: Raul Ochoa Date: Mon, 25 Sep 2017 14:55:17 +0000 Subject: [PATCH 5/5] Reuse existing log methods --- app.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/app.js b/app.js index 8305a1eb..c1388b92 100755 --- a/app.js +++ b/app.js @@ -5,18 +5,17 @@ var fs = require('fs'); var _ = require('underscore'); var semver = require('semver'); -var nodejsVersion = process.versions.node; - // jshint undef:false -if (!semver.satisfies(nodejsVersion, '>6.9.0')) { - console.log(`Node version ${nodejsVersion} is not supported, please use Node.js 6.9 or higher.`); - process.exit(1); -} - var log = console.log.bind(console); var logError = console.error.bind(console); // jshint undef:true +var nodejsVersion = process.versions.node; +if (!semver.satisfies(nodejsVersion, '>6.9.0')) { + logError(`Node version ${nodejsVersion} is not supported, please use Node.js 6.9 or higher.`); + process.exit(1); +} + var argv = require('yargs') .usage('Usage: $0 [options]') .help('h')