From c22f1338ceb935ec1480a9c26ac5a3cb176517b7 Mon Sep 17 00:00:00 2001 From: Brenden Harrell Date: Fri, 18 Jun 2021 10:13:54 -0500 Subject: [PATCH 1/6] Add System check to beginning of node setup --- Launch-Scripts/system-check.js | 46 ++++++++++++++++++++++++++++++++++ setup.js | 4 +++ 2 files changed, 50 insertions(+) create mode 100644 Launch-Scripts/system-check.js diff --git a/Launch-Scripts/system-check.js b/Launch-Scripts/system-check.js new file mode 100644 index 000000000..76acb499f --- /dev/null +++ b/Launch-Scripts/system-check.js @@ -0,0 +1,46 @@ +const { execSync } = require("child_process"); +const os = require("os"); + +const npmNeededVersion = '5' +const nodeNeededVersion = '12' +const gitNeededVersion = '2' + +function systemCheck () { + try { + + // Gather Installed Versions of Node, NPM and Git + const npmVersionRaw = execSync( "npm -v",{ encoding: 'utf8', timeout: 30000 }) + const nodeVersionRaw = execSync( "node -v",{ encoding: 'utf8',timeout: 30000 }) + const gitVersionRaw = execSync( "git --version",{ encoding: 'utf8',timeout: 30000 }) + const npmVersion = npmVersionRaw.trim().split('.') + const nodeVersion = nodeVersionRaw.trim().substring(1).split('.') + const gitVersion = gitVersionRaw.trim().split(' ')[2].split('.') + + // Check needed versions against those that are installed + if ( npmVersion[0] < npmNeededVersion ) { + console.log("ERROR: the version of npm you have installed is out of date. Please update your installation of npm and try again.") + process.exit() + } + + if ( nodeVersion[0] < nodeNeededVersion ) { + console.log("ERROR: the version of node you have installed is out of date. Please update your installation of node and try again.") + process.exit() + } + + if ( gitVersion[0] < gitNeededVersion ) { + console.log("ERROR: the version of git you have installed is out of date. Please update your installation of git and try again.") + process.exit() + } + + + } catch (error) { + console.log(''); + console.log("There was an error with your system: "); + console.log(''); + console.log( error ); + return; + } + +}; + +module.exports = systemCheck \ No newline at end of file diff --git a/setup.js b/setup.js index 88e035833..e729a2307 100644 --- a/setup.js +++ b/setup.js @@ -1,6 +1,10 @@ const path = require("path"); const process = require("process"); const { exec } = require("child_process"); +const systemCheck = require('./Launch-Scripts/system-check') + +// Check system is set up correctly +systemCheck(); // Handle adding shortcuts if (process.argv.includes("noShortcuts")) { From 4f1a68363ad08d021b6ccca76eeceaed05fd0ea2 Mon Sep 17 00:00:00 2001 From: Brenden Harrell Date: Fri, 18 Jun 2021 10:52:46 -0500 Subject: [PATCH 2/6] Add white space to console output --- Launch-Scripts/system-check.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/Launch-Scripts/system-check.js b/Launch-Scripts/system-check.js index 76acb499f..6d0aa63e1 100644 --- a/Launch-Scripts/system-check.js +++ b/Launch-Scripts/system-check.js @@ -18,20 +18,25 @@ function systemCheck () { // Check needed versions against those that are installed if ( npmVersion[0] < npmNeededVersion ) { - console.log("ERROR: the version of npm you have installed is out of date. Please update your installation of npm and try again.") - process.exit() + console.log(''); + console.log("ERROR: the version of npm you have installed is out of date. Please update your installation of npm and try again."); + console.log(''); + process.exit(); } if ( nodeVersion[0] < nodeNeededVersion ) { - console.log("ERROR: the version of node you have installed is out of date. Please update your installation of node and try again.") - process.exit() + console.log(''); + console.log("ERROR: the version of node you have installed is out of date. Please update your installation of node and try again."); + console.log(''); + process.exit(); } if ( gitVersion[0] < gitNeededVersion ) { - console.log("ERROR: the version of git you have installed is out of date. Please update your installation of git and try again.") - process.exit() + console.log(''); + console.log("ERROR: the version of git you have installed is out of date. Please update your installation of git and try again."); + console.log(''); + process.exit(); } - } catch (error) { console.log(''); From 6eb87458972cd742a9617be92842bd3d9d3185c6 Mon Sep 17 00:00:00 2001 From: Brenden Harrell Date: Fri, 18 Jun 2021 10:58:57 -0500 Subject: [PATCH 3/6] remove unused os module --- Launch-Scripts/system-check.js | 1 - 1 file changed, 1 deletion(-) diff --git a/Launch-Scripts/system-check.js b/Launch-Scripts/system-check.js index 6d0aa63e1..9870c63f4 100644 --- a/Launch-Scripts/system-check.js +++ b/Launch-Scripts/system-check.js @@ -1,5 +1,4 @@ const { execSync } = require("child_process"); -const os = require("os"); const npmNeededVersion = '5' const nodeNeededVersion = '12' From 6357611caa0f42e3bdd548ce14d068211969a01c Mon Sep 17 00:00:00 2001 From: Brenden Harrell Date: Fri, 18 Jun 2021 11:03:10 -0500 Subject: [PATCH 4/6] More verbose error message --- run.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/run.js b/run.js index 3ad96de94..55353f22c 100644 --- a/run.js +++ b/run.js @@ -96,7 +96,7 @@ if ( fs.existsSync(path) ) { } } else { console.log('') - console.log('ERROR: node_modules does not exist. Try running node setup to solve this issue. Then try again.') + console.log('ERROR: node_modules does not exist. Try running node setup to solve this issue. Then try again. You can finded detailed instructions for this in the ReadMe.') console.log('') } From 1164595d85f1a6df4ae3be4d206d239788779df7 Mon Sep 17 00:00:00 2001 From: Brenden Harrell Date: Fri, 18 Jun 2021 15:41:22 -0500 Subject: [PATCH 5/6] Shorten file name --- ...in-a-chart-001-combine-exchanges-in-a-chart-tutorial.json} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename Projects/Foundations/Schemas/Docs-Tutorials/{H/How/How-to-aggregate-data-from-different-Exchanges-in-the-same-Chart-/how-to-aggregate-data-from-different-exchanges-in-the-same-chart-001-how-to-combine-exchanges-in-a-chart-tutorial.json => A/aggregate-data-from-different-exchanges-in-a-chart/aggregate-data-from-different-exchanges-in-a-chart-001-combine-exchanges-in-a-chart-tutorial.json} (77%) diff --git a/Projects/Foundations/Schemas/Docs-Tutorials/H/How/How-to-aggregate-data-from-different-Exchanges-in-the-same-Chart-/how-to-aggregate-data-from-different-exchanges-in-the-same-chart-001-how-to-combine-exchanges-in-a-chart-tutorial.json b/Projects/Foundations/Schemas/Docs-Tutorials/A/aggregate-data-from-different-exchanges-in-a-chart/aggregate-data-from-different-exchanges-in-a-chart-001-combine-exchanges-in-a-chart-tutorial.json similarity index 77% rename from Projects/Foundations/Schemas/Docs-Tutorials/H/How/How-to-aggregate-data-from-different-Exchanges-in-the-same-Chart-/how-to-aggregate-data-from-different-exchanges-in-the-same-chart-001-how-to-combine-exchanges-in-a-chart-tutorial.json rename to Projects/Foundations/Schemas/Docs-Tutorials/A/aggregate-data-from-different-exchanges-in-a-chart/aggregate-data-from-different-exchanges-in-a-chart-001-combine-exchanges-in-a-chart-tutorial.json index 4f33607d8..2e9eb3a54 100644 --- a/Projects/Foundations/Schemas/Docs-Tutorials/H/How/How-to-aggregate-data-from-different-Exchanges-in-the-same-Chart-/how-to-aggregate-data-from-different-exchanges-in-the-same-chart-001-how-to-combine-exchanges-in-a-chart-tutorial.json +++ b/Projects/Foundations/Schemas/Docs-Tutorials/A/aggregate-data-from-different-exchanges-in-a-chart/aggregate-data-from-different-exchanges-in-a-chart-001-combine-exchanges-in-a-chart-tutorial.json @@ -1,7 +1,7 @@ { - "tutorial": "How to aggregate data from different Exchanges in the same Chart ", + "tutorial": "Aggregate data from different Exchanges in a Chart ", "pageNumber": "1", - "type": "How to combine Exchanges in a Chart Tutorial", + "type": "Combine Exchanges in a Chart Tutorial", "definition": { "text": "This Tutorial covers the process of pulling together the most diverse set of data: data from different exchanges! By the end of this tutorial you will be able to build charts almost impossible to find anywhere else.", "updated": 1617376996248 From aea3e978b0017d7c59871e5284259bdcff3ff681 Mon Sep 17 00:00:00 2001 From: B Harrell Date: Fri, 18 Jun 2021 21:17:24 -0500 Subject: [PATCH 6/6] add check for windows path --- Launch-Scripts/system-check.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Launch-Scripts/system-check.js b/Launch-Scripts/system-check.js index 9870c63f4..27ca73332 100644 --- a/Launch-Scripts/system-check.js +++ b/Launch-Scripts/system-check.js @@ -1,5 +1,7 @@ const { execSync } = require("child_process"); +const os = require("os"); +// Minimum versions required const npmNeededVersion = '5' const nodeNeededVersion = '12' const gitNeededVersion = '2' @@ -15,7 +17,7 @@ function systemCheck () { const nodeVersion = nodeVersionRaw.trim().substring(1).split('.') const gitVersion = gitVersionRaw.trim().split(' ')[2].split('.') - // Check needed versions against those that are installed + // Make sure update version of npm is installed if ( npmVersion[0] < npmNeededVersion ) { console.log(''); console.log("ERROR: the version of npm you have installed is out of date. Please update your installation of npm and try again."); @@ -23,6 +25,7 @@ function systemCheck () { process.exit(); } + // Make sure update version of node is installed if ( nodeVersion[0] < nodeNeededVersion ) { console.log(''); console.log("ERROR: the version of node you have installed is out of date. Please update your installation of node and try again."); @@ -30,12 +33,28 @@ function systemCheck () { process.exit(); } + // Make sure updated version of git is installed if ( gitVersion[0] < gitNeededVersion ) { console.log(''); console.log("ERROR: the version of git you have installed is out of date. Please update your installation of git and try again."); console.log(''); process.exit(); } + + // Check windows system + if (os.platform() == "win32") { + + // Verify C:\Windows\System32 is on the windows PATH + const path = execSync( "echo %PATH%",{ encoding: 'utf8',timeout: 30000 }) + let check = path.includes('System32') + if ( check === false ) { + console.log(''); + console.log("ERROR: it appears C:\\Windows\\System32 is missing from your PATH. Please add to your path and try again."); + console.log(''); + process.exit(); + } + + } } catch (error) { console.log('');