langleyfoxall / laravel-boilerplate

Boilerplate for Laravel with common tools/plugins for ease of development.
MIT License
2 stars 4 forks source link

Build JS and CSS in CI #37

Open jameswilddev opened 5 years ago

jameswilddev commented 5 years ago

At present, laravel-mix does not run in CI. This means that, for instance, a broken commit or merge will not be detected until a developer tries running it locally.

This adds a script step to install NPM and run a production laravel-mix build. If any errors occur, this causes the build to fail. I suspect this was the original intention given that .travis.yml specifies that node_modules be cached, which is not populated as far as I am aware.

As part of this, I had to upgrade laravel-mix as 2.0 does not build on Travis CI (node-sass binding problems).

Note that there are still committed (development) JS and CSS files in the public directory; I am not certain what these are used for. As there is no deployment step, the artifacts produced by laravel-mix are discarded at the end of the build.

ash123456789 commented 5 years ago

I think it would be ideal to use npm ci instead of npm install as it has a significant performance impact.

jameswilddev commented 5 years ago

Good point! Fixed.

jameswilddev commented 5 years ago

I'm also going to drop node_modules from the cache as npm ci deletes it anyway:

npm WARN prepare removing existing node_modules/ before installation