# nx-remotecache-google

> Remote caching for @nrwl/nx using Google Cloud Storage

Latest version **1.1.0** (published 2024-08-05) · ISC license · 0 weekly downloads

## Install

```sh
npm install nx-remotecache-google
pnpm add nx-remotecache-google
yarn add nx-remotecache-google
bun add nx-remotecache-google
```

## 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 | 1.1.0 |
| Published | 2024-08-05 |
| First published | 2023-12-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 7.8 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | ydomenjoud |
| Maintainers | mabeur |
| Keywords | nx, remote-cache, gcp, gcs, google-storage |

## Links

- npm: https://www.npmjs.com/package/nx-remotecache-google
- Repository: https://github.com/ydomenjoud/nx-remotecache-gcp
- Homepage: https://github.com/ydomenjoud/nx-remotecache-gcp#readme
- Issues: https://github.com/ydomenjoud/nx-remotecache-gcp/issues
- npm.io page: https://npm.io/package/nx-remotecache-google

## Dependencies (3)

- [nx](https://npm.io/package/nx.md) ^19.0.0
- [@google-cloud/storage](https://npm.io/package/@google-cloud/storage.md) ^7.12.0
- [nx-remotecache-custom](https://npm.io/package/nx-remotecache-custom.md) ^19.0.0

## 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

- 1.1.0 (latest) — 2024-08-05
- 1.0.0 — 2023-12-21

## README

[![npm package link](https://img.shields.io/npm/v/nx-remotecache-google)](https://www.npmjs.com/package/nx-remotecache-google)

# nx-remotecache-google

A task runner for [@nrwl/nx](https://nx.dev) that uses an Google Cloud Storage as a remote cache.
This enables all team members and CI servers to share a single cache.
The concept and benefits of [computation caching](https://nx.dev/angular/guides/computation-caching) are explained in the NX documentation.

This package was built with [nx-remotecache-custom](https://www.npmjs.com/package/nx-remotecache-custom) 🙌

## Compatibility

|  Nx               | nx-remotecache-google |
| ----------------- |---------------------|
|  `>= 19.0.0 < 20` | `= 1.1.0`           |
|  `>= 17.0.0 < 18` | `= 1.0.0`           |

## Setup

```
npm install --save-dev nx-remotecache-google
```

| Parameter   | Description                          | Environment Variable / .env           | `nx.json`      |
|-------------|--------------------------------------|---------------------------------------|----------------|
| Project ID  | Id of your project on GCP            | `NXCACHE_GOOGLE_STORAGE_PROJECT_ID`   | `project_id`   |
| Client Name | Client email of your service account | `NXCACHE_GOOGLE_STORAGE_CLIENT_EMAIL` | `client_email` |
| Private Key | Private key of your service account  | `NXCACHE_GOOGLE_STORAGE_PRIVATE_KEY`  | `private_key`  |
| Bucket Name | Bucket name where to store cache     | `NXCACHE_GOOGLE_STORAGE_BUCKET`       | `bucket`       |

```json
{
  "tasksRunnerOptions": {
    "default": {
      "runner": "nx-remotecache-google",
      "options": {
        // All of the gcp specific options can also be inserted via environment variables! ⬆️
        "private_key": "-----BEGIN PRIVATE KEY-----\n.........\n-----END PRIVATE KEY-----",
        "project_id": "your-project-id",
        "client_email": "nx-storage-account@your-project-id.gserviceaccount.com",
        "bucket": "gs://your-storage-bucket",
        "cacheableOperations": ["build", "test", "lint", "e2e"]
      }
    }
  }
}
```

## Run it 🚀

Running tasks should now show the storage or retrieval from the remote cache:

```

chunk (runtime: main) main.js (main) 827 KiB [entry] [rendered]
webpack compiled successfully (xxxxx)

------------------------------------------------------------------------------
Stored output to remote cache: GCP Storage
File: 1679426766935461636258771.tar.gz
------------------------------------------------------------------------------

```

## Advanced Configuration

| Option       | Environment Variable / .env | Description                                                                                           |
| ------------ | --------------------------- | ----------------------------------------------------------------------------------------------------- |
| `name`       | `NXCACHE_NAME`              | Set to provide task runner name for logging. Overrides name provided in implementation.               |
| `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`                                               |
| `read`       | `NXCACHE_READ`              | Set to enable / disable reading from the remote cache. **Default:** `true`                            |
| `write`      | `NXCACHE_WRITE`             | Set to enable / disable writing to the remote cache. **Default:** `true`                              |
| `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": {
    "options": {
      "name": "My Storage",
      "verbose": true,
      "silent": true
    }
  }
}
```

## All Custom Runners

| Runner                                                                       | Storage              |
|------------------------------------------------------------------------------|----------------------|
| [nx-remotecache-azure](https://www.npmjs.com/package/nx-remotecache-azure)   | Azure Blob Storage   |
| [nx-remotecache-minio](https://www.npmjs.com/package/nx-remotecache-minio)   | MinIO Storage        |
| [nx-remotecache-google](https://www.npmjs.com/package/nx-remotecache-google) | Google Cloud Storage |

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