nx-remotecache-google
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

npm package link

nx-remotecache-google

A task runner for @nrwl/nx 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 are explained in the NX documentation.

This package was built with nx-remotecache-custom 🙌

Compatability

Nx Remote Cache
>= 17.0.0 < 18 >= 17.0.0 < 18
>= 16.9.0 < 17 >= 5.0.0 < 17
< 16.9.0 < 5.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
{
  "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.
"tasksRunnerOptions": {
  "default": {
    "options": {
      "name": "My Storage",
      "verbose": true,
      "silent": true
    }
  }
}

All Custom Runners

Runner Storage
nx-remotecache-azure Azure Blob Storage
nx-remotecache-minio MinIO Storage
nx-remotecache-google Google Cloud Storage

Package Sidebar

Install

npm i nx-remotecache-google

Weekly Downloads

44

Version

1.0.0

License

ISC

Unpacked Size

8.01 kB

Total Files

4

Last publish

Collaborators

  • mabeur