This repository was archived by the owner on Jun 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathflow.js
More file actions
39 lines (35 loc) · 1.61 KB
/
flow.js
File metadata and controls
39 lines (35 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
var join = require("path").join
var childProcess = require("child_process")
function install(moduleName) {
console.log(`Installation of the module: ${moduleName}`)
childProcess.execSync("npm install", { cwd: join(__dirname, moduleName), env: childProcess.env, stdio: "inherit" })
}
function remove(moduleName) {
console.log(`Removing of the module: ${moduleName}`)
if (/^win/i.test(process.platform)) {
try {
childProcess.execSync("powershell -Command \"Remove-Item 'node_modules' -Recurse -Force -ErrorAction Ignore\"", { cwd: join(__dirname, moduleName), env: childProcess.env, stdio: "inherit" })
} catch (e) { }
try {
childProcess.execSync("powershell -Command \"Remove-Item 'package-lock.json' -Recurse -Force -ErrorAction Ignore\"", { cwd: join(__dirname, moduleName), env: childProcess.env, stdio: "inherit" })
} catch (e) { }
} else {
childProcess.execSync("rm -rf node_modules", { cwd: join(__dirname, moduleName), env: childProcess.env, stdio: "inherit" })
childProcess.execSync("rm -f package-lock.json", { cwd: join(__dirname, moduleName), env: childProcess.env, stdio: "inherit" })
}
}
const modules = ["Common", "Server", "Device"]
switch (process.argv[2]) {
case "--install-all":
modules.forEach((moduleName) => { install(moduleName) })
break
case "--uninstall-all":
modules.forEach((moduleName) => { remove(moduleName) })
break
case "--reinstall-all":
modules.forEach((moduleName) => {
remove(moduleName)
install(moduleName)
})
break
}