At work we use Envoyer to build our assets as part of our deployment. This has removed a lot of the headaches related to merge conflicts.
However, due to this, deployment takes a long time. Even when you just deploy a update to a controller or some other things.
We use these deployment hooks to run npm install
and npm run production
only if there's been changes to the source files.
The hooks should work as long as your assets are in resources/assets
(which was the default up to Laravel 5.7).
@tormjens You're right! Wouldn't it make sense then to check at the npm-install.sh if the
package-lock.json
has changes – if not we copy the node_modules folder from the (still) current release. If there are any changes, we will run annpm install
as usual.The step for npm run production can then remain as described above.