I am currently hosting my express API on Heroku with two separate projects set up: one for my Master Branch (Prod) and the other for my Development branch (Dev).
Inside my package.json file, I have defined two scripts:
"scripts": {
"devStart": "export NODE_ENV=development && nodemon server.js",
"start": "export NODE_ENV=production && node server.js"
}
I am looking for a way to automatically run the "DevStart" script on the Development branch and the "start" script on the Master branch. Currently, the production environment is running smoothly with the node start
default script.
While I am aware that I can use a procfile
to specify commands, I am hesitant as both Dev and Prod branches share the same codebase, requiring me to manually update the procfile with each commit. Is there a more dynamic solution to handle this configuration?