I am building an API server and SPA separately. Since free dynos on Heroku are slow, to improve performance I put everything on one server.
yarn buildSPA project
- put that built files to the
publicdirectory of my rails app
- my rails app is deployed to Heroku
Works like a charm on a couple of projects.
I have a situation when I want to have my
master branch on github clean, without built content from SPA. Since I cannot have different
.gitignore for different
remotes (I wish it was possible 🤔), I use different branches:
feature branches for development and
heroku branch which I deploy to Heroku and don’t push to github.
So, basically, each time I need to deploy I merge
heroku, copy files from SPA and do the following
git push heroku heroku:master
Hope it will help with your pet projects