codeforkansascity / Neighborhood-Dashboard

We're working to help neighborhoods help themselves by giving them easy access to useful data to allow them to identify and track problem areas in their neighborhood.
https://neighborhood-dashboard.codeforkc.org/
MIT License
18 stars 9 forks source link

Rebuild client-side application on each deployment #151

Closed moldybeats closed 5 years ago

moldybeats commented 5 years ago

Deploying the app to Heroku does not currently trigger a build of the app_bundle.js file. This means that changes to *.jsx files won't appear in Production unless we build app_bundle.js locally and commit those changes. It would be much cleaner if we could rebuild the client-side code automatically on the server after each deployment.

I think we want to use Heroku's "release phase" hooks for this: https://devcenter.heroku.com/articles/release-phase

moldybeats commented 5 years ago

I added the nodejs buildpack to our Heroku app (in addition to the ruby buildpack). I think this is what we need in order to run webpack on deployment. Our package.json file already contains a scripts key with some webpack commands. I'm guessing these commands worked at one point in a previous deployment of the app, so I'm going to leave them in place for now and see what happens on our next deployment. If they don't work, we may need to tweak those commands.

See: https://devcenter.heroku.com/articles/deploying-nodejs

moldybeats commented 5 years ago

webpack is running on each Heroku deployment now, but I think we may have to fiddle with the settings to find the command for a production build. I'm not sure app_bundle.js is really compressed like it should be.

moldybeats commented 5 years ago

On each Heroku deployment, the webpack -p command runs now to create a production-ready version of app_bundle.js.