From ea7b5b846c580e1ffca1f34a7a900124a41ea556 Mon Sep 17 00:00:00 2001 From: Brian Hursey Date: Tue, 1 Dec 2026 15:27:17 +0000 Subject: [PATCH] Install remote dependencies before deploying builds The rsync excludes node_modules, so a new dependency in the lockfile made the remote build fail until someone installed it by hand. Run npm ci on the server first and stop with the installer's exit code if it fails. --- scripts/deploy.mjs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/deploy.mjs b/scripts/deploy.mjs index 3723d33..9cdc51f 100644 --- a/scripts/deploy.mjs +++ b/scripts/deploy.mjs @@ -122,6 +122,12 @@ function main() { const sudoLines = SUDO_PASS ? `${SUDO_PASS}\n${SUDO_PASS}\n` : undefined; const script = [ `cd ${REMOTE_PATH} || exit 3`, + // node_modules is excluded from the rsync, so a new dependency in the + // lockfile would otherwise fail the build on a server that has never + // installed it. Installed as the login user: the checkout belongs to them. + 'npm ci --no-audit --no-fund', + 'deps=$?', + '[ "$deps" -eq 0 ] || { echo "deploy: remote npm ci failed ($deps)"; exit "$deps"; }', `${sudo}npm run build`, 'build=$?', '[ "$build" -eq 0 ] || { echo "deploy: remote build failed ($build)"; exit "$build"; }',