Merge pull request #968 from harrellbm/develop
Unified Shortcut/Uninstall Scripts and Doc Updates
This commit is contained in:
10 files changed
+298
-172
No files matched your search
@@ -1,26 +0,0 @@
|
||||
#!/bin/sh
|
||||
PWD=`pwd`
|
||||
DIR=${PWD%/*}
|
||||
|
||||
touch Superalgos.desktop
|
||||
|
||||
echo "[Desktop Entry]
|
||||
Type=Application
|
||||
Encoding=UTF-8
|
||||
Name=Superalgos
|
||||
Comment=Launch Shortcut for Superalgos
|
||||
Path=$PWD
|
||||
Exec=gnome-terminal -e $PWD/launch-linux.sh
|
||||
Terminal=true
|
||||
Icon=$DIR/Projects/Superalgos/Icons/superalgos.png
|
||||
Categories=Application;" > Superalgos.desktop
|
||||
|
||||
chmod +x Superalgos.desktop
|
||||
|
||||
cp Superalgos.desktop ~/Desktop/Superalgos.desktop
|
||||
cp Superalgos.desktop ~/.local/share/applications/Superalgos.desktop
|
||||
|
||||
rm Superalgos.desktop
|
||||
|
||||
# Keep terminal open for debugging
|
||||
#$SHELL
|
||||
@@ -1,12 +0,0 @@
|
||||
set TARGET='%CD%\launch-windows.bat'
|
||||
set SHORTCUT='%USERPROFILE%\Desktop\Superalgos.lnk'
|
||||
set STARTMENU='%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Superalgos.lnk'
|
||||
set ICON='%CD%\superalgos.ico'
|
||||
set PWS=powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile
|
||||
|
||||
%PWS% -Command "$ws = New-Object -ComObject WScript.Shell; $s = $ws.CreateShortcut(%SHORTCUT%); $S.TargetPath = %Target%; $S.IconLocation = %ICON%; $S.Save()"
|
||||
|
||||
%PWS% -Command "$ws = New-Object -ComObject WScript.Shell; $s = $ws.CreateShortcut(%STARTMENU%); $S.TargetPath = %Target%; $S.IconLocation = %ICON%; $S.Save()"
|
||||
|
||||
REM Keep terminal open for debug
|
||||
REM cmd /k echo "keep open"
|
||||
@@ -0,0 +1,100 @@
|
||||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
const { exec } = require("child_process");
|
||||
const os = require("os");
|
||||
|
||||
// Get the name of the main directory
|
||||
let cwd = __dirname;
|
||||
let dirs = cwd.split(path.sep);
|
||||
let name = dirs[dirs.length - 2];
|
||||
|
||||
// Windows Shortcuts
|
||||
if (os.platform() == "win32") {
|
||||
// Paths and Icon for Windows shortcuts
|
||||
let target = path.join( __dirname, "launch-windows.bat");
|
||||
let icon = path.join( __dirname, "superalgos.ico");
|
||||
let shortcutPaths = [
|
||||
path.join( os.homedir(), "Desktop", `${name}.lnk`),
|
||||
path.join( os.homedir(), "AppData", "Roaming", "Microsoft", "Windows", "Start Menu", "Programs", `${name}.lnk`)
|
||||
]
|
||||
|
||||
// Place Shortcuts using powershell
|
||||
for (let dir of shortcutPaths) {
|
||||
let command = `$ws = New-Object -ComObject WScript.Shell; $s = $ws.CreateShortcut("${dir}"); $S.TargetPath = "${target}"; $S.IconLocation = "${icon}"; $S.Save()`;
|
||||
|
||||
exec( command,
|
||||
{
|
||||
shell: "powershell.exe",
|
||||
execArgv: "-ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -Command"
|
||||
},
|
||||
function ( error, stdout){
|
||||
if (error) {
|
||||
console.log('');
|
||||
console.log("There was an error installing a shortcut: ");
|
||||
console.log('');
|
||||
console.log( error );
|
||||
return;
|
||||
} else {
|
||||
console.log('');
|
||||
console.log("Shortcut added successfully!");
|
||||
console.log('');
|
||||
console.log(stdout);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// Linux Shortcuts
|
||||
} else if (os.platform() == "linux") {
|
||||
// Check for Ubuntu
|
||||
let version = os.version();
|
||||
if (version.includes("Ubuntu")) {
|
||||
// Paths and Icon for Ubuntu shortcuts
|
||||
let icon = path.join( __dirname,"..", "/Projects/Superalgos/Icons/superalgos.png");
|
||||
|
||||
// Create .desktop shortcut file
|
||||
fs.writeFileSync( `${name}.desktop`,
|
||||
`[Desktop Entry]
|
||||
Type=Application
|
||||
Encoding=UTF-8
|
||||
Name=${name}
|
||||
Comment=Launch Shortcut for Superalgos
|
||||
Path=${__dirname}
|
||||
Exec=gnome-terminal -e ${__dirname}/launch-linux-mac.sh
|
||||
Terminal=true
|
||||
Icon=${icon}
|
||||
Categories=Application;`,
|
||||
);
|
||||
|
||||
// Set shortcut as executable
|
||||
fs.chmodSync( `${name}.desktop`, "775" );
|
||||
|
||||
// Place shortcut in proper folders
|
||||
let command = `cp ${name}.desktop ~/Desktop/${name}.desktop & cp ${name}.desktop ~/.local/share/applications/${name}.desktop`
|
||||
exec( command,
|
||||
function ( error, stdout ){
|
||||
if (error) {
|
||||
console.log('');
|
||||
console.log("There was an error installing a shortcut: ");
|
||||
console.log('');
|
||||
console.log( error );
|
||||
return;
|
||||
} else {
|
||||
console.log('');
|
||||
console.log("Shortcuts added successfully!");
|
||||
}
|
||||
// Remove temporary .desktop file
|
||||
fs.unlinkSync( `${name}.desktop` )
|
||||
});
|
||||
|
||||
} else {
|
||||
console.log( "Automatic shortcut creation is not yet supported on your flavor of linux. If you would like to see this feature add, message @harrellbm on telegram or discord to ask how you can help!")
|
||||
}
|
||||
|
||||
// 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!")
|
||||
|
||||
// Misc Operating System
|
||||
} else {
|
||||
console.log("Automatic shortcut creation is not currently supported on your operating system. If you would like to see your operating system added please reachout on discord or telegram to let the devs know.")
|
||||
}
|
||||
Executable
+4
@@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
cd ..
|
||||
node run
|
||||
"$SHELL"
|
||||
@@ -1 +0,0 @@
|
||||
x-terminal-emulator -e "cd .. && node run && $SHELL"
|
||||
@@ -1,5 +0,0 @@
|
||||
del "%USERPROFILE%\Desktop\Superalgos.lnk"
|
||||
del "%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Superalgos.lnk"
|
||||
|
||||
REM Keep terminal open for debug
|
||||
REM cmd /k echo "keep open"
|
||||
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"topic": "Launch Scripts",
|
||||
"pageNumber": "1",
|
||||
"type": "Launch Scripts",
|
||||
"type": "Launch Scripts and Shortcuts",
|
||||
"definition": {
|
||||
"text": "There are a number of scripts to help make lauching Superalgos easier and feel more native. The eventual goal is to make Superalgos feel like any other program installed on an operating system.",
|
||||
"updated": 1620052836275
|
||||
"text": "There are a number of scripts to help make launching Superalgos easier and feel more native. The eventual goal is to make Superalgos feel like any other program installed on an operating system.",
|
||||
"updated": 1621801562983
|
||||
},
|
||||
"paragraphs": [
|
||||
{
|
||||
@@ -24,8 +24,8 @@
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "Due to the nature of scripts, there are different scripts for each type of operating system. The following page includes a description of each script and what it accomplishes.",
|
||||
"updated": 1620052862888
|
||||
"text": "The following page includes a description of each script and what it accomplishes.",
|
||||
"updated": 1621801618461
|
||||
},
|
||||
{
|
||||
"style": "Note",
|
||||
@@ -55,24 +55,18 @@
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Linux"
|
||||
"text": "Linux and Mac",
|
||||
"updated": 1621801647118
|
||||
},
|
||||
{
|
||||
"style": "Json",
|
||||
"text": "launch-linux.sh"
|
||||
"text": "launch-linux-mac.sh",
|
||||
"updated": 1621801639324
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "This script uses the x-terminal-emulator command for maximum compatiblity across linux flavors."
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Mac"
|
||||
},
|
||||
{
|
||||
"style": "Important",
|
||||
"text": "Collaborator needed.",
|
||||
"updated": 1620052924921
|
||||
"text": "This script uses basic shell commands to be compatible with both Linux and OSX systems.",
|
||||
"updated": 1621801760692
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
@@ -80,58 +74,90 @@
|
||||
},
|
||||
{
|
||||
"style": "Title",
|
||||
"text": "Desktop/Launcher Shortcut Scripts",
|
||||
"updated": 1620052680945
|
||||
"text": "Create Desktop/Launcher Shortcuts",
|
||||
"updated": 1621802101953
|
||||
},
|
||||
{
|
||||
"style": "Json",
|
||||
"text": "create-shortcut.js",
|
||||
"updated": 1621802056957
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "These scripts automatically create and place shortcuts to the launch scripts. They can be run from the command line or file browser.",
|
||||
"updated": 1620504518909
|
||||
"text": "There is one unifed script to automatically create and place shortcuts to the appropriate launch script. This script is automatically run during the \"node setup\" command. It can also be run individual as follows.",
|
||||
"updated": 1621802202684
|
||||
},
|
||||
{
|
||||
"style": "Callout",
|
||||
"text": "In a terminal or command prompt, navigate to the Launch-Scripts file and type:",
|
||||
"updated": 1621802248464
|
||||
},
|
||||
{
|
||||
"style": "Json",
|
||||
"text": "node create-shortcut"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "This will place shortcuts within your Start Menu/Launcher as well as on your Desktop. In Windows the start menu shortcut is also searchable using the start menu search bar.",
|
||||
"updated": 1621802356143
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Shortcut Locations"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "Depending on your operating system, shortcuts will be placed within different directories. Listed below are the locations by operating system.",
|
||||
"updated": 1621802761147
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "Windows"
|
||||
},
|
||||
{
|
||||
"style": "Json",
|
||||
"text": "create-shortcut-windows.bat",
|
||||
"updated": 1620053219653
|
||||
"style": "List",
|
||||
"text": "Users\\[Your Name]\\Desktop"
|
||||
},
|
||||
{
|
||||
"style": "List",
|
||||
"text": "Users\\[Your Name]\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs",
|
||||
"updated": 1621802654652
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "This script places shortcuts within the user's start menu and desktop. The start menu shortcut is also searchable using the start menu search bar.",
|
||||
"updated": 1620789169171
|
||||
"text": "Ubuntu"
|
||||
},
|
||||
{
|
||||
"style": "List",
|
||||
"text": "~/Desktop",
|
||||
"updated": 1621803704659
|
||||
},
|
||||
{
|
||||
"style": "List",
|
||||
"text": "~/.local/share/applications",
|
||||
"updated": 1621803711854
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "Mac"
|
||||
},
|
||||
{
|
||||
"style": "Important",
|
||||
"text": "Currently unhandled collaborator needed.",
|
||||
"updated": 1621802848597
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Ubuntu",
|
||||
"updated": 1620053330166
|
||||
},
|
||||
{
|
||||
"style": "Json",
|
||||
"text": "create-shortcut-ubuntu.sh",
|
||||
"updated": 1620504490683
|
||||
"text": "Additional set up needed on Ubuntu",
|
||||
"updated": 1621802397032
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "This script places shortcuts within the user's launcher and desktop. Shortcuts are placed in the following locations:",
|
||||
"updated": 1620504828523
|
||||
"text": "Most shortcuts will work out of the box. Ubuntu desktop shortcuts, however, take a few additional steps to set up. The following section will walk you through these steps.",
|
||||
"updated": 1621802969207
|
||||
},
|
||||
{
|
||||
"style": "List",
|
||||
"text": "~/Desktop/Superalgos.desktop"
|
||||
},
|
||||
{
|
||||
"style": "List",
|
||||
"text": "~/.local/share/applications/Superalgos.desktop"
|
||||
},
|
||||
{
|
||||
"style": "Note",
|
||||
"text": "After running create-shortcut-ubuntu.sh the launcher shortcut will work out of the box. There are a few additional steps to set up the desktop shortcut. The following section will walk you through these steps.",
|
||||
"updated": 1620505700097
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"style": "Callout",
|
||||
"text": "First, desktop icons need to be enabled within the Tweaks app.",
|
||||
"updated": 1620505123531
|
||||
},
|
||||
@@ -157,7 +183,8 @@
|
||||
},
|
||||
{
|
||||
"style": "List",
|
||||
"text": "Under extensions turn on Desktop Icons"
|
||||
"text": "Under extensions turn on Desktop Icons.",
|
||||
"updated": 1621803788239
|
||||
},
|
||||
{
|
||||
"style": "Gif",
|
||||
@@ -169,7 +196,7 @@
|
||||
"updated": 1620505754854
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"style": "Callout",
|
||||
"text": "Finally, you will need to enable the desktop shortcut.",
|
||||
"updated": 1620505790748
|
||||
},
|
||||
@@ -183,49 +210,19 @@
|
||||
"text": "GIFs/Superalgos/Docs/launch-scripts/allow-launching.gif",
|
||||
"updated": 1620505894840
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Mac"
|
||||
},
|
||||
{
|
||||
"style": "Important",
|
||||
"text": "Collaborator needed."
|
||||
},
|
||||
{
|
||||
"style": "Title",
|
||||
"text": "Uninstall Shortcuts",
|
||||
"updated": 1620789208012
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Windows",
|
||||
"updated": 1620789368194
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "Open a file browser and navigate to the Superalgos directory."
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "Under the folder titled Launch-Scripts double-click the script:",
|
||||
"updated": 1620789459938
|
||||
"text": "There is one unifed script to automatically uninstall shortcuts. To ese it open a command prompt or terminal. Then navigate to your Superalgos directory and type the following command:",
|
||||
"updated": 1621804036052
|
||||
},
|
||||
{
|
||||
"style": "Json",
|
||||
"text": "uninstall-shortcut-windows.bat",
|
||||
"updated": 1620789508304
|
||||
},
|
||||
{
|
||||
"style": "Subtitle",
|
||||
"text": "Ubuntu"
|
||||
},
|
||||
{
|
||||
"style": "Text",
|
||||
"text": "Open a terminal and run the following command:"
|
||||
},
|
||||
{
|
||||
"style": "Javascript",
|
||||
"text": "rm ~/Desktop/Superalgos.desktop && rm ~/.local/share/applications/Superalgos.desktop"
|
||||
"text": "node uninstall"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -47,7 +47,7 @@ It is also required to install the Node Package Manager for dependancy managemen
|
||||
```
|
||||
sudo apt install npm
|
||||
```
|
||||
You may also type the following to verify the Node.js and NPM installation and version.
|
||||
You may also type the following to verify Node.js and NPM installation and version.
|
||||
```
|
||||
node -v
|
||||
```
|
||||
@@ -134,12 +134,26 @@ node setup
|
||||
|
||||
Then wait until you are able to type within the terminal again.
|
||||
|
||||
This command will install and configure all additional dependencies needed by Superalgos.
|
||||
This command will install and configure all additional dependencies needed by Superalgos. It will also install desktop and start menu shortcuts.
|
||||
|
||||
**NOTE FOR USERS INSTALLING MULTIPLE INSTANCES OF SUPERALGOS ON THE SAME MACHINE:** In order to avoid name conflicts between shortcuts, make sure to rename your main directory before running `node setup`.
|
||||
|
||||
Congratulations your installation is complete!
|
||||
|
||||
> **The Usage section below explains how to run the app.**
|
||||
|
||||
<hr>
|
||||
|
||||
**DEPENDENCY INSTALLATION FOR RASPBERRY PI USERS**
|
||||
|
||||
As noted above, running `node setup` installs GUI shortcuts by default. To suppress this behavior in headless installations, add the `noShortcuts` flag as follows:
|
||||
|
||||
```
|
||||
node setup noShortcuts
|
||||
```
|
||||
|
||||
<hr>
|
||||
|
||||
## 4. Installation Notes
|
||||
|
||||
**A.** You need to make a fork so that you may contribute work. Superalgos is a Community project and you are expected to contribute, like everyone else. You don't need to be a technical person to contribute. Fixing a typo in the docs or translating a paragraph into your native language are valuable contributions too. Superalgos has built-in features that make contributing easy. Help make Superalgos better and Superalgos will better serve you! [Free-riding is not cool](https://en.wikipedia.org/wiki/Free-rider_problem), particularly on free, open-source, Community-driven projects.
|
||||
@@ -162,8 +176,14 @@ Congratulations your installation is complete!
|
||||
```
|
||||
node setup
|
||||
```
|
||||
Then wait until you are able to type within the terminal again.
|
||||
|
||||
**NOTE FOR USERS RUNNING IN HEADLESS ENVIRONMENT:** You will need to add the `noShortcuts` flag while running `node setup` to suppress installing GUI shortcuts. To do this type:
|
||||
|
||||
```
|
||||
node setup noShortcuts
|
||||
```
|
||||
|
||||
Then wait until you are able to type within the terminal again.
|
||||
|
||||
### Refactorings
|
||||
|
||||
@@ -198,31 +218,13 @@ then
|
||||
node run minMemo noBrowser
|
||||
```
|
||||
|
||||
## 2. Add a Desktop/Launcher Shortcut for Superalgos
|
||||
In addition, you may use any of the automatically installed desktop and start menu shortcuts to launch Superalgos.
|
||||
|
||||
There are a number of scripts available to help make lauching Superalgos easier and feel more native. To use these scripts, follow the steps for your operating system.
|
||||
**NOTE:** Shortcuts are not currently supported on Mac. Collaborators are needed to finish this feature.
|
||||
|
||||
## For **Windows** Users
|
||||
**B.** Enable Desktop Shortcut on Ubuntu
|
||||
|
||||
Open a file browser and navigate to the Superalgos Directory.
|
||||
|
||||
Under the folder titled `Launch-Scripts` double-click the script `create-shortcut-windows.bat`.
|
||||
|
||||
After running this script there will be two shortcuts added. One to your start menu and one to your desktop. You can now lauch Superalgos from any of these shortcuts, or search `Superalgos` in the start menu search bar.
|
||||
|
||||
## For **Ubuntu** Users
|
||||
|
||||
Open a terminal and run the following commands:
|
||||
```
|
||||
cd Superalgos/Launch-Scripts
|
||||
```
|
||||
```
|
||||
bash create-shortcut-ubuntu.sh
|
||||
```
|
||||
|
||||
After running these commands there will be two shortcuts added. One to your launcher and one to your desktop. The launcher shortcut will work out of the box. The desktop shortcut, however, requires a few additional steps to set up. The following section will walk you through these steps.
|
||||
|
||||
**A.** Enable Desktop Shortcut
|
||||
The majority of shortcuts that are automatically installed will work out of the box. Desktop shortcuts on Ubuntu, however, require a few additional steps to set up.
|
||||
|
||||
First, desktop icons need to be enabled within the Tweaks app.
|
||||
* Check if Tweaks is installed.
|
||||
@@ -240,7 +242,7 @@ Finally, you will need to enable the desktop shortcut.
|
||||
|
||||

|
||||
|
||||
Now both shortcuts will launch Superalgos like any other program on your computer.
|
||||
Now both launcher and desktop shortcuts will launch Superalgos like any other program on your computer.
|
||||
|
||||
## 3. Usage Notes
|
||||
|
||||
@@ -291,22 +293,15 @@ journalctl -u superalgos -f
|
||||
|
||||
# Uninstall
|
||||
|
||||
Superalgos writes nothing outside of the ```Superalgos``` folder. To completely uninstall the software, just delete the folder.
|
||||
Superalgos writes nothing outside of the ```Superalgos``` folder other than shortcut files. To uninstall the software, follow these steps:
|
||||
|
||||
If you have installed shortcuts for Superalgos you can remove them as follows:
|
||||
|
||||
## For **Windows** Users
|
||||
|
||||
Open a file browser and navigate to the Superalgos directory.
|
||||
|
||||
Under the folder titled `Launch-Scripts` double-click the script `uninstall-shortcut-windows.bat`.
|
||||
|
||||
## For **Ubuntu** Users
|
||||
|
||||
Open a terminal and run the following command:
|
||||
Open a terminal or command prompt and navigate to your main Superalgos directory and type the following command:
|
||||
```
|
||||
rm ~/Desktop/Superalgos.desktop && rm ~/.local/share/applications/Superalgos.desktop
|
||||
node uninstall
|
||||
```
|
||||
This will remove any shortcut files that have been installed.
|
||||
|
||||
Then simply delete the `Superalgos` folder. There will be nothing left on your computor.
|
||||
|
||||
# Welcome Tutorial
|
||||
|
||||
|
||||
@@ -2,6 +2,25 @@ const path = require("path");
|
||||
const process = require("process");
|
||||
const { exec } = require("child_process");
|
||||
|
||||
// Handle adding shortcuts
|
||||
if (process.argv.includes("noShortcuts")) {
|
||||
// Cancel running script if flag provided
|
||||
console.log('');
|
||||
console.log('noShortcuts ................................................... Setting up without shortcuts.')
|
||||
|
||||
} else {
|
||||
// Run create-shortcuts script
|
||||
try {
|
||||
const { fork } = require('child_process')
|
||||
fork('./Launch-Scripts/create-shortcut.js')
|
||||
} catch (err) {
|
||||
console.log('')
|
||||
console.log(err)
|
||||
console.log('')
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Create Operating System compatable paths to each node_modules directory.
|
||||
let nodeModulesDirs = [
|
||||
path.join( process.cwd(), "Client"),
|
||||
@@ -18,14 +37,12 @@ console.log('');
|
||||
console.log(nodeModulesDirs);
|
||||
console.log('');
|
||||
|
||||
|
||||
let dir;
|
||||
for (dir in nodeModulesDirs) {
|
||||
for (let dir of nodeModulesDirs) {
|
||||
// Loop through directories and run npm ci in a child process shell.
|
||||
let command = "echo Results of install at "+ nodeModulesDirs[dir] + " & npm ci";
|
||||
let command = "echo Results of install at "+ dir + " & npm ci";
|
||||
exec( command,
|
||||
{
|
||||
cwd: nodeModulesDirs[dir]
|
||||
cwd: dir
|
||||
},
|
||||
function ( error, stdout ){
|
||||
if (error) {
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
const path = require("path");
|
||||
const os = require("os");
|
||||
const { exec } = require("child_process");
|
||||
|
||||
// Get the name of the main directory
|
||||
let cwd = __dirname;
|
||||
let dirs = cwd.split(path.sep);
|
||||
let name = dirs[dirs.length - 1];
|
||||
|
||||
// Remove Windows Shortcuts
|
||||
if (os.platform() == "win32") {
|
||||
let desktop = path.join( os.homedir(), "Desktop", `${name}.lnk`)
|
||||
let startMenu = path.join( os.homedir(), "AppData", "Roaming", "Microsoft", "Windows", "Start Menu", "Programs", `${name}.lnk`)
|
||||
|
||||
// Remove .desktop files
|
||||
let command = `del "${desktop}" & del "${startMenu}"`
|
||||
exec( command,
|
||||
function ( error ){
|
||||
if (error) {
|
||||
console.log('');
|
||||
console.log("There was an error uninstalling shortcuts: ");
|
||||
console.log('');
|
||||
console.log( error );
|
||||
return;
|
||||
} else {
|
||||
console.log('');
|
||||
console.log("Shortcuts have been uninstalled successfully.");
|
||||
}
|
||||
});
|
||||
|
||||
// Remove Linux Shortcuts
|
||||
} else if (os.platform() == "linux") {
|
||||
// Check for Ubuntu
|
||||
let version = os.version();
|
||||
if (version.includes("Ubuntu")) {
|
||||
|
||||
// Remove .desktop files
|
||||
let command = `rm ~/Desktop/${name}.desktop & rm ~/.local/share/applications/${name}.desktop`
|
||||
exec( command,
|
||||
function ( error, stdout ){
|
||||
if (error) {
|
||||
console.log('');
|
||||
console.log("There was an error uninstalling shortcuts: ");
|
||||
console.log('');
|
||||
console.log( error );
|
||||
return;
|
||||
} else {
|
||||
console.log('');
|
||||
console.log("Shortcuts have been uninstalled successfully.");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Mac Shortcuts
|
||||
} else if (os.platform() == "darwin") {
|
||||
// Uninstall Mac shortcuts here once they have been added.
|
||||
}
|
||||
Reference in new issue
Block a user