fix(lamassu): use node-pre-gyp for argon2 native module
Some checks failed
nix-bitcoin tests / build_test_drivers (push) Has been cancelled
nix-bitcoin tests / check_flake (push) Has been cancelled
nix-bitcoin tests / test_scenario (default) (push) Has been cancelled
nix-bitcoin tests / test_scenario (joinmarket-bitcoind-29) (push) Has been cancelled
nix-bitcoin tests / test_scenario (netns) (push) Has been cancelled
nix-bitcoin tests / test_scenario (netnsRegtest) (push) Has been cancelled

argon2 uses node-pre-gyp instead of node-gyp for building.
Split the native module rebuild logic to handle this correctly.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Patrick Mulligan 2026-01-09 23:17:29 +01:00
parent 584f342b39
commit a22b8fc81a

View file

@ -419,7 +419,9 @@ in
# Explicitly rebuild problematic native modules that pnpm rebuild may miss # Explicitly rebuild problematic native modules that pnpm rebuild may miss
# These modules often fail to build during pnpm rebuild due to missing toolchain in PATH # These modules often fail to build during pnpm rebuild due to missing toolchain in PATH
echo "==> Rebuilding specific native modules..." echo "==> Rebuilding specific native modules..."
for module in node-expat iconv argon2; do
# node-expat and iconv use standard node-gyp
for module in node-expat iconv; do
module_path=$(find node_modules/.pnpm -name "$module" -type d -path "*/$module" 2>/dev/null | head -1) module_path=$(find node_modules/.pnpm -name "$module" -type d -path "*/$module" 2>/dev/null | head -1)
if [ -n "$module_path" ] && [ -f "$module_path/binding.gyp" ]; then if [ -n "$module_path" ] && [ -f "$module_path/binding.gyp" ]; then
echo " Rebuilding $module at $module_path..." echo " Rebuilding $module at $module_path..."
@ -427,6 +429,13 @@ in
fi fi
done done
# argon2 uses node-pre-gyp (different build system)
argon2_path=$(find node_modules/.pnpm -name "argon2" -type d -path "*/argon2" 2>/dev/null | head -1)
if [ -n "$argon2_path" ]; then
echo " Rebuilding argon2 at $argon2_path..."
(cd "$argon2_path" && npx node-pre-gyp install --fallback-to-build 2>&1) || echo " Warning: argon2 rebuild failed, continuing..."
fi
echo "==> Building project..." echo "==> Building project..."
# Use setsid to run turbo in a new session, isolating it from signal propagation # Use setsid to run turbo in a new session, isolating it from signal propagation
# This prevents pnpm's signal handling issues (exit code -2) when turbo calls pnpm run build # This prevents pnpm's signal handling issues (exit code -2) when turbo calls pnpm run build