Files
lzstealth ea283dd490
build-windows-exe / build (push) Failing after 9s
Release v2.1.11
2026-08-15 14:55:06 +01:00

52 lines
1.6 KiB
JavaScript

const fs = require('fs');
const os = require('os');
const path = require('path');
const {execFileSync} = require('child_process');
const esbuild = require('esbuild');
const {version: packageVersion} = require('../package.json');
function normalizeBuildVersion(value) {
const version = (value || packageVersion || '0.0.0').toString().trim();
return version.startsWith('v') ? version : `v${version}`;
}
async function main() {
const distDir = path.resolve(__dirname, '..', 'dist');
if (!fs.existsSync(distDir)) {
fs.mkdirSync(distDir, {recursive: true});
}
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'gsa-sea-'));
const bundlePath = path.join(tempDir, 'index.cjs');
const seaBlobPath = path.join(tempDir, 'sea-prep.blob');
const seaConfigPath = path.join(tempDir, 'sea-config.json');
const buildVersion = normalizeBuildVersion(process.env.BUILD_VERSION);
const outputFile = path.join(distDir, `gSheets-Rate-Assistant-${buildVersion}.exe`);
await esbuild.build({
entryPoints: [path.resolve(__dirname, '..', 'index.js')],
bundle: true,
platform: 'node',
format: 'cjs',
target: 'node26',
outfile: bundlePath,
logLevel: 'info',
});
fs.writeFileSync(seaConfigPath, JSON.stringify({
main: bundlePath,
output: outputFile,
mainFormat: 'commonjs',
disableExperimentalSEAWarning: true,
useCodeCache: false,
useSnapshot: false,
}, null, 2));
execFileSync(process.execPath, ['--build-sea', seaConfigPath], {stdio: 'inherit'});
}
main().catch(error => {
console.error(error && error.stack ? error.stack : error);
process.exit(1);
});