fix pnpm inject on local builds (#696)
This commit is contained in:
parent
d69256fb4d
commit
11a630a3c6
1 changed files with 11 additions and 11 deletions
|
|
@ -27,6 +27,7 @@ import { fileURLToPath } from "url";
|
|||
|
||||
const BASE_URL = "https://github.com/Equicord/Equilotl/releases/latest/download/";
|
||||
const INSTALLER_PATH_DARWIN = "Equilotl.app/Contents/MacOS/Equilotl";
|
||||
const INSTALLER_APP_DARWIN = "Equilotl.app";
|
||||
|
||||
const BASE_DIR = join(dirname(fileURLToPath(import.meta.url)), "..");
|
||||
const FILE_DIR = join(BASE_DIR, "dist", "Installer");
|
||||
|
|
@ -53,8 +54,11 @@ async function ensureBinary() {
|
|||
|
||||
const downloadName = join(FILE_DIR, filename);
|
||||
const outputFile = process.platform === "darwin"
|
||||
? join(FILE_DIR, "Equilotl")
|
||||
? join(FILE_DIR, INSTALLER_PATH_DARWIN)
|
||||
: downloadName;
|
||||
const outputApp = process.platform === "darwin"
|
||||
? join(FILE_DIR, INSTALLER_APP_DARWIN)
|
||||
: null;
|
||||
|
||||
const etag = existsSync(outputFile) && existsSync(ETAG_FILE)
|
||||
? readFileSync(ETAG_FILE, "utf-8")
|
||||
|
|
@ -77,17 +81,14 @@ async function ensureBinary() {
|
|||
writeFileSync(ETAG_FILE, res.headers.get("etag"));
|
||||
|
||||
if (process.platform === "darwin") {
|
||||
console.log("Unzipping...");
|
||||
console.log("Saving zip...");
|
||||
const zip = new Uint8Array(await res.arrayBuffer());
|
||||
writeFileSync(downloadName, zip);
|
||||
|
||||
const ff = await import("fflate");
|
||||
const bytes = ff.unzipSync(zip, {
|
||||
filter: f => f.name === INSTALLER_PATH_DARWIN
|
||||
})[INSTALLER_PATH_DARWIN];
|
||||
console.log("Unzipping app bundle...");
|
||||
execSync(`ditto -x -k '${downloadName}' '${FILE_DIR}'`);
|
||||
|
||||
writeFileSync(outputFile, bytes, { mode: 0o755 });
|
||||
|
||||
console.log("Overriding security policy for installer binary (this is required to run it)");
|
||||
console.log("Clearing quarantine from installer app (this is required to run it)");
|
||||
console.log("xattr might error, that's okay");
|
||||
|
||||
const logAndRun = cmd => {
|
||||
|
|
@ -96,8 +97,7 @@ async function ensureBinary() {
|
|||
execSync(cmd);
|
||||
} catch { }
|
||||
};
|
||||
logAndRun(`sudo spctl --add '${outputFile}' --label "Equilotl"`);
|
||||
logAndRun(`sudo xattr -d com.apple.quarantine '${outputFile}'`);
|
||||
logAndRun(`sudo xattr -dr com.apple.quarantine '${outputApp}'`);
|
||||
} else {
|
||||
// WHY DOES NODE FETCH RETURN A WEB STREAM OH MY GOD
|
||||
const body = Readable.fromWeb(res.body);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue