nx-vercel-utils
v0.1.0
Published
Nx plugin to deploy env variables to Vercel
Downloads
15
Readme
nx-vercel-utils
Features
- Upload and replace all environment variables from your
.env
file to vercel
Install
pnpm i -D nx-vercel-utils
Description
This plugin adds a env
executor that will deploy your environment variables to vercel.
Prerequisites
- You will need to have the vercel cli installed. Either globally or locally in your project. If you install it globally you have to set
packageManager
option toglobal
.
pnpm i -D vercel
You also need to cd into the project and run vercel link
to link your project to your vercel account. That will create a .vercel folder.
Example
cd apps/frontend
vercel login # if you haven't logged in
vercel link
Executors
Env
See the example here
...
"targets": {
"deploy-vercel-env": {
"executor": "../dist:env",
"options": {
"flavors": {
"development": "development",
"production": "production",
"staging": "staging"
},
"vercelProjectName": "your-vercel-project-name"
}
},
You need to create .env.{flavor} files for each flavor you want to deploy. The flavor name will be the key in the flavors
object.
Options
| Option | Description | Default | Alias |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | --------- |
| vercelProjectName
| The name of the vercel project. | required | project
|
| flavors
| A object of the flavors to use, the key is the flavor name and value is either 'production', 'development', 'preview' or 'preview:{branch}'. Read more here | required | |
| flavor
| The flavor to use, default will be the first key in the flavors
object. | | |
| silent
| Whether to suppress all logs. | false
| s
|
| verbose
| Whether to run the command with verbose logging. | false
| v
|
| packageManager
| The package manager to use for deploying with firebase-tools. Either: pnpm
, npm
, yarn
or global
. |
| concurrency
| The number of environments to deploy in parallel | 10 | c
|
Examples
pnpm nx deploy-vercel-env frontend
# will deploy the environment variables for the first flavor in the flavors object
pnpm nx deploy-vercel-env frontend --flavor staging