2020-05-18 22:02:27 +02:00
|
|
|
const child_process = require("child_process")
|
2020-05-18 22:22:31 +02:00
|
|
|
const fs = require("fs")
|
2020-05-18 22:02:27 +02:00
|
|
|
const path = require("path")
|
2020-05-18 22:22:31 +02:00
|
|
|
|
2020-05-18 22:02:27 +02:00
|
|
|
const MODULES_DIRNAME = path.join(__dirname, "modules")
|
|
|
|
|
|
|
|
fs.readdirSync(MODULES_DIRNAME, {withFileTypes: true})
|
|
|
|
.forEach(e => {
|
|
|
|
if(!e.isDirectory())return
|
|
|
|
const MODULE_DIRNAME = path.join(MODULES_DIRNAME, e.name)
|
|
|
|
if(!fs.existsSync(path.join(MODULE_DIRNAME, "package.json")))return
|
|
|
|
if(e.name === "discord_spellcheck")return
|
|
|
|
|
|
|
|
console.log(`Installing modules in ${e.name}.`)
|
|
|
|
|
2020-05-19 00:02:16 +02:00
|
|
|
child_process.spawn((process.platform === "win32" ? "npm.cmd" : "npm"), ["i"], {
|
2020-05-18 22:02:27 +02:00
|
|
|
cwd: MODULE_DIRNAME,
|
2020-05-19 00:02:16 +02:00
|
|
|
env: process.env,
|
|
|
|
stdio: "inherit"
|
|
|
|
}).on("error", (err) => {
|
|
|
|
console.error(err)
|
|
|
|
process.exit(1)
|
|
|
|
})
|
2020-05-18 22:22:31 +02:00
|
|
|
})
|
2020-05-18 22:02:27 +02:00
|
|
|
|
|
|
|
|
|
|
|
const MODULE_DIRNAME = path.join(__dirname, "modules", "discord_desktop_core", "core")
|
2020-05-18 22:22:31 +02:00
|
|
|
const BETTERDISCORD_DIRNAME = path.join(__dirname, "BetterDiscordApp")
|
2020-05-21 01:40:58 +02:00
|
|
|
const DISCORDJS_DIRNAME = path.join(__dirname, "BetterDiscordApp")
|
2020-05-18 22:22:31 +02:00
|
|
|
|
2020-05-18 22:02:27 +02:00
|
|
|
child_process.spawn((process.platform === "win32" ? "npm.cmd" : "npm"), ["i"], {
|
|
|
|
cwd: MODULE_DIRNAME,
|
|
|
|
env: process.env,
|
|
|
|
stdio: "inherit"
|
|
|
|
}).on("error", (err) => {
|
|
|
|
console.error(err)
|
|
|
|
process.exit(1)
|
2020-05-18 22:22:31 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
child_process.spawn((process.platform === "win32" ? "npm.cmd" : "npm"), ["i"], {
|
|
|
|
cwd: BETTERDISCORD_DIRNAME,
|
|
|
|
env: process.env,
|
|
|
|
stdio: "inherit"
|
|
|
|
}).on("error", (err) => {
|
|
|
|
console.error(err)
|
|
|
|
process.exit(1)
|
|
|
|
})
|
2020-05-21 01:40:58 +02:00
|
|
|
|
|
|
|
|
|
|
|
child_process.spawn((process.platform === "win32" ? "npm.cmd" : "npm"), ["i"], {
|
|
|
|
cwd: DISCORDJS_DIRNAME,
|
|
|
|
env: process.env,
|
|
|
|
stdio: "inherit"
|
|
|
|
})
|