[build-utils] Fix getPrefixedEnvVars() to handle VERCEL_PROJECT_PRODUCTION_URL (#11506)

This will ensure the framework env var prefix is applied to
`VERCEL_PROJECT_PRODUCTION_URL` as well.


https://vercel.com/docs/projects/environment-variables/system-environment-variables#framework-environment-variables
This commit is contained in:
Steven
2024-04-29 14:20:01 -04:00
committed by GitHub
parent 256d0fd463
commit 21f5e7375e
3 changed files with 8 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
---
"@vercel/build-utils": patch
---
[build-utils] Add `VERCEL_PROJECT_PRODUCTION_URL` framework env var prefix

View File

@@ -19,6 +19,7 @@ export function getPrefixedEnvVars({
'VERCEL_ENV',
'VERCEL_REGION',
'VERCEL_BRANCH_URL',
'VERCEL_PROJECT_PRODUCTION_URL',
];
const newEnvs: Envs = {};
if (envPrefix && envs.VERCEL_URL) {

View File

@@ -15,6 +15,7 @@ describe('Test `getPrefixedEnvVars()`', () => {
VERCEL_URL: 'example.vercel.sh',
VERCEL_ENV: 'production',
VERCEL_BRANCH_URL: 'example-git-main-acme.vercel.app',
VERCEL_PROJECT_PRODUCTION_URL: 'example.com',
USER_ENV_VAR_NOT_VERCEL: 'example.com',
VERCEL_ARTIFACTS_TOKEN: 'abc123',
FOO: 'bar',
@@ -24,6 +25,7 @@ describe('Test `getPrefixedEnvVars()`', () => {
NEXT_PUBLIC_VERCEL_URL: 'example.vercel.sh',
NEXT_PUBLIC_VERCEL_ENV: 'production',
NEXT_PUBLIC_VERCEL_BRANCH_URL: 'example-git-main-acme.vercel.app',
NEXT_PUBLIC_VERCEL_PROJECT_PRODUCTION_URL: 'example.com',
TURBO_CI_VENDOR_ENV_KEY: 'NEXT_PUBLIC_VERCEL_',
},
},