Fix NVM initialization for Deployer Vite builds
This commit is contained in:
+32
-4
@@ -176,17 +176,45 @@ task('absdev:composer', function (): void {
|
|||||||
desc('Build production Vite assets');
|
desc('Build production Vite assets');
|
||||||
|
|
||||||
task('absdev:build', function (): void {
|
task('absdev:build', function (): void {
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Deployer uses a non-interactive SSH shell.
|
||||||
|
* Explicitly load NVM so Node and npm are available.
|
||||||
|
*/
|
||||||
|
$node = <<<'SH'
|
||||||
|
export NVM_DIR="$HOME/.nvm"
|
||||||
|
|
||||||
|
if [ -s "$NVM_DIR/nvm.sh" ]; then
|
||||||
|
. "$NVM_DIR/nvm.sh"
|
||||||
|
nvm use 26
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! command -v node >/dev/null 2>&1; then
|
||||||
|
echo "ERROR: Node.js is not available in the deployment shell"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! command -v npm >/dev/null 2>&1; then
|
||||||
|
echo "ERROR: npm is not available in the deployment shell"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
node --version
|
||||||
|
npm --version
|
||||||
|
SH;
|
||||||
|
|
||||||
run(
|
run(
|
||||||
'cd {{release_path}}'
|
$node
|
||||||
. ' && npm ci --no-audit --no-fund'
|
. "\ncd {{release_path}}"
|
||||||
. ' && npm run build'
|
. "\nnpm ci --no-audit --no-fund"
|
||||||
|
. "\nnpm run build"
|
||||||
);
|
);
|
||||||
|
|
||||||
run(
|
run(
|
||||||
'test -f {{release_path}}/public/build/manifest.json'
|
'test -f {{release_path}}/public/build/manifest.json'
|
||||||
);
|
);
|
||||||
|
|
||||||
writeln('<info>Production assets built.</info>');
|
writeln('<info>Production Vite assets built.</info>');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user