DNDGamePlayer: Electron редактор сцен, презентация, упаковка electron-builder

Made-with: Cursor
This commit is contained in:
Ivan Fontosh
2026-04-19 14:16:54 +08:00
commit a6cbcc273e
82 changed files with 22195 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
import { build } from 'esbuild';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { execFileSync } from 'node:child_process';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const root = path.resolve(__dirname, '..');
function runViteBuild() {
execFileSync('npx vite build', {
cwd: root,
stdio: 'inherit',
shell: true,
});
}
async function buildNodeTargets() {
await build({
entryPoints: [path.join(root, 'app/main/index.ts')],
outfile: path.join(root, 'dist/main/index.cjs'),
platform: 'node',
target: 'node22',
format: 'cjs',
bundle: true,
sourcemap: true,
external: ['electron'],
});
await build({
entryPoints: [path.join(root, 'app/preload/index.ts')],
outfile: path.join(root, 'dist/preload/index.cjs'),
platform: 'node',
target: 'node22',
format: 'cjs',
bundle: true,
sourcemap: true,
external: ['electron'],
});
}
await buildNodeTargets();
execFileSync('node', [path.join(root, 'scripts', 'gen-window-icon.mjs')], {
cwd: root,
stdio: 'inherit',
});
runViteBuild();