From bc571aacc7b411b7779d2167d4c2a8a6879c7c74 Mon Sep 17 00:00:00 2001 From: George Fu Date: Tue, 28 Jan 2025 16:33:48 -0500 Subject: [PATCH] chore(build): set cache read/write based on build type --- scripts/turbo/index.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/scripts/turbo/index.js b/scripts/turbo/index.js index a7d539c5be64..3f400a58eaee 100644 --- a/scripts/turbo/index.js +++ b/scripts/turbo/index.js @@ -4,7 +4,21 @@ const path = require("path"); const runTurbo = async (task, args, { apiSecret, apiEndpoint, apiSignatureKey } = {}) => { const command = ["turbo", "run", task, "--concurrency=100%", "--output-logs=hash-only"]; + + const cacheReadWriteKey = process.env.AWS_JSV3_TURBO_CACHE_BUILD_TYPE ?? "dev"; + + const cacheReadWrite = { + // release is write-only + RELEASE: "--cache=local:,remote:w", + // preview is read/write + PREVIEW: "--cache=local:,remote:rw", + // dev is read-only + dev: "--cache=local:rw,remote:r", + }; + + command.push(cacheReadWrite[cacheReadWriteKey]); command.push(...args); + const turboRoot = path.join(__dirname, "..", ".."); const turboEnv = {