fix(faith): resolve 1962 bundles via createRequire and add deploy pre-push hook
CI / update (push) Successful in 1m27s

romcal's 1962 bundle files live outside the package's exports map and were
being loaded via a cwd-relative path. Under systemd the server runs with
cwd /usr/share/webapps/homepage/dist/, so node_modules/romcal/... resolved
against dist/ and hit ERR_MODULE_NOT_FOUND. Switch to createRequire +
require.resolve('romcal/package.json') so the bundle path is anchored to
the actual package root regardless of cwd.

Also track scripts/hooks/pre-push which runs scripts/deploy.sh after a
master push to origin. Git has no native post-push hook; pre-push is the
closest client-side equivalent — if deploy fails the push is aborted.
Install with: ln -sf ../../scripts/hooks/pre-push .git/hooks/pre-push
This commit is contained in:
2026-04-20 16:44:03 +02:00
parent 9c119b8df2
commit f447520aaa
3 changed files with 41 additions and 4 deletions
+10 -3
View File
@@ -23,7 +23,8 @@ import {
} from 'romcal/1962';
import type { LiturgicalDay1962, RomcalBundle1962 } from 'romcal/1962';
import { pathToFileURL } from 'node:url';
import { resolve as resolvePath } from 'node:path';
import { dirname, join as joinPath } from 'node:path';
import { createRequire } from 'node:module';
import {
colorLabel1962,
rank1962Label,
@@ -39,6 +40,9 @@ import type {
Rite1962Detail
} from '../calendarTypes';
const requireFromHere = createRequire(import.meta.url);
const romcalRoot = dirname(requireFromHere.resolve('romcal/package.json'));
const bundles1969: Record<Diocese1969, Record<CalendarLang, RomcalBundleObject>> = {
general: { en: GeneralRoman_En, de: GeneralRoman_De, la: GeneralRoman_La },
switzerland: { en: Switzerland_En, de: Switzerland_De, la: Switzerland_La }
@@ -110,8 +114,11 @@ const bundle1962Cache = new Map<CalendarLang, Promise<RomcalBundle1962>>();
function loadBundle1962(lang: CalendarLang): Promise<RomcalBundle1962> {
let p = bundle1962Cache.get(lang);
if (p) return p;
const abs = resolvePath(
`node_modules/romcal/rites/roman1962/dist/bundles/${lang}/esm/index.js`
const abs = joinPath(
romcalRoot,
'rites/roman1962/dist/bundles',
lang,
'esm/index.js'
);
p = import(/* @vite-ignore */ pathToFileURL(abs).href).then(
(m) => m.default as RomcalBundle1962