git updater: Fix macOS (#391)

Co-authored-by: Ven <vendicated@riseup.net>
This commit is contained in:
Dominik 2023-01-13 23:24:51 +01:00 committed by GitHub
parent 32cdb63885
commit 6329499b1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

1
.gitignore vendored

@ -5,6 +5,7 @@ node_modules
vencord_installer vencord_installer
.idea .idea
.DS_Store
yarn.lock yarn.lock
package-lock.json package-lock.json

@ -30,6 +30,8 @@ const execFile = promisify(cpExecFile);
const isFlatpak = Boolean(process.env.FLATPAK_ID?.includes("discordapp") || process.env.FLATPAK_ID?.includes("Discord")); const isFlatpak = Boolean(process.env.FLATPAK_ID?.includes("discordapp") || process.env.FLATPAK_ID?.includes("Discord"));
if (process.platform === "darwin") process.env.PATH = `/usr/local/bin:${process.env.PATH}`;
function git(...args: string[]) { function git(...args: string[]) {
const opts = { cwd: VENCORD_SRC_DIR }; const opts = { cwd: VENCORD_SRC_DIR };
@ -66,10 +68,10 @@ async function pull() {
async function build() { async function build() {
const opts = { cwd: VENCORD_SRC_DIR }; const opts = { cwd: VENCORD_SRC_DIR };
let res; const command = isFlatpak ? "flatpak-spawn" : "node";
const args = isFlatpak ? ["--host", "node", "scripts/build/build.mjs"] : ["scripts/build/build.mjs"];
if (isFlatpak) res = await execFile("flatpak-spawn", ["--host", "node", "scripts/build/build.mjs"], opts); const res = await execFile(command, args, opts);
else res = await execFile("node", ["scripts/build/build.mjs"], opts);
return !res.stderr.includes("Build failed"); return !res.stderr.includes("Build failed");
} }