Skip to content

Instantly share code, notes, and snippets.

@pedropalhari
Created June 13, 2023 23:38
Show Gist options
  • Save pedropalhari/4607d245e5069def2e6730036a46464d to your computer and use it in GitHub Desktop.
Save pedropalhari/4607d245e5069def2e6730036a46464d to your computer and use it in GitHub Desktop.
A gist containing all System Environment Variables from Vercel in `.d.ts` form so it can be used from a TypeScript deployed project
/**
* For more info on this variables, please check System Environment Variables on Vercel:
*
* https://vercel.com/docs/concepts/projects/environment-variables/system-environment-variables#system-environment-variables
*
* - Palhari, 2023/6/13
*/
declare namespace NodeJS {
export interface ProcessEnv {
/**
* An indicator that the app is deployed and running on Vercel.
*
* Example: `1`.
*/
VERCEL: number;
/**
* An indicator that the code is running in a Continuous Integration environment.
*
* Example: `1`.
*
* **NOTE**: This Variable is only exposed during Build Step.
*/
CI: number;
/**
* The Environment that the app is deployed and running on.
*
* The value can be either `production`, `preview`, or `development`.
*/
VERCEL_ENV: "production" | "preview" | "development";
/**
* The domain name of the generated deployment URL.
*
* Example: `*.vercel.app`.
*
* The value does not include the protocol scheme `https://`.
*/
VERCEL_URL: string;
/**
* The domain name of the generated Git branch URL.
*
* Example: *-git-*.vercel.app.
*
* The value does not include the protocol scheme `https://`.
*/
VERCEL_BRANCH_URL: string;
/**
* The ID of the Region where the app is running.
*
* Example: `cdg1`. **NOTE**: This Variable is only exposed during Runtime for Serverless Functions.
*/
VERCEL_REGION: string;
/**
* The Git Provider the deployment is triggered from.
*
* Example: `github`.
*/
VERCEL_GIT_PROVIDER: string;
/**
* The origin repository the deployment is triggered from.
*
* Example: `my-site`.
*/
VERCEL_GIT_REPO_SLUG: string;
/**
* The account that owns the repository the deployment is triggered from.
*
* Example: `acme`.
*/
VERCEL_GIT_REPO_OWNER: string;
/**
* The ID of the repository the deployment is triggered from.
*
* Example: `117716146`.
*/
VERCEL_GIT_REPO_ID: number;
/**
* The git branch of the commit the deployment was triggered by.
*
* Example: `improve-about-page`.
*/
VERCEL_GIT_COMMIT_REF: string;
/**
* The git SHA of the commit the deployment was triggered by.
*
* Example: `fa1eade47b73733d6312d5abfad33ce9e4068081`.
*/
VERCEL_GIT_COMMIT_SHA: string;
/**
* The message attached to the commit the deployment was triggered by.
*
* Example: `Update about page`.
*/
VERCEL_GIT_COMMIT_MESSAGE: string;
/**
* The username attached to the author of the commit that the project was deployed by.
*
* Example: `johndoe`.
*/
VERCEL_GIT_COMMIT_AUTHOR_LOGIN: string;
/**
* The name attached to the author of the commit that the project was deployed by.
*
* Example: `John Doe`.
*/
VERCEL_GIT_COMMIT_AUTHOR_NAME: string;
/**
* The git SHA of the last successful deployment for the project and branch.
*
* Example: `fa1eade47b73733d6312d5abfad33ce9e4068080.`
*
* **NOTE**: This Variable is only exposed when an Ignored Build Step is provided.
*/
VERCEL_GIT_PREVIOUS_SHA: string;
/**
* The pull request id the deployment was triggered by.
* If a deployment is created on a branch before a pull request is made, this value will be an empty string.
*
* Example: `23`.
*/
VERCEL_GIT_PULL_REQUEST_ID: number;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment