mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-15 04:32:13 +00:00
update build and postinstall for mac
This commit is contained in:
parent
8705efc9b6
commit
eaa5b46b1f
2 changed files with 25 additions and 3 deletions
6
.github/workflows/build.yml
vendored
6
.github/workflows/build.yml
vendored
|
@ -6,7 +6,7 @@ jobs:
|
||||||
build:
|
build:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [windows-latest, ubuntu-latest, macos-11]
|
os: [macos-11]
|
||||||
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
|
||||||
|
@ -19,6 +19,10 @@ jobs:
|
||||||
with:
|
with:
|
||||||
node-version: 20.11.1
|
node-version: 20.11.1
|
||||||
|
|
||||||
|
- name: Install aria2 on Mac
|
||||||
|
if: matrix.os == 'macos-11'
|
||||||
|
run: brew install aria2
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: yarn
|
run: yarn
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
const { default: axios } = require("axios");
|
const { default: axios } = require("axios");
|
||||||
const util = require("node:util");
|
const util = require("node:util");
|
||||||
const fs = require("node:fs");
|
const fs = require("node:fs");
|
||||||
|
const { spawnSync } = require("node:child_process");
|
||||||
|
|
||||||
const exec = util.promisify(require("node:child_process").exec);
|
const exec = util.promisify(require("node:child_process").exec);
|
||||||
|
|
||||||
const downloadAria2 = async () => {
|
const downloadAria2WindowsAndLinux = async () => {
|
||||||
if (fs.existsSync("aria2")) {
|
if (fs.existsSync("aria2")) {
|
||||||
console.log("Aria2 already exists, skipping download...");
|
console.log("Aria2 already exists, skipping download...");
|
||||||
return;
|
return;
|
||||||
|
@ -47,6 +48,19 @@ const downloadAria2 = async () => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const copyAria2Macos = async () => {
|
||||||
|
const isAria2Installed = spawnSync("which", ["aria2c"]).status;
|
||||||
|
|
||||||
|
if (isAria2Installed != 0) {
|
||||||
|
console.log("Please install aria2");
|
||||||
|
console.log("brew install aria2");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
fs.mkdirSync("aria2");
|
||||||
|
await exec(`cp $(which aria2c) aria2/aria2c`);
|
||||||
|
};
|
||||||
|
|
||||||
if (process.platform === "win32") {
|
if (process.platform === "win32") {
|
||||||
fs.copyFileSync(
|
fs.copyFileSync(
|
||||||
"node_modules/ps-list/vendor/fastlist-0.3.0-x64.exe",
|
"node_modules/ps-list/vendor/fastlist-0.3.0-x64.exe",
|
||||||
|
@ -54,4 +68,8 @@ if (process.platform === "win32") {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
downloadAria2();
|
if (process.platform == "darwin") {
|
||||||
|
copyAria2Macos();
|
||||||
|
} else {
|
||||||
|
downloadAria2WindowsAndLinux();
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue