Repository Public
1/**2 * =============================================================================3 * SP BOUCHER | INFRASTRUCTURE & AUTOMATION4 * ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project : MacLustr Social Engine & Remote Navigator8 * File : scripts/build.mjs9 * Module : scripts10 * Repository : https://git.spboucher.ai/maclustr-social11 * Project Website : https://social.spboucher.ai12 * Created : 2026-12-0113 * Last Modified : 2026-12-0114 *15 * Author : Simon-Pierre Boucher16 * Position : Professor of Finance17 * Institution : Université du Québec en Outaouais (UQO)18 * Organization : SP Boucher19 * Website : https://spboucher.ai20 * Git : https://git.spboucher.ai21 *22 * Preferred Contact: admin@spboucher.ai23 * Technical Contact: dev@spboucher.ai24 * Security/Admin : admin@spboucher.ai25 *26 * Copyright (c) 202627 * Simon-Pierre Boucher28 * All rights reserved where applicable. This file is governed by the29 * applicable project license, copyright notices and relevant law.30 * Existing third-party rights and notices remain unaffected.31 *32 * License : None specified (no license file in this repository)33 *34 * Do not embed credentials, private keys, access tokens,35 * certificates or confidential personal information.36 *37 * =============================================================================38 * END OF SP BOUCHER SOURCE HEADER39 * =============================================================================40 */4142// Bundles each service entry point into dist/<name>.mjs (reproducible: pinned lockfile, no timestamps).43import { build } from 'esbuild';44import { existsSync, mkdirSync, writeFileSync } from 'node:fs';45import { execFileSync } from 'node:child_process';46const entries = {47 'control-api': 'services/control-api/src/main.ts',48 scheduler: 'services/scheduler/src/main.ts',49 'navigator-gateway': 'services/navigator-gateway/src/main.ts',50 'navigator-worker': 'workers/navigator-worker/src/main.ts',51 migrate: 'services/control-api/src/migrate.ts',52 cli: 'services/control-api/src/cli.ts',53 openapi: 'services/control-api/src/openapi-cli.ts',54 monitor: 'services/scheduler/src/monitor.ts',55 'fixture-site': 'services/fixture-site/src/main.ts',56};57for (const [k, v] of Object.entries(entries)) if (!existsSync(v)) throw new Error(`entrée manquante : ${v}`);58await build({59 entryPoints: entries, outdir: 'dist', outExtension: { '.js': '.mjs' }, bundle: true, platform: 'node', format: 'esm',60 target: 'node22', sourcemap: 'linked', logLevel: 'info', tsconfig: 'tsconfig.json',61 external: ['playwright', 'playwright-core', 'sharp', 'pg-native', 'fsevents'],62 banner: { js: "import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);" },63});6465let v = 'dev'; try { v = execFileSync('git', ['rev-parse', '--short', 'HEAD'], { stdio: ['ignore', 'pipe', 'ignore'] }).toString().trim(); } catch { /* not a git checkout */ }66mkdirSync('dist', { recursive: true }); writeFileSync('dist/VERSION', v + '\n');67