mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-17 13:13:35 +08:00
fix(native): run electron-builder through node
Avoid the bunx launcher for local Electron packaging after it can be terminated before Electron Builder starts. Use the installed Electron Builder CLI through Node for the macOS package script and desktop package shortcuts. Tested: SKIP_INSTALL=1 SKIP_PACKAGE_SMOKE=1 bash ./scripts/build-macos-arm64.sh Tested: bun run test:package-smoke --platform macos --package-kind release --artifacts-dir desktop/build-artifacts/macos-arm64 Tested: bash -n desktop/scripts/build-macos-arm64.sh Tested: git diff --check Not-tested: full bun run verify was not run because this is a narrow local packaging launcher fix. Confidence: high Scope-risk: narrow
This commit is contained in:
parent
81599b2af9
commit
275dab39cc
@ -85,8 +85,8 @@
|
||||
"build:linux-arm64": "LINUX_ARCH=arm64 bash ./scripts/build-linux.sh",
|
||||
"electron:dev": "bun run build:electron && bun run ./scripts/electron-dev.ts",
|
||||
"electron:build": "bun run build:sidecars && bun run build && bun run build:electron",
|
||||
"electron:package": "bun run clean:electron-output && bun run electron:build && bunx electron-builder --publish never",
|
||||
"electron:package:dir": "bun run clean:electron-output && bun run electron:build && bunx electron-builder --dir --publish never",
|
||||
"electron:package": "bun run clean:electron-output && bun run electron:build && node ./node_modules/electron-builder/out/cli/cli.js --publish never",
|
||||
"electron:package:dir": "bun run clean:electron-output && bun run electron:build && node ./node_modules/electron-builder/out/cli/cli.js --dir --publish never",
|
||||
"check:electron": "node ./node_modules/typescript/bin/tsc -p electron/tsconfig.json && bun test electron && bun run build:electron",
|
||||
"preview": "vite preview",
|
||||
"test": "vitest",
|
||||
|
||||
@ -9,6 +9,7 @@ REPO_ROOT="$(cd "${DESKTOP_DIR}/.." && pwd)"
|
||||
TARGET_TRIPLE="aarch64-apple-darwin"
|
||||
CANONICAL_OUTPUT_DIR="${DESKTOP_DIR}/build-artifacts/macos-arm64"
|
||||
ELECTRON_OUTPUT_DIR="${DESKTOP_DIR}/build-artifacts/electron"
|
||||
ELECTRON_BUILDER_CLI="${DESKTOP_DIR}/node_modules/electron-builder/out/cli/cli.js"
|
||||
|
||||
usage() {
|
||||
cat <<'EOF'
|
||||
@ -45,7 +46,7 @@ if [[ "$(uname -m)" != "arm64" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for command in bun codesign hdiutil; do
|
||||
for command in bun node codesign hdiutil; do
|
||||
if ! command -v "${command}" >/dev/null 2>&1; then
|
||||
echo "[build-macos-arm64] Missing required command: ${command}" >&2
|
||||
exit 1
|
||||
@ -103,14 +104,14 @@ echo "[build-macos-arm64] Building renderer and Electron main/preload bundles...
|
||||
|
||||
if [[ "${REBUILD_NATIVE:-0}" == "1" ]]; then
|
||||
echo "[build-macos-arm64] Rebuilding native dependencies for Electron ABI..."
|
||||
(cd "${DESKTOP_DIR}" && bunx electron-builder install-app-deps)
|
||||
(cd "${DESKTOP_DIR}" && node "${ELECTRON_BUILDER_CLI}" install-app-deps)
|
||||
(cd "${DESKTOP_DIR}" && bun run prepare:node-pty)
|
||||
fi
|
||||
|
||||
echo "[build-macos-arm64] Cleaning empty dmg-builder cache directories..."
|
||||
(cd "${DESKTOP_DIR}" && bash ./scripts/clean-dmg-builder-cache.sh)
|
||||
|
||||
BUILDER_ARGS=(bunx electron-builder --mac "${MAC_TARGET_ARRAY[@]}" --arm64 --publish never)
|
||||
BUILDER_ARGS=(node "${ELECTRON_BUILDER_CLI}" --mac "${MAC_TARGET_ARRAY[@]}" --arm64 --publish never)
|
||||
if [[ "${SIGN_BUILD:-0}" != "1" ]]; then
|
||||
export CSC_IDENTITY_AUTO_DISCOVERY=false
|
||||
# package.json sets mac.notarize=true for the signed CI release path. A local
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user