@zerophreak Ok, did a test... this works perfectly fine and I will be adopting this in my process...
So long as you run npm ci BEFORE running npm run production in your build script. It works fine!
That should be your answer. Yes, you can do it and it is fine to do. As far as where to run it... just put it after npm ci
Here's my current deploy script for Envoy...
@servers(['www' => ['serverpilot@my-ip-address']])
@task('deploy', ['on' => 'www'])
cd ~/apps/my-app
php artisan down --message="Deploying New Code"
git pull origin master
composer install --optimize-autoloader --no-dev
php artisan config:clear
php artisan config:cache
php artisan route:clear
php artisan route:cache
npm ci
npm run production
php artisan migrate --force
php artisan up
@endtask
I literally just updated like 10 deployment scripts with this. I'm really happy this works. π
@snapey I like the thought of using Github actions but I am personally more comfortable with this approach in the meantime.