Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/thatdeveloperguy-website / scripts/build-api.ts |
| Date | Not specified in source |
| Repository | Janady13/thatdeveloperguy-website |
| Revision | 2bea2ebdff0e34494bff597d4fa9c8422a0c3a94 |
| Branch | main |
| Path or archive member | scripts/build-api.ts |
| Original SHA-256 | 2904354e3327de22a64220ad3ec78337650c8ef060459b5f34cac2ba4ccc3672 |
| Git blob SHA | 5e9a8b9be00e9b10251151a589e74320b92b6e7e |
| Reading-copy SHA-256 | 2904354e3327de22a64220ad3ec78337650c8ef060459b5f34cac2ba4ccc3672 |
Recovered source transcript
Download complete source text ↓14 lines · 1.2 KB
/** Bundle the private Fastify service to dist/api/server.mjs (one file, Node 24 target, no credentials inside). */
import { build } from 'esbuild';
import { mkdirSync, writeFileSync, readFileSync } from 'node:fs';
import { createHash } from 'node:crypto';
import { resolve } from 'node:path';
const root = resolve(import.meta.dirname, '..');
mkdirSync(resolve(root, 'dist/api'), { recursive: true });
await build({ entryPoints: [resolve(root, 'server/main.ts')], outfile: resolve(root, 'dist/api/server.mjs'), bundle: true, platform: 'node', target: 'node24', format: 'esm', sourcemap: false, minify: false, legalComments: 'none',
banner: { js: "import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);" } });
const bytes = readFileSync(resolve(root, 'dist/api/server.mjs'));
if (/SMTP_PASS\s*=\s*['"][^'"]+/.test(bytes.toString())) throw new Error('a credential-looking string is in the bundle');
writeFileSync(resolve(root, 'dist/api/build-manifest.json'), JSON.stringify({ bytes: bytes.length, sha256: createHash('sha256').update(bytes).digest('hex'), builtAt: new Date().toISOString() }, null, 2) + '\n');
console.log(`dist/api/server.mjs ${bytes.length} bytes`);