@@ -38,13 +38,22 @@ export const prNumber = process.env.REVIEW_ID || process.env.VERCEL_GIT_PULL_REQ
3838 */
3939export const gitBranch = process . env . BRANCH || process . env . VERCEL_GIT_COMMIT_REF
4040
41+ /**
42+ * Environment variable `VERCEL_ENV` provided by Vercel.
43+ * `production`, `preview`, `development`, or a custom environment name (e.g. `canary`).
44+ * @see {@link https://vercel.com/docs/environment-variables/system-environment-variables#VERCEL_ENV }
45+ *
46+ * Whether this is the canary custom Vercel environment (main.npmx.dev).
47+ */
48+ export const isCanary = process . env . VERCEL_ENV === 'canary'
49+
4150/**
4251 * Environment variable `CONTEXT` provided by Netlify.
4352 * `dev`, `production`, `deploy-preview`, `branch-deploy`, `preview-server`, or a branch name
4453 * @see {@link https://docs.netlify.com/build/configure-builds/environment-variables/#build-metadata }
4554 *
4655 * Environment variable `VERCEL_ENV` provided by Vercel.
47- * `production`, `preview`, or `development`
56+ * `production`, `preview`, `development`, or a custom environment name (e.g. `canary`).
4857 * @see {@link https://vercel.com/docs/environment-variables/system-environment-variables#VERCEL_ENV }
4958 *
5059 * Whether this is some sort of preview environment.
@@ -142,13 +151,7 @@ export async function getFileLastUpdated(path: string) {
142151
143152export async function getEnv ( isDevelopment : boolean ) {
144153 const { commit, shortCommit, branch } = await getGitInfo ( )
145- const env = isDevelopment
146- ? 'dev'
147- : isPreview
148- ? 'preview'
149- : branch === 'main'
150- ? 'canary'
151- : 'release'
154+ const env = isDevelopment ? 'dev' : isCanary ? 'canary' : isPreview ? 'preview' : 'release'
152155 const previewUrl = getPreviewUrl ( )
153156 const productionUrl = getProductionUrl ( )
154157 return {
0 commit comments