fix(faith): resolve bible TSVs relative to module, not CWD
CI / update (push) Successful in 21s

Server runs from build output dir where CWD-relative `static/*.tsv`
misses — adapter-node ships static assets at build/client/. New
resolveStaticAsset() helper uses import.meta.url to find the bundled
location, falls back to <cwd>/static/ in dev.

Fixes ENOENT on drb.tsv/allioli.tsv after deploy.
This commit is contained in:
2026-04-21 14:25:36 +02:00
parent ae953de5eb
commit 67700c0e75
5 changed files with 31 additions and 12 deletions
@@ -1,11 +1,11 @@
import { json, error } from '@sveltejs/kit';
import type { RequestHandler } from './$types';
import { lookupReference } from '$lib/server/bible';
import { resolve } from 'path';
import { resolveStaticAsset } from '$lib/server/staticAsset';
const tsvFiles: Record<string, string> = {
glaube: 'static/allioli.tsv',
faith: 'static/drb.tsv'
glaube: 'allioli.tsv',
faith: 'drb.tsv'
};
export const GET: RequestHandler = async ({ params }) => {
@@ -15,7 +15,7 @@ export const GET: RequestHandler = async ({ params }) => {
return error(400, 'Missing reference parameter');
}
const tsvPath = resolve(tsvFiles[params.faithLang]);
const tsvPath = resolveStaticAsset(tsvFiles[params.faithLang]);
try {
const result = lookupReference(reference, tsvPath);