`npm run dist:mac` failed at the signing step:
codesign --timestamp .../node_modules/node-gyp/gyp/pylib/gyp/generator/\
__pycache__/make.cpython-313.pyc
→ "A timestamp was expected but was not found."
node-gyp only COMPILES native modules. Nothing loads it at runtime — node-pty
resolves its prebuilt .node directly, and a grep over the packaged tree finds no
require of it outside the package itself. But it vendors a Python tree, and
`npmRebuild: true` runs it and leaves __pycache__/*.pyc behind. Those got copied
into Contents/Resources and codesign then tried to sign Python bytecode, which
takes the entire build down.
Excluding it removes both the dead weight (5 MB) and the failure surface. Also
excludes **/__pycache__ outright, so no Python bytecode can reach the bundle by
another route.
Verified on a real build: signature verifies --strict, node-gyp absent, zero .pyc
in the bundle, public/style.css and build/main.js byte-identical to the repo,
express/ws/web-push/qrcode/google-auth-library all still resolve from the
packaged tree, and node-pty's Electron-ABI pty.node is in place.
Note: the immediate failure was transient — a plain retry of the same config
succeeded (Apple's timestamp server). So this is the durable fix for a landmine
that would otherwise re-arm on every npmRebuild, not the cause of that one run.
Deviation from the one-worktree-per-session rule: the desktop build packages from
desktop/node_modules and its script does `cd .. && npm run build`, so it can only
be exercised in the main checkout. Committed on develop directly.
78 lines
3.1 KiB
YAML
78 lines
3.1 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/**"
|
|
# node-gyp only COMPILES native modules; nothing loads it at runtime (node-pty
|
|
# resolves its prebuilt .node directly). It also ships a vendored Python tree,
|
|
# and `npmRebuild` leaves __pycache__/*.pyc behind in it — codesign then tries
|
|
# to sign those and fails with "A timestamp was expected but was not found",
|
|
# taking the whole build down. Excluding the package removes both the dead
|
|
# weight and the failure surface.
|
|
- "!node-gyp/**"
|
|
# Belt and braces: no Python bytecode anywhere in the shipped tree.
|
|
- "!**/__pycache__/**"
|
|
# 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
|