Generate npm lockfile during production deployment
This commit is contained in:
+24
-24
@@ -177,42 +177,42 @@ desc('Build production Vite assets');
|
|||||||
|
|
||||||
task('absdev:build', function (): void {
|
task('absdev:build', function (): void {
|
||||||
|
|
||||||
/*
|
$script = <<<'SH'
|
||||||
* Deployer uses a non-interactive SSH shell.
|
set -euo pipefail
|
||||||
* Explicitly load NVM so Node and npm are available.
|
|
||||||
*/
|
|
||||||
$node = <<<'SH'
|
|
||||||
export NVM_DIR="$HOME/.nvm"
|
export NVM_DIR="$HOME/.nvm"
|
||||||
|
|
||||||
if [ -s "$NVM_DIR/nvm.sh" ]; then
|
if [ ! -s "$NVM_DIR/nvm.sh" ]; then
|
||||||
|
echo "ERROR: NVM installation missing"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
. "$NVM_DIR/nvm.sh"
|
. "$NVM_DIR/nvm.sh"
|
||||||
nvm use 26
|
nvm use 26
|
||||||
fi
|
|
||||||
|
|
||||||
if ! command -v node >/dev/null 2>&1; then
|
cd {{release_path}}
|
||||||
echo "ERROR: Node.js is not available in the deployment shell"
|
|
||||||
|
echo "Node: $(node --version)"
|
||||||
|
echo "npm: $(npm --version)"
|
||||||
|
|
||||||
|
if [ ! -f package.json ]; then
|
||||||
|
echo "ERROR: package.json missing"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! command -v npm >/dev/null 2>&1; then
|
# Lockfile is deliberately excluded from Git.
|
||||||
echo "ERROR: npm is not available in the deployment shell"
|
# Generate it within this deployment release.
|
||||||
exit 1
|
if [ ! -f package-lock.json ]; then
|
||||||
|
npm install --package-lock-only --ignore-scripts --no-audit --no-fund
|
||||||
fi
|
fi
|
||||||
|
|
||||||
node --version
|
npm ci --no-audit --no-fund
|
||||||
npm --version
|
npm run build
|
||||||
|
|
||||||
|
test -f public/build/manifest.json
|
||||||
SH;
|
SH;
|
||||||
|
|
||||||
run(
|
run($script);
|
||||||
$node
|
|
||||||
. "\ncd {{release_path}}"
|
|
||||||
. "\nnpm ci --no-audit --no-fund"
|
|
||||||
. "\nnpm run build"
|
|
||||||
);
|
|
||||||
|
|
||||||
run(
|
|
||||||
'test -f {{release_path}}/public/build/manifest.json'
|
|
||||||
);
|
|
||||||
|
|
||||||
writeln('<info>Production Vite assets built.</info>');
|
writeln('<info>Production Vite assets built.</info>');
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user