Skip to content

Commit bc571aa

Browse files
committed
chore(build): set cache read/write based on build type
1 parent f9e0982 commit bc571aa

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

scripts/turbo/index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,21 @@ const path = require("path");
44

55
const runTurbo = async (task, args, { apiSecret, apiEndpoint, apiSignatureKey } = {}) => {
66
const command = ["turbo", "run", task, "--concurrency=100%", "--output-logs=hash-only"];
7+
8+
const cacheReadWriteKey = process.env.AWS_JSV3_TURBO_CACHE_BUILD_TYPE ?? "dev";
9+
10+
const cacheReadWrite = {
11+
// release is write-only
12+
RELEASE: "--cache=local:,remote:w",
13+
// preview is read/write
14+
PREVIEW: "--cache=local:,remote:rw",
15+
// dev is read-only
16+
dev: "--cache=local:rw,remote:r",
17+
};
18+
19+
command.push(cacheReadWrite[cacheReadWriteKey]);
720
command.push(...args);
21+
822
const turboRoot = path.join(__dirname, "..", "..");
923

1024
const turboEnv = {

0 commit comments

Comments
 (0)