From f571e46937d423d9ba44154a92aeb4136466daaa Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 5 Oct 2026 22:35:56 -0700 Subject: README rewritten for today's coinos v3; build switches are COINOS_* (HAL_* still accepted); silent-payment leftovers removed Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01YRC6aKhwAud231ot9FPmhi --- build.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'build.js') diff --git a/build.js b/build.js index c90656f..da51245 100644 --- a/build.js +++ b/build.js @@ -252,7 +252,11 @@ export async function buildSwNwc({ minify = true } = {}) { return result.outputs[0].text(); } -// Optional-feature selection: HAL_FEATURES is a comma list of enabled +// Build switches are COINOS_* environment variables. The old HAL_* names still +// work: the cs deploy hook and pinned F-Droid recipes pass them. +const env = (name) => process.env['COINOS_' + name] ?? process.env['HAL_' + name]; + +// Optional-feature selection: COINOS_FEATURES is a comma list of enabled // features (gifts,ark,zaps,nwc,…). Unset means all; "none"/"" means a minimal // on-chain-only wallet. A build plugin swaps src/features/index.js for a // generated module that only imports the enabled features, so a disabled @@ -273,7 +277,7 @@ const ALL_FEATURES = { gifts: 'giftsFeature', ark: 'arkFeature', nostrlogin: 'no // later chunk makes the header change after the rest of the page has painted. const DEFERRED_FEATURES = ['gifts', 'nwc', 'pos']; -export function enabledFeatures(spec = process.env.HAL_FEATURES) { +export function enabledFeatures(spec = env('FEATURES')) { if (spec == null) return Object.keys(ALL_FEATURES); return spec.split(',').map((x) => x.trim().toLowerCase()).filter((x) => x in ALL_FEATURES); } @@ -305,9 +309,9 @@ const featurePlugin = (enabled) => ({ }, }); -// HAL_TARGET=staging flips src/build-flags.js in the bundle: mutinynet-first +// COINOS_TARGET=staging flips src/build-flags.js in the bundle: mutinynet-first // defaults and a visible staging stamp, without a diverging branch. -export const isStaging = (target = process.env.HAL_TARGET) => target === 'staging'; +export const isStaging = (target = env('TARGET')) => target === 'staging'; const flagsPlugin = (staging) => ({ name: 'coinos-build-flags', @@ -375,10 +379,10 @@ function bootShell(logo, staging) { } const BOOT_SHELL_SCRIPT = ``; -// HAL_NO_SW=1: the page registers no service worker. The Android bundled +// COINOS_NO_SW=1: the page registers no service worker. The Android bundled // build serves this page from its own assets, where a worker would only // fetch the live site over the top of them. -const NO_SW = !!process.env.HAL_NO_SW; +const NO_SW = !!env('NO_SW'); async function pageHtml({ css, staging, pwa, scriptHtml }) { return ` @@ -401,7 +405,7 @@ ${pwa && !NO_SW ? SW_REGISTER + '\n' : ''} } // Self-contained single file (dev server, test tools, save-and-open-offline). -export async function buildHtml({ minify = true, pwa = minify, features = process.env.HAL_FEATURES, staging = isStaging(), inlineFonts = false } = {}) { +export async function buildHtml({ minify = true, pwa = minify, features = env('FEATURES'), staging = isStaging(), inlineFonts = false } = {}) { const outputs = await bundleApp({ minify, features, staging }); let js = await outputs[0].text(); // Guard against a literal inside the bundle closing our tag early. @@ -422,7 +426,7 @@ export async function buildHtml({ minify = true, pwa = minify, features = proces // features ride in their own files, fetched right after boot. The page stays // tiny on every load while the heavy bundles are cached by name — a repeat // visit re-downloads kilobytes, not the app. -export async function buildSplit({ minify = true, features = process.env.HAL_FEATURES, staging = isStaging() } = {}) { +export async function buildSplit({ minify = true, features = env('FEATURES'), staging = isStaging() } = {}) { const outputs = await bundleApp({ minify, features, staging, splitting: true }); const entry = outputs.find((o) => o.kind === 'entry-point') || outputs[0]; const js = (await entry.text()).replaceAll('{{COMMIT}}', gitCommit()); -- cgit v1.2.3