@@ -122,8 +122,9 @@ jobs:
|
||||
PEARDOCK_CLIENT_HOSTS: ${{ github.event.inputs.hosts || 'linux-x64,linux-arm64,darwin-x64,darwin-arm64,win32-x64,win32-arm64' }}
|
||||
PEARDOCK_SKIP_CLIENT: ${{ github.event.inputs.skip_client == 'true' && '1' || '0' }}
|
||||
RELEASE_TAG: rolling
|
||||
# Prefer prebuilds when packaging foreign Electron arches
|
||||
# Prefer prebuilds; skip electron-rebuild (main "Finalizing package" stall)
|
||||
npm_config_build_from_source: 'false'
|
||||
PEARDOCK_SKIP_REBUILD: '1'
|
||||
# electron-packager / forge download target Electron builds
|
||||
ELECTRON_GET_USE_PROXY: ${{ env.ELECTRON_GET_USE_PROXY || '' }}
|
||||
run: |
|
||||
|
||||
+60
-32
@@ -1,7 +1,10 @@
|
||||
/**
|
||||
* Electron Forge config for peardock-client.
|
||||
* Aggressive ignore list — Finalizing asar hangs if we copy the full 2GB tree
|
||||
* (bare-sidecar, bare-build platforms, electron, forge, server tooling).
|
||||
*
|
||||
* CI note: "Finalizing package" used to take forever because asar:false + prune
|
||||
* copied ~GBs of real files. We now pack with asar (CJS require works inside
|
||||
* asar; only natives are unpacked) and prune:false (ignore list already strips
|
||||
* the heavy tooling).
|
||||
*/
|
||||
'use strict'
|
||||
|
||||
@@ -35,7 +38,7 @@ const IGNORE_PREFIXES = [
|
||||
'/node_modules/@electron-forge',
|
||||
'/node_modules/bare-build',
|
||||
'/node_modules/bare-runtime',
|
||||
'/node_modules/bare-sidecar', // ~370MB — only for pear-runtime workers
|
||||
'/node_modules/bare-sidecar',
|
||||
'/node_modules/bare-link',
|
||||
'/node_modules/bare-lief',
|
||||
'/node_modules/bare-apk',
|
||||
@@ -43,7 +46,9 @@ const IGNORE_PREFIXES = [
|
||||
'/node_modules/bare-make',
|
||||
'/node_modules/bare-pack',
|
||||
'/node_modules/bare-dev',
|
||||
'/node_modules/pear-runtime/', // server OTA; client uses pear-runtime-updater
|
||||
'/node_modules/bare-bundle',
|
||||
'/node_modules/bare-module-traverse',
|
||||
'/node_modules/pear-runtime/',
|
||||
// Server-only Docker stack
|
||||
'/node_modules/dockerode',
|
||||
'/node_modules/docker-modem',
|
||||
@@ -51,29 +56,45 @@ const IGNORE_PREFIXES = [
|
||||
'/node_modules/cpu-features',
|
||||
'/node_modules/@grpc',
|
||||
'/node_modules/@js-sdsl',
|
||||
// Heavy / unused tooling that may be hoisted
|
||||
// Heavy / unused tooling
|
||||
'/node_modules/typescript',
|
||||
'/node_modules/prettier',
|
||||
'/node_modules/webpack',
|
||||
'/node_modules/caniuse-lite',
|
||||
'/node_modules/brittle',
|
||||
'/node_modules/@types',
|
||||
'/node_modules/esbuild',
|
||||
'/node_modules/@esbuild',
|
||||
'/node_modules/node-gyp',
|
||||
'/node_modules/node-addon-api',
|
||||
]
|
||||
|
||||
const IGNORE_REGEX = [
|
||||
/^\/node_modules\/bare-build-/,
|
||||
/^\/node_modules\/bare-runtime-/,
|
||||
/^\/node_modules\/bare-pack-/,
|
||||
/^\/node_modules\/@esbuild\//,
|
||||
/\.md$/,
|
||||
/\.map$/,
|
||||
/^\/peardock-.*\.json$/,
|
||||
/^\/\.env$/,
|
||||
/^\/package-lock\.json$/,
|
||||
// Tests / docs inside deps
|
||||
/^\/node_modules\/[^/]+\/test\//,
|
||||
/^\/node_modules\/[^/]+\/tests\//,
|
||||
/^\/node_modules\/[^/]+\/docs\//,
|
||||
/^\/node_modules\/[^/]+\/example\//,
|
||||
/^\/node_modules\/[^/]+\/examples\//,
|
||||
]
|
||||
|
||||
function shouldIgnore(file) {
|
||||
if (!file) return false
|
||||
// Always keep package.json (packager needs it)
|
||||
if (file === '/package.json') return false
|
||||
// Keep the GUI bundle (generated)
|
||||
if (file === '/electron/app.bundle.cjs' || file.startsWith('/electron/app.bundle.cjs')) {
|
||||
return false
|
||||
}
|
||||
for (const p of IGNORE_PREFIXES) {
|
||||
if (file === p || file.startsWith(p + '/') || file.startsWith(p)) return true
|
||||
}
|
||||
@@ -83,6 +104,11 @@ function shouldIgnore(file) {
|
||||
return false
|
||||
}
|
||||
|
||||
/** Skip electron-rebuild when prebuilds exist (default in CI). Set PEARDOCK_FORCE_REBUILD=1 to rebuild. */
|
||||
const skipRebuild =
|
||||
process.env.PEARDOCK_FORCE_REBUILD !== '1' &&
|
||||
process.env.PEARDOCK_SKIP_REBUILD !== '0'
|
||||
|
||||
module.exports = {
|
||||
packagerConfig: {
|
||||
name: appName,
|
||||
@@ -91,33 +117,36 @@ module.exports = {
|
||||
icon: fs.existsSync(path.join(__dirname, 'build', 'icon.png'))
|
||||
? path.join(__dirname, 'build', 'icon')
|
||||
: undefined,
|
||||
// asar off: GUI loads via require(electron/app.bundle.cjs). Keeping a real
|
||||
// filesystem tree avoids asar edge cases with native prebuilds and is what
|
||||
// we ship/test. (CJS require is asar-patched; native ESM import is not.)
|
||||
asar: false,
|
||||
// CJS require() works inside asar (Electron patches it). Unpack natives only.
|
||||
// asar:false made "Finalizing package" copy the entire tree as loose files → CI stalls.
|
||||
asar: {
|
||||
unpack: '**/*.{node,bare,dll,dylib,so}',
|
||||
},
|
||||
ignore: shouldIgnore,
|
||||
derefSymlinks: true,
|
||||
prune: true,
|
||||
// Cross-package from Linux CI: download target Electron builds; do not
|
||||
// require macOS codesign (unsigned .app is fine for rolling artifacts).
|
||||
// Symlink deref + prune walk the whole graph and dominate finalize time
|
||||
derefSymlinks: false,
|
||||
prune: false,
|
||||
// Cross-package from Linux CI: no macOS codesign
|
||||
osxSign: false,
|
||||
},
|
||||
|
||||
rebuildConfig: {
|
||||
// Prefer prebuilds when packaging foreign platform/arch (CI cross-compile).
|
||||
force: false,
|
||||
onlyModules: [
|
||||
'udx-native',
|
||||
'sodium-native',
|
||||
'rocksdb-native',
|
||||
'fs-native-extensions',
|
||||
'quickbit-native',
|
||||
'simdle-native',
|
||||
'bare-fs',
|
||||
'bare-os',
|
||||
'bare-crypto',
|
||||
],
|
||||
},
|
||||
// false = skip @electron/rebuild entirely (use prebuilds). Huge CI win.
|
||||
rebuildConfig: skipRebuild
|
||||
? false
|
||||
: {
|
||||
force: false,
|
||||
onlyModules: [
|
||||
'udx-native',
|
||||
'sodium-native',
|
||||
'rocksdb-native',
|
||||
'fs-native-extensions',
|
||||
'quickbit-native',
|
||||
'simdle-native',
|
||||
'bare-fs',
|
||||
'bare-os',
|
||||
'bare-crypto',
|
||||
],
|
||||
},
|
||||
|
||||
makers: [
|
||||
{
|
||||
@@ -126,12 +155,10 @@ module.exports = {
|
||||
},
|
||||
],
|
||||
|
||||
// No universal-prebuilds / prune-prebuilds plugins — they walk huge trees and stall CI
|
||||
plugins: [],
|
||||
|
||||
hooks: {
|
||||
prePackage: async () => {
|
||||
// GUI entry must be CJS-bundled before files are copied into the package
|
||||
require('child_process').execFileSync(
|
||||
process.execPath,
|
||||
[path.join(__dirname, 'scripts', 'build-client-bundle.cjs')],
|
||||
@@ -145,12 +172,10 @@ module.exports = {
|
||||
const pkgPath = path.join(buildPath, 'package.json')
|
||||
const appPkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'))
|
||||
appPkg.main = 'electron/main.cjs'
|
||||
// Drop fields that pull packaging tooling into mental model
|
||||
delete appPkg.devDependencies
|
||||
delete appPkg.scripts
|
||||
fs.writeFileSync(pkgPath, JSON.stringify(appPkg, null, 2) + '\n')
|
||||
|
||||
// Extra cleanup if anything slipped past ignore
|
||||
const junk = [
|
||||
'node_modules/bare-sidecar',
|
||||
'node_modules/electron',
|
||||
@@ -158,9 +183,12 @@ module.exports = {
|
||||
'node_modules/bare-build',
|
||||
'node_modules/bare-runtime',
|
||||
'node_modules/pear-runtime',
|
||||
'node_modules/esbuild',
|
||||
'server',
|
||||
'scripts',
|
||||
'out',
|
||||
'test',
|
||||
'docs',
|
||||
]
|
||||
for (const rel of junk) {
|
||||
const p = path.join(buildPath, rel)
|
||||
|
||||
@@ -58,6 +58,9 @@ export PEARDOCK_CLIENT_HOSTS="${PEARDOCK_CLIENT_HOSTS:-$DEFAULT_HOSTS}"
|
||||
|
||||
# Prefer prebuilt natives when electron-forge cross-packages
|
||||
export npm_config_build_from_source="${npm_config_build_from_source:-false}"
|
||||
# Skip @electron/rebuild during forge package (prebuilds only) — avoids multi-minute "Finalizing"
|
||||
export PEARDOCK_SKIP_REBUILD="${PEARDOCK_SKIP_REBUILD:-1}"
|
||||
|
||||
|
||||
# --- server: all hosts (bare cross-compile) ---
|
||||
log "building server binaries for: $PEARDOCK_SERVER_HOSTS"
|
||||
|
||||
+2
-1
@@ -61,10 +61,11 @@ function makeClient(hosts = CLIENT_HOSTS) {
|
||||
console.error(`[make] no client script for host ${host}`)
|
||||
process.exit(1)
|
||||
}
|
||||
// Prefer prebuilds when cross-packaging (electron-rebuild on foreign arch fails)
|
||||
// Prefer prebuilds; skip native rebuild (cross-arch rebuild is slow/fails)
|
||||
const env = {
|
||||
...process.env,
|
||||
npm_config_build_from_source: 'false',
|
||||
PEARDOCK_SKIP_REBUILD: process.env.PEARDOCK_SKIP_REBUILD || '1',
|
||||
}
|
||||
run(process.platform === 'win32' ? 'npm.cmd' : 'npm', ['run', script], { env })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user