feat(electron): implement backend process management and recovery features

This commit is contained in:
Ivan 2026-05-30 11:48:35 -05:00
parent b3303e1bc0
commit 390e25efcb
No known key found for this signature in database
GPG key ID: B84314E2D9332AE0
12 changed files with 585 additions and 162 deletions

View file

@ -1,2 +1,8 @@
#!/bin/sh
export PATH="/usr/local/bin:$PATH"
# Ensure /usr/local/bin (go-task, etc.) is on PATH without shadowing actions/setup-node.
# ARM64 GitHub-hosted images may ship Node 20 in /usr/local/bin; prepending it breaks pnpm 11.
case ":${PATH}:" in
*:/usr/local/bin:*) ;;
*) PATH="${PATH}:/usr/local/bin" ;;
esac
export PATH

View file

@ -10,6 +10,20 @@ cd "$ROOT"
# shellcheck source=scripts/ci/ci-node-path.sh
. "$(dirname "$0")/ci-node-path.sh"
require_node_min() {
_min_major="${1:-22}"
_ver="$(node -v 2>/dev/null || true)"
_major="${_ver#v}"
_major="${_major%%.*}"
if [ -z "$_major" ] || [ "$_major" -lt "$_min_major" ]; then
echo "Node.js ${_min_major}+ required (got: ${_ver:-unknown}); check PATH does not prefer /usr/local/bin over setup-node." >&2
command -v node >&2 || true
exit 1
fi
}
require_node_min 24
mkdir -p release-assets
HOST_ARCH="$(uname -m)"

View file

@ -45,22 +45,18 @@ function patchBinDownload(source) {
}
if (!next.includes("__ebElectronDownloadCacheMode")) {
const injectAfterGetRequire =
/(const get_1 = require\("@electron\/get"\);)/;
const injectAfterGetRequire = /(const get_1 = require\("@electron\/get"\);)/;
if (injectAfterGetRequire.test(next)) {
next = next.replace(
injectAfterGetRequire,
`$1
const __ebElectronDownloadCacheMode = get_1.ElectronDownloadCacheMode ?? ${JSON.stringify(cacheModeFallback)};`,
const __ebElectronDownloadCacheMode = get_1.ElectronDownloadCacheMode ?? ${JSON.stringify(cacheModeFallback)};`
);
next = next.replace(
/get_1\.ElectronDownloadCacheMode\.ReadWrite/g,
"__ebElectronDownloadCacheMode.ReadWrite",
);
next = next.replace(
/in get_1\.ElectronDownloadCacheMode/g,
"in __ebElectronDownloadCacheMode",
"__ebElectronDownloadCacheMode.ReadWrite"
);
next = next.replace(/in get_1\.ElectronDownloadCacheMode/g, "in __ebElectronDownloadCacheMode");
changed = true;
}
}