fix(faith): resolve 1962 bundles via createRequire and add deploy pre-push hook
CI / update (push) Successful in 1m27s
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:
Executable
+30
@@ -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"
|
||||
Reference in New Issue
Block a user