feat: stop-backend.js and update.js linux support (#712)

* chore(dependabot.yml): update target-branch from "develop" to "dev" for npm package updates in /api, /client, and root directory

* feat: stop-backend.js and update.js linux support (#701)

* feat: stop-backend.js and update.js linux support

* feat: update.js sudo support

* chore(helpers.js): add deleteNodeModules function
feat(packages.js): add script to delete node_modules and install dependencies
refactor(update.js): remove unnecessary imports and use deleteNodeModules function
feat(package.json): add update:linux script to update with sudo

* chore(package.json): rename 'update:linux'  script to 'update:sudo'

* refactor(update.js): simplify downCommand and buildCommand by removing redundant use of sudo command, add sudo to single docker command

---------

Co-authored-by: Fuegovic <32828263+fuegovic@users.noreply.github.com>
This commit is contained in:
Danny Avila 2023-07-27 11:11:56 -04:00 committed by GitHub
parent d59a3f20cb
commit 777d64088b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 80 additions and 20 deletions

View file

@ -2,6 +2,8 @@
* Helper functions
* This allows us to give the console some colour when running in a terminal
*/
const fs = require('fs');
const path = require('path');
const readline = require('readline');
const { execSync } = require('child_process');
@ -28,6 +30,14 @@ function isDockerRunning() {
}
}
function deleteNodeModules(dir) {
const nodeModulesPath = path.join(dir, 'node_modules');
if (fs.existsSync(nodeModulesPath)) {
console.purple(`Deleting node_modules in ${dir}`);
fs.rmdirSync(nodeModulesPath, { recursive: true });
}
}
const silentExit = (code = 0) => {
console.log = () => {};
process.exit(code);
@ -48,4 +58,5 @@ module.exports = {
askQuestion,
silentExit,
isDockerRunning,
deleteNodeModules,
};