Merge Develop into Master

This commit is contained in:
Luis Fernando Molina committed 2021-08-05 13:07:45 +02:00
1 parent 2d7ed1d085
commit 2bb78c50fb
4223 files changed
+1207152 -16544

No files matched your search

+41 -3
View File
@@ -1,6 +1,6 @@
const path = require("path");
const fs = require("fs");
const { exec } = require("child_process");
const { exec, execSync } = require("child_process");
const os = require("os");
// Get the name of the main directory
@@ -49,7 +49,7 @@ if (os.platform() == "win32") {
let version = os.version();
if (version.includes("Ubuntu")) {
// Paths and Icon for Ubuntu shortcuts
let icon = path.join( __dirname,"..", "/Projects/Superalgos/Icons/superalgos.png");
let icon = path.join( __dirname,"..", "/Projects/Foundations/Icons/superalgos.png");
// Create .desktop shortcut file
fs.writeFileSync( `${name}.desktop`,
@@ -92,7 +92,45 @@ if (os.platform() == "win32") {
// Mac Shortcuts
} else if (os.platform() == "darwin") {
console.log( "Automatic shortcut creation is not yet supported on Mac. If you would like to see this feature add, message @harrellbm on telegram or discord to ask how you can help!")
const icon = path.join( __dirname,"/superalgos.ico");
const createShortcutCommand = `chmod +x ${name}.command & cp ${name}.command ~/Desktop/${name}.command`
const installFileIconcommand = `npm install fileicon`;
const changeIconCommand = `./node_modules/fileicon/bin/fileicon set ~/Desktop/${name}.command ./Launch-Scripts/superalgos.ico`
const unInstallFileIconcommand = `npm uninstall fileicon`;
try {
// Create .desktop shortcut file
fs.writeFileSync( `${name}.command`,
`#!/bin/sh
cd ${__dirname}
cd ..
node run
"$SHELL"`,
);
// Place shortcut in proper folders
execSync( createShortcutCommand,{ timeout: 30000})
// Remove temporary .command file
fs.unlinkSync( `${name}.command` )
//Install fileicon utility
execSync(installFileIconcommand, {stdio: 'inherit', timeout: 30000});
//change Icon
execSync(changeIconCommand, {stdio: 'inherit', timeout: 30000});
//Un-Install fileicon utility
execSync(unInstallFileIconcommand, {stdio: 'inherit', timeout: 30000});
} catch (error) {
console.log('');
console.log("There was an error installing a shortcut: ");
console.log('');
console.log( error );
return;
}
console.log("Shortcuts added successfully!");
// Misc Operating System
} else {
+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