Lines 1-33javascript
2import { spawn, execFile } from "child_process";
3import { promisify } from "util";
4import { createRequire } from "module";
5import { fileURLToPath } from "url";
6import path from "path";
7import { readFileSync } from "fs";
8import { build, Platform } from "electron-builder";
9import { appBuilderPath } from "app-builder-bin";
10import { rcedit } from "rcedit";
12const execFileAsync = promisify(execFile);
14const require = createRequire(import.meta.url);
15const frameworkRoot = path.join(fileURLToPath(import.meta.url), "..", "..");
MediumDynamic Require
Package source references dynamic require/import behavior.
bin/kempo-app.jsView on unpkg · L13 16const mainScript = path.join(frameworkRoot, "src", "main", "main.js");
18// No cross-compiling, ever — always whatever OS this is actually running on.
19const hostPlatform = { win32: Platform.WINDOWS, darwin: Platform.MAC, linux: Platform.LINUX }[process.platform];
21const appArgs = process.argv.slice(2);
22const pkg = JSON.parse(readFileSync(path.join(process.cwd(), "package.json"), "utf-8"));
23// Debian packages require a maintainer email by spec — fpm fails the whole build
HighSandbox Evasion Gated Capability
Source gates dangerous network, credential, or execution behavior behind CI, host, platform, time, or geo fingerprint checks.
bin/kempo-app.jsView on unpkg · L1 24// (taking deb *and* rpm down with it, even though rpm doesn't itself require this)
25// without one. Most consumer apps won't have filled this in, so check rather than
26// assume it's there: skip straight to AppImage-only (needs none of this) instead of
27// a hard crash. homepage has the same requirement; derive it from "repository" if
28// the consumer has that but not "homepage" itself, before giving up on it too.
29const authorEmail = typeof pkg.author === "string" ? pkg.author.match(/<(.+?)>/)?.[1] : pkg.author?.email;
30const homepage = pkg.homepage || pkg.repository?.url?.replace(/^git\+/, "").replace(/\.git$/, "");
32if(appArgs.includes("--package")){
33 await runBuild("dir");