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
+30
View File
@@ -0,0 +1,30 @@
#!/usr/bin/env bash
# Run scripts/deploy.sh after a push to origin/master.
# Git has no native post-push hook; pre-push runs before the push completes.
# If deploy fails the push is aborted, which is safer than deploying after a
# push that might have been rejected anyway.
#
# Install: ln -sf ../../scripts/hooks/pre-push .git/hooks/pre-push
set -e
remote_name="$1"
# Only deploy when pushing to the Gitea origin.
if [ "$remote_name" != "origin" ]; then
exit 0
fi
should_deploy=0
while read -r _local_ref _local_sha remote_ref _remote_sha; do
if [ "$remote_ref" = "refs/heads/master" ]; then
should_deploy=1
fi
done
if [ "$should_deploy" -ne 1 ]; then
exit 0
fi
repo_root="$(git rev-parse --show-toplevel)"
exec "$repo_root/scripts/deploy.sh"