Build self-hosted HTTP Toolkit / build (linux-x64, ubuntu-latest, true) (push) Canceled after 0s
Build self-hosted HTTP Toolkit / build (macos-arm64, macos-latest, true) (push) Canceled after 0s
Build self-hosted HTTP Toolkit / build (windows-x64, windows-latest, false) (push) Canceled after 0s
Build self-hosted HTTP Toolkit / release (push) Canceled after 0s
45 lines
1.5 KiB
Bash
Executable File
45 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Apply our patches + overlay onto the pristine upstream submodules.
|
|
#
|
|
# Fails loudly if a patch no longer applies (i.e. upstream moved after a
|
|
# submodule bump), so you know exactly which patch to refresh. Idempotent:
|
|
# it resets each submodule's tracked files to the pinned commit first.
|
|
#
|
|
set -euo pipefail
|
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
cd "$ROOT"
|
|
|
|
echo "==> Ensuring submodules are initialised & at pinned commits"
|
|
git submodule update --init --recursive
|
|
|
|
apply_patches() {
|
|
local name="$1" dir="$2"
|
|
if [ ! -d "patches/$name" ]; then return; fi
|
|
|
|
echo "==> [$name] resetting to pinned commit"
|
|
git -C "$dir" checkout -- . 2>/dev/null || true
|
|
git -C "$dir" clean -fd -e node_modules 2>/dev/null || true
|
|
|
|
echo "==> [$name] applying patches"
|
|
local applied=0
|
|
for patch in patches/"$name"/*.patch; do
|
|
[ -e "$patch" ] || continue
|
|
echo " - $(basename "$patch")"
|
|
# --3way lets git fall back to a merge if context shifted slightly.
|
|
git -C "$dir" apply --3way "$ROOT/$patch"
|
|
applied=$((applied + 1))
|
|
done
|
|
echo "==> [$name] $applied patch(es) applied"
|
|
}
|
|
|
|
apply_patches ui httptoolkit-ui
|
|
apply_patches server httptoolkit-server
|
|
|
|
echo "==> Copying overlay files into httptoolkit-server"
|
|
cp -v overlay/server/htk-entry.ts httptoolkit-server/htk-entry.ts
|
|
cp -v overlay/server/src/htk-app.ts httptoolkit-server/src/htk-app.ts
|
|
cp -v overlay/server/src/commands/app.ts httptoolkit-server/src/commands/app.ts
|
|
|
|
echo "==> apply.sh complete."
|