Fail Electron Builder if missing deps (#34556)

* Fail Electron Builder if missing deps

* Iterate

* Whoops
This commit is contained in:
Michael Telatynski
2026-08-05 10:37:21 +00:00
committed by GitHub
parent 4b6dfb1cfb
commit 97851e6463
+15 -1
View File
@@ -8,7 +8,8 @@ Please see LICENSE in the repository root for full details.
import * as os from "node:os";
import * as fs from "node:fs";
import path from "node:path";
import { type Configuration as BaseConfiguration } from "electron-builder";
import { type Configuration as BaseConfiguration, log } from "electron-builder";
import { LogMessageByKey } from "app-builder-lib/out/node-module-collector/moduleManager.js";
/**
* This script has different outputs depending on your os platform.
@@ -239,4 +240,17 @@ if (os.platform() === "linux") {
}
}
// Treat certain warnings as a fatal error
const FATAL_WARNINGS = [LogMessageByKey.PKG_NOT_ON_DISK, LogMessageByKey.PKG_NOT_FOUND];
// Otherwise we just burn time running the tests for no reason.
if (typeof log !== "undefined") {
const prevTransform = log.messageTransformer;
log.messageTransformer = (message, level) => {
if (level === "warn" && FATAL_WARNINGS.some((w) => message.startsWith(w))) {
throw new Error(`electron-builder: ${message}`);
}
return prevTransform?.(message, level) ?? message;
};
}
export default config;