# Minka NX Remote Cache

This repository provides an NX runner that utilizes a Google Cloud Platform (GCP) bucket as distributed cache storage.

## Repo & Contributing

Currently the repo is private. If you are a part of the minka organization, you can contribute at: https://github.com/minkainc/ledger-nx-remote-cache

## Features

- Distributed caching using GCP bucket
- Easy integration with NX workspace

## Installation

To install the package, run:

```bash
npm install @minka/nx-remote-cache --save-dev
```

## Configuration

To use, you must do 3 things.

1.  To configure the NX runner to use the GCP bucket as the cache storage, update your `nx.json` file's `runner` as follows. This is not needed if you perform step 3.

```json
{
  "tasksRunnerOptions": {
    "default": {
      "runner": "@minka/nx-remote-cache"
    },
    "options": {
      "bucket": "your-bucket-name",
      "project_id": "your-gcp-project-id"
    }
  }
}
```

2.  For the runner to be able to authenticate to GCP, you must auth to gcloud as shown below.

```
gcloud auth application-default login
```

3. If you did not set `project_id` and `bucket` in step 1, you can also set these by exporting these env vars to your environment:

```
export NXCACHE_GOOGLE_STORAGE_PROJECT_ID=<your-gcp-project-id>
export NXCACHE_GOOGLE_STORAGE_BUCKET=<your-bucket-name>
```

### Options

- `project`: The GCP project ID.
- `bucket`: The name of the GCP bucket to be used for caching.

## Usage

Once configured, the NX runner will automatically use the specified GCP bucket for distributed caching. You can run your NX commands as usual.

## Authentication

Ensure that you have performed step 2 from the `Configuration` section.
