Merge pull request #1162 from harrellbm/develop

Add basic System check to node setup command
This commit is contained in:
Luis Fernando Molina authored and GitHub committed 2021-06-19 05:21:51 -04:00
commit 61a4311bb4
4 files changed
+76 -3

No files matched your search

+69
View File
@@ -0,0 +1,69 @@
const { execSync } = require("child_process");
const os = require("os");
// Minimum versions required
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('.')
// 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.");
console.log('');
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.");
console.log('');
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('');
console.log("There was an error with your system: ");
console.log('');
console.log( error );
return;
}
};
module.exports = systemCheck
@@ -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
+1 -1
View File
@@ -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('')
}
+4
View File
@@ -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")) {