Thanks for this! I made a few changes to my setup so I'm not always running production environments when I want to hit say staging backend.
Strip out "vercel-build": "npm run build:ssr" from package.json
Update "build:ssr" to "ng build --configuration production && ng run project-name-here:server"
Create vercel.sh in your root directory of the project
if [[ $VERCEL_GIT_COMMIT_REF == "main" ]]; then
echo "This is our production branch"
npm run build:ssr
elif [[ $VERCEL_GIT_COMMIT_REF == "master" ]]; then
echo "This is our production branch"
npm run build:ssr
else
echo "This is not our production branch"
npm run build:staging-ssr
fi
The above is just looking at what branch is being deployed, if it's main/master build:ssr will run if its any other branch my staging-environment deployment script will run.
Settings on Vercel for the project add custom build command of sh vercel.sh
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thanks for this! I made a few changes to my setup so I'm not always running production environments when I want to hit say staging backend.
Strip out
"vercel-build": "npm run build:ssr"
from package.jsonUpdate
"build:ssr"
to"ng build --configuration production && ng run project-name-here:server"
Create vercel.sh in your root directory of the project
The above is just looking at what branch is being deployed, if it's main/master build:ssr will run if its any other branch my staging-environment deployment script will run.
Settings on Vercel for the project add custom build command of
sh vercel.sh