Files
web-terminal/desktop/electron-builder.yml
Yaojia Wang c6d819f85f fix(desktop): mirror server runtime deps + drop dangling .bin from bundle
Two fixes required to repackage the macOS app after the split-grid frontend landed:

- The bundled node_modules is copied from desktop/node_modules, which only mirrored
  4 of the 6 server runtime deps. google-auth-library (imported at server startup by
  dist/push/fcm.js) and qrcode were missing, so the embedded server crashed on launch
  ("Cannot find package 'google-auth-library'"). Added both to desktop/package.json so
  they're installed + bundled. (The old build predated the FCM code, hiding this.)
- electron-builder died with "ENOENT .bin/asar": node_modules/.bin holds dev-tool
  symlinks (asar/tsc/esbuild) into packages the filter excludes, leaving dangling
  symlinks in the bundle that electron-builder stat()s. Excluded .bin/** from the copy
  (runtime deps load by path, not via .bin).

Verified: dist:mac builds clean (signed, DMG), installed to /Applications, embedded
server serves :3000 (HTTP 200) and the split-grid frontend loads.
2026-07-12 05:52:17 +02:00

69 lines
2.5 KiB
YAML

# electron-builder config for the web-terminal desktop shell (Mac focus).
#
# PACKAGING MODEL — server + its node_modules on disk (extraResources), NOT in asar:
# The embedded server (src/server.ts) is ESM, resolves the frontend via
# path.join(__dirname,'..','public'), and imports express/ws/web-push/node-pty.
# embedded-server.ts loads it from process.resourcesPath when packaged. So we ship,
# as real files under Contents/Resources (siblings): dist/ + public/ + node_modules/.
# The server then resolves `require('express')` etc. via a plain Node walk-up to
# Resources/node_modules — no asar, no ESM-from-asar, no native-module-in-asar issues.
# (An earlier build shipped only node-pty and "worked" in-place only because it borrowed
# the repo's node_modules up the tree; from /Applications that failed with
# "Cannot find package 'express'". This ships the full runtime dep tree.)
#
# node_modules is filtered to drop build-only tooling (electron/electron-builder/esbuild/
# typescript + their heavy binaries) — never the server's runtime deps or their transitives.
# node-pty is rebuilt for the Electron ABI (npmRebuild) before the copy.
#
# App icon: auto-generated from resources/icon.png. Tray icon: shipped in-asar under assets/.
# NOTE: Windows packaging needs a Windows machine (no wine here).
appId: com.webterminal.desktop
productName: Web Terminal
directories:
output: dist-app
buildResources: resources
files:
- build/**/*
- assets/**/*
- package.json
extraMetadata:
main: build/main.cjs
extraResources:
- from: ../dist
to: dist
- from: ../public
to: public
filter:
- "**/*"
- "!**/*.ts"
- "!**/*.map"
- from: node_modules
to: node_modules
filter:
- "**/*"
# .bin holds dev-tool shims (asar/tsc/esbuild/…) symlinked into packages we
# exclude below — copying them leaves DANGLING symlinks that electron-builder
# stat()s and dies on (ENOENT .bin/asar). Runtime deps load by path, not .bin.
- "!.bin/**"
# build-only tooling — never needed at runtime by express/ws/web-push/node-pty:
- "!electron/**"
- "!electron-builder/**"
- "!esbuild/**"
- "!@esbuild/**"
- "!typescript/**"
- "!app-builder-bin/**"
- "!dmg-builder/**"
- "!7zip-bin/**"
- "!@electron/**"
- "!@develar/**"
# Rebuild native deps (node-pty) against the Electron ABI before packaging + copy.
npmRebuild: true
mac:
target:
- dmg
- zip
category: public.app-category.developer-tools
win:
target:
- nsis