Vai al contenuto principale
Traduzione Beta Non Ufficiale

Questa pagina è stata tradotta da PageTurner AI (beta). Non ufficialmente approvata dal progetto. Hai trovato un errore? Segnala problema →

Condividi la tua cache

La cache di calcolo fornita da Lerna può essere distribuita su più macchine. Puoi implementare una soluzione personalizzata oppure utilizzare Nx Cloud. Nx Cloud è un'applicazione che fornisce un'implementazione rapida e senza configurazione della cache distribuita. È completamente gratuita per progetti open source e per la maggior parte dei progetti closed-source (leggi di più qui).

Connettere il tuo workspace a Nx Cloud è semplice grazie al flusso di lavoro interattivo basato su browser. Puoi avviare il processo eseguendo il seguente comando dalla root del tuo workspace Lerna, che aprirà automaticamente una finestra del browser con il tuo URL di connessione univoco:

Terminal Output
npx nx connect-to-nx-cloud

✔ Opening Nx Cloud https://cloud.nx.app/connect/abc123456 in your browser to connect your workspace.

Per vedere la cache remota in azione, esegui:

lerna run build --scope=header && nx reset && lerna run build --scope=header
Terminal Output
> lerna run build --scope=header

> header@0.0.0 build
> rimraf dist && rollup --config

src/index.tsx → dist...
created dist in 786ms

—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

Lerna (powered by Nx) Successfully ran target build for project header (2s)

See logs and investigate cache misses at https://cloud.nx.app/runs/k0HDHACpL8


> NX Resetting the Nx workspace cache and stopping the Nx Daemon.

This might take a few minutes.


> NX Daemon Server - Stopped


> NX Successfully reset the Nx workspace.


> lerna run build --scope=header [remote cache]


> header@0.0.0 build
> rimraf dist && rollup --config


src/index.tsx → dist...
created dist in 786ms

—————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

Lerna (powered by Nx) Successfully ran target build for project header (664ms)

Nx read the output from the cache instead of running the command for 1 out of 1 tasks.

Nx Cloud made it possible to reuse header: https://nx.app/runs/P0X6ZGTkqZ

Ignorare il cloud

Analogamente a come --skip-nx-cache indica a Nx di non usare la cache, passare --no-cloud comunicherà a Nx di non utilizzare Nx Cloud. Puoi anche impostare NX_NO_CLOUD su true nel tuo ambiente.