Files
church-translate/app/tools/sync-build-version.js
T
christianandClaude Opus 5 c9eef0672c Church Translate, as it runs at the campuses
Live sermon translation into 100+ languages, running entirely on one Mac per
campus: audio in, voice detection, Whisper on the GPU, NLLB-200 in its own
process, and a built-in web server the congregation reads from on their
phones. No audio leaves the building.

This is the source only. What used to sit beside it — 14 GB of speech and
translation models, 8 GB of voice bundles, 6 GB of natural voices, the Electron
caches, and the app data holding the operator PIN and every service transcript
— is machine state and downloaded assets, and stays in the NAS backup where it
belongs. The vendored node, cloudflared and Windows ffmpeg binaries are out too
(533 MB, re-fetched for packaging); the browser-side runtime beside them is
kept, so a checkout still serves the congregation page.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-23 15:41:21 -04:00

44 lines
1.6 KiB
JavaScript

/*
* sync-build-version.js — make `buildNumber` mean something.
*
* package.json carried TWO build numbers: a top-level `buildNumber` that was
* dutifully bumped every release and read by absolutely nothing, and
* `build.buildVersion` — the one electron-builder writes to CFBundleVersion —
* hardcoded at "51" since 3.4.0. So the installed app reported build 51 while
* the release was build 55, and the DMG filename was the only honest clue
* anywhere. Runs as `predist`, so bumping buildNumber alone is now enough.
*/
'use strict';
const fs = require('fs');
const path = require('path');
const p = path.join(__dirname, '..', 'package.json');
const raw = fs.readFileSync(p, 'utf8');
const pkg = JSON.parse(raw);
const want = String(pkg.buildNumber || '').trim();
if (!want) {
console.error('package.json has no buildNumber — refusing to build a build with no number');
process.exit(1);
}
if (!/^\d+$/.test(want)) {
console.error('buildNumber must be digits, got "' + want + '"');
process.exit(1);
}
const have = String((pkg.build && pkg.build.buildVersion) || '');
if (have === want) {
console.log('build number ' + want + ' (CFBundleVersion already matches)');
process.exit(0);
}
/* Rewrite the one value textually rather than re-serialising the whole file, so
this never reformats a config the operator's settings depend on. */
const re = /("buildVersion"\s*:\s*")([^"]*)(")/;
if (!re.test(raw)) {
console.error('could not find build.buildVersion in package.json');
process.exit(1);
}
fs.writeFileSync(p, raw.replace(re, '$1' + want + '$3'));
console.log('CFBundleVersion ' + (have || '(unset)') + ' -> ' + want);