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.
This commit is contained in:
@@ -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"; }',
|
||||
|
||||
Reference in New Issue
Block a user