OverviewFilesCommitsIssuesDocsReleasesPeers

favela-web / lib / version.js

16 lines · javascript ref:
// The version of the CODE THAT IS RUNNING — not the version on disk.
//
// `pgh app status` reports the INSTALLED tree's package.json, which is true about the disk and can be
// false about the process: an app that installed an update and never restarted still reports the new
// number while serving the old one. That gap has bitten this fleet before. A version rendered by the
// running process is the only one that answers "what am I actually looking at".
//
// Imported statically from package.json so bare-pack pulls it into the module graph — the phone runs
// from worklet.bundle with no package.json on disk, and anything read via fs would be absent there.
// The `with { type: 'json' }` attribute is required by node (the test suite's runtime) and accepted by
// bare (the daemon's). The bare form alone throws ERR_IMPORT_ATTRIBUTE_MISSING under node; verified on
// both before choosing this.
import pkg from '../package.json' with { type: 'json' }

export const VERSION = (pkg && pkg.version) || 'unknown'