1.0.0 • Published 5 months ago

nx-remotecache-google v1.0.0

Weekly downloads
-
License
ISC
Repository
github
Last release
5 months ago

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

NxRemote 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
ParameterDescriptionEnvironment Variable / .envnx.json
Project IDId of your project on GCPNXCACHE_GOOGLE_STORAGE_PROJECT_IDproject_id
Client NameClient email of your service accountNXCACHE_GOOGLE_STORAGE_CLIENT_EMAILclient_email
Private KeyPrivate key of your service accountNXCACHE_GOOGLE_STORAGE_PRIVATE_KEYprivate_key
Bucket NameBucket name where to store cacheNXCACHE_GOOGLE_STORAGE_BUCKETbucket
{
  "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

OptionEnvironment Variable / .envDescription
nameNXCACHE_NAMESet to provide task runner name for logging. Overrides name provided in implementation.
verboseSet to receive full stack traces whenever errors occur. Best used for debugging. Default: false
silentSet to mute success and info logs. Default: false
readNXCACHE_READSet to enable / disable reading from the remote cache. Default: true
writeNXCACHE_WRITESet to enable / disable writing to the remote cache. Default: true
dotenvSet to false to disable reading .env into process.env. Default: true
dotenvPathSet to read .env files from a different folder.
"tasksRunnerOptions": {
  "default": {
    "options": {
      "name": "My Storage",
      "verbose": true,
      "silent": true
    }
  }
}

All Custom Runners

RunnerStorage
nx-remotecache-azureAzure Blob Storage
nx-remotecache-minioMinIO Storage
nx-remotecache-googleGoogle Cloud Storage