b4fbd6fe9f
Deploy Site / deploy-vercel (push) Has been skipped
Deploy Site / deploy-docs (push) Has been skipped
Build Skills Index / build-index (push) Has been skipped
CI / Deny unrelated histories (push) Has been skipped
CI / Detect affected areas (push) Successful in 27m35s
CI / OSV scan (push) Failing after 4s
CI / Build&Test Docker image (push) Successful in 9s
CI / Supply-chain scan (push) Has been skipped
CI / Lint Docker scripts (push) Failing after 5m13s
CI / Check contributors (push) Failing after 12m8s
CI / Docs Site (push) Failing after 12m8s
CI / TypeScript (push) Failing after 12m8s
CI / Python lints (push) Failing after 12m9s
CI / Python tests (push) Failing after 12m9s
CI / Check uv.lock (push) Failing after 23m22s
CI / CI timing report (push) Has been cancelled
Build Skills Index / trigger-deploy (push) Has been cancelled
CI / All required checks pass (push) Has been cancelled
59 lines
1.9 KiB
JavaScript
59 lines
1.9 KiB
JavaScript
// Resolve electronDist at runtime (#38673, #47917): electron-builder 26.8.x can
|
|
// re-unpack a broken Electron.app; reusing the installed dist dodges that.
|
|
// npm workspace hoisting is non-deterministic — require.resolve finds electron
|
|
// wherever it landed. Dist present → -c.electronDist=<abs>/dist; absent → let
|
|
// electron-builder fetch via @electron/get (electronVersion + ELECTRON_MIRROR).
|
|
|
|
import fs from "node:fs"
|
|
import path from "node:path"
|
|
import { spawnSync } from "node:child_process"
|
|
import { createRequire } from "node:module"
|
|
|
|
const require = createRequire(import.meta.url)
|
|
|
|
function electronDistDir() {
|
|
try {
|
|
return path.join(path.dirname(require.resolve("electron/package.json")), "dist")
|
|
} catch {
|
|
return null
|
|
}
|
|
}
|
|
|
|
function distBinary(dist) {
|
|
if (process.platform === "darwin") {
|
|
return path.join(dist, "Electron.app", "Contents", "MacOS", "Electron")
|
|
}
|
|
if (process.platform === "win32") {
|
|
return path.join(dist, "electron.exe")
|
|
}
|
|
return path.join(dist, "electron")
|
|
}
|
|
|
|
function electronBuilderCli() {
|
|
const pkgJson = require.resolve("electron-builder/package.json")
|
|
const bin = require(pkgJson).bin
|
|
const rel = typeof bin === "string" ? bin : bin["electron-builder"]
|
|
return path.join(path.dirname(pkgJson), rel)
|
|
}
|
|
|
|
const dist = electronDistDir()
|
|
const args = []
|
|
if (dist && fs.existsSync(distBinary(dist))) {
|
|
args.push(`-c.electronDist=${dist}`)
|
|
} else {
|
|
console.warn(
|
|
"[run-electron-builder] no local electron dist; electron-builder will fetch " +
|
|
"via @electron/get (electronVersion + ELECTRON_MIRROR)."
|
|
)
|
|
}
|
|
args.push(...process.argv.slice(2))
|
|
|
|
const result = spawnSync(process.execPath, [electronBuilderCli(), ...args], {
|
|
stdio: "inherit",
|
|
})
|
|
if (result.error) {
|
|
console.error(`[run-electron-builder] spawn failed: ${result.error.message}`)
|
|
process.exit(1)
|
|
}
|
|
process.exit(result.status == null ? 1 : result.status)
|