feat: enhance native binary resolution and add bundled Node.js runtime

- Refactored gelectron.js to improve native binary discovery with additional paths and environment variable support.
- Implemented a function to find the Node.js runtime, allowing bundled Node.js to be used when available.
- Updated package.json to include gelectron-packager as a CLI command.
- Enhanced gelectron-packager.js to locate installed gelectron runtime and added compatibility for bundled Node.js.
- Modified install-release.sh to download and install a private Node.js runtime alongside the gelectron binary.
- Updated NSIS installer script to include bundled Node.js runtime.
- Enhanced AppImage and DMG packaging scripts to include Node.js runtime.
- Added clipboard, nativeTheme, and screen modules for Electron compatibility.
- Implemented native bridge request handling for clipboard operations.
This commit is contained in:
miles committed 2026-09-05 22:23:37 -05:00
1 parent 247daa6460
commit 1689adffc6
16 files changed
+816 -79

No files matched your search

+34 -1
View File
@@ -80,8 +80,10 @@ esac
if [[ "$UNINSTALL" == "1" ]]; then
rm -f "$PREFIX/gelectron"
rm -f "$PREFIX/gelectron.exe"
rm -f "$PREFIX/node"
rm -f "$PREFIX/node.exe"
rm -rf "$PREFIX/compat"
echo "Removed $PREFIX/gelectron and $PREFIX/compat"
echo "Removed $PREFIX/gelectron, $PREFIX/node and $PREFIX/compat"
exit 0
fi
@@ -145,6 +147,37 @@ if [[ -d "$STAGE/compat" ]]; then
install -m 644 "$STAGE"/compat/*.js "$PREFIX/compat/"
fi
# Download a private Node.js runtime next to the binary so `gelectron <app>`
# works on machines that don't have Node installed. The binary's runtime
# resolution checks its own directory first, so this private copy wins.
NODE_VERSION="20.18.1"
NODE_INSTALLED="$PREFIX/node"
if [[ "$PLATFORM" == "win32" ]]; then NODE_INSTALLED="$PREFIX/node.exe"; fi
if [[ ! -x "$NODE_INSTALLED" ]]; then
echo "==> Installing private Node.js v$NODE_VERSION ..."
case "$PLATFORM-$ARCH" in
darwin-*) NODE_PLATFORM="darwin-$ARCH"; NODE_EXT="tar.gz" ;;
linux-*) NODE_PLATFORM="linux-$ARCH"; NODE_EXT="tar.xz" ;;
win32-*) NODE_PLATFORM="win-$ARCH"; NODE_EXT="zip" ;;
esac
NODE_URL="https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-${NODE_PLATFORM}.${NODE_EXT}"
NODE_ARCHIVE="$(mktemp /tmp/gelectron-node.XXXXXX.${NODE_EXT})"
curl -fsSL -L "$NODE_URL" -o "$NODE_ARCHIVE"
NODE_STAGE="$(mktemp -d "${TMPDIR:-/tmp}/gelectron-node-stage.XXXXXX")"
case "$NODE_EXT" in
zip) unzip -qo "$NODE_ARCHIVE" -d "$NODE_STAGE" ;;
tar.gz) tar -xzf "$NODE_ARCHIVE" -C "$NODE_STAGE" ;;
tar.xz) tar -xJf "$NODE_ARCHIVE" -C "$NODE_STAGE" ;;
esac
NODE_BIN="$(find "$NODE_STAGE" -type f \( -name 'node.exe' -o -name 'node' \) | head -n1)"
if [[ -n "$NODE_BIN" ]]; then
install -m 755 "$NODE_BIN" "$NODE_INSTALLED"
else
echo " warning: could not install private Node.js — apps will require a system Node" >&2
fi
rm -rf "$NODE_STAGE" "$NODE_ARCHIVE"
fi
# Downloaded-from-GitHub binaries carry a quarantine attribute on macOS and
# Gatekeeper will block the first launch. Clear it — the binary is ad-hoc
# signed, so this is the only thing standing in the way.