Initial work on upload app server

This commit is contained in:
Alan Grainger
2026-10-06 10:07:20 +13:00
parent 9e6c00da35
commit 95ac498cf0
38 changed files with 1493 additions and 40 deletions
+2 -17
View File
@@ -1,22 +1,7 @@
import { readFileSync } from 'fs'
import { join } from 'path'
import { resolveAppVersion } from '@ipp/core'
/**
* Resolve the running application version. Prefers the APP_VERSION env var
* baked in at Docker build time (see Dockerfile); falls back to package.json
* for local dev (`npm run dev`), and finally to 'dev' if neither is readable.
*/
function resolveVersion (): string {
if (process.env.APP_VERSION) return process.env.APP_VERSION
try {
const pkg = JSON.parse(readFileSync(join(__dirname, '..', 'package.json'), 'utf-8'))
return pkg.version || 'dev'
} catch {
return 'dev'
}
}
export const APP_VERSION = resolveVersion()
export const APP_VERSION = resolveAppVersion(join(__dirname, '..', 'package.json'))
/** URL-safe cache-busting segment for static asset paths. */
export const ASSET_VERSION = encodeURIComponent(APP_VERSION)