Fail the build when a module tree is missing from extraResources (#18)

electron-builder only warns for an absent extraResources source:
app-builder-lib's copyFiles logs "file source doesn't exist" and returns,
so the target still builds and the process still exits 0. A dist run
against a partial build:all — one module's build failed or never ran —
therefore produces an installer that launches normally and is simply
missing that editor module, which surfaces only when a user opens the tab.

The config already fails fast for the gsk CLI tree; extend the same guard
to the four module build outputs.

Verified on arm64: removing a module out/ now exits 1 naming the path,
and a complete tree still packages and exits 0.

Co-authored-by: kalyanar <6203088+kalyanar@users.noreply.github.com>
This commit is contained in:
kalyanar
2026-08-05 16:35:17 +08:00
committed by GitHub
co-authored by kalyanar
parent 8f523289d6
commit 9e1a9357a4
+13
View File
@@ -35,6 +35,19 @@ for (const rel of [
}
}
// The module trees are electron-vite outputs produced by build:all; a missing
// one means that module's build did not run or failed. electron-builder only
// logs "file source doesn't exist" for an absent extraResources source and
// still exits 0, so without this the installer launches normally and is simply
// missing that editor — it surfaces only when a user opens the tab.
for (const rel of ['../docs/out', '../sheets/out', '../slides/out', '../pdf/out']) {
if (!existsSync(join(__dirname, rel))) {
throw new Error(
`electron-builder extraResources source missing: ${rel} (run npm run build:all first)`,
)
}
}
/** @type {import('electron-builder').Configuration} */
const config = {
appId: 'com.genoffice.app',