# @vercel/remote-nx

> Remote caching for @nrwl/nx using Vercel Remote Cache

Latest version **2.0.0** (published 2024-02-05) · MPL-2.0 license · 0 weekly downloads

## Install

```sh
npm install @vercel/remote-nx
pnpm add @vercel/remote-nx
yarn add @vercel/remote-nx
bun add @vercel/remote-nx
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2024-02-05 |
| First published | 2022-09-15 |
| Weekly downloads | 0 |
| License | MPL-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 24 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Vercel |
| Maintainers | matt.straka, ijjk, quietshu, vercel-release-bot, nick.tracey, matheuss, chriswdmr, snokohn, zeit-bot |
| Keywords | vercel, nx, remote, cache, remotecache, blob, storage, typescript |

## Links

- npm: https://www.npmjs.com/package/@vercel/remote-nx
- npm.io page: https://npm.io/package/@vercel/remote-nx

## Dependencies (3)

- [chalk](https://npm.io/package/chalk.md) ^4.1.0
- [@vercel/remote](https://npm.io/package/@vercel/remote.md) 1.0.1
- [nx-remotecache-custom](https://npm.io/package/nx-remotecache-custom.md) ^17.1.1

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2024-02-05
- 0.0.7-alpha.3 (alpha) — 2022-09-16
- 1.1.1 — 2023-06-30
- 1.1.0 — 2023-06-30
- 1.0.1 — 2022-09-20
- 1.0.0 — 2022-09-19
- 0.0.9 — 2022-09-19
- 0.0.8 — 2022-09-17
- 0.0.7 — 2022-09-16
- 0.0.7-alpha.2 — 2022-09-16
- 0.0.7-alpha.0 — 2022-09-16
- 0.0.6 — 2022-09-15
- 0.0.5 — 2022-09-15
- 0.0.5-alpha.0 — 2022-09-15
- 0.0.4 — 2022-09-15

## README

# @vercel/remote-nx

[![@vercel/remote-nx](https://img.shields.io/npm/v/@vercel/remote-nx)](https://npmjs.org/@vercel/remote-nx)

This project implements a task runner for [@nrwl/nx](https://nx.dev) that caches build artifacts in the Vercel Remote Cache.

## Table of Contents
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

- [Setup](#setup)
- [Usage](#usage)
- [Run it 🚀](#run-it-)
- [Advanced Configuration](#advanced-configuration)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

## Setup

Let's assume you already have a Vercel Account. For the rest of the guide you will need a Vercel Access Token and your team ID. You can create a vercel access token in your [account settings](https://vercel.com/account/tokens). Your team ID can be found under your team settings page.

Have those handy as we'll need them to authorize your monorepo to Vercel's remote cache.

## Usage

```sh
npm install --save-dev @vercel/remote-nx
```

In your `nx.json` file you will find a `tasksRunnerOptions` field. Update this field so that it's using the installed `@vercel/remote-nx`

```jsonc filename=nx.json
{
  "tasksRunnerOptions": {
    "default": {
      "runner": "@vercel/remote-nx",
      "options": {
        "cacheableOperations": ["build", "test", "lint", "e2e"],
        "token": "<token>",
        "teamId": "<teamId>"
      }
    }
  }
}
```

You can specify your `token` and `teamId` in your nx.json or set them as environment variables.

| Parameter                 | Description                                           |  Environment Variable / .env   | `nx.json` |
| ------------------------- | ----------------------------------------------------- | ------------------------------ | --------- |
| Vercel Access Token       | Vercel access token with access to the provided team  | `NX_VERCEL_REMOTE_CACHE_TOKEN` | `token`   |
| Vercel Team ID (optional) | The Vercel Team ID that should share the Remote Cache | `NX_VERCEL_REMOTE_CACHE_TEAM`  | `teamId`  |

## Run it 🚀

Clear your local cache and rebuild your project.

```sh
nx reset
nx build
```

## Advanced Configuration

| Option       | Description                                                                                           |
| ------------ | ----------------------------------------------------------------------------------------------------- |
| `verbose`    | Set to receive full stack traces whenever errors occur. Best used for debugging. **Default:** `false` |
| `silent`     | Set to mute success and info logs. **Default:** `false`                                               |
| `dotenv`     | Set to `false` to disable reading `.env` into `process.env`. **Default:** `true`                      |
| `dotenvPath` | Set to read `.env` files from a different folder.                                                     |

```json
"tasksRunnerOptions": {
  "default": {
    "runner": "@vercel/remote-nx",
    "options": {
      "verbose": true,
      "silent": true
    }
  }
}
```

---

Credit to [`nx-remotecache-custom` examples](https://www.npmjs.com/package/nx-remotecache-custom).

---
_Source: https://npm.io/package/@vercel/remote-nx · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
