-
Notifications
You must be signed in to change notification settings - Fork 585
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(turbo): add build script and update package.json to use turbo r…
…emote cache (#6354) * chore(turbo): add build script and update package.json to use turbo build with remote caching * chore(turbo): updated Turbo version --------- Co-authored-by: Isaiah Hall <[email protected]>
- Loading branch information
1 parent
7b4b333
commit d88855e
Showing
4 changed files
with
1,842 additions
and
1,854 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Turbo Build Script | ||
|
||
This script is designed to handle the execution of Turborepo builds, using the remote cache when env variables are present. | ||
|
||
## Prerequisites | ||
|
||
Before running this script, ensure that you have installed dependencies with `yarn`. | ||
|
||
## Environment Variables | ||
|
||
To access the remote cache for Turborepo builds, you need to set the following environment variables: | ||
|
||
- `AWS_JSV3_TURBO_CACHE_API_SECRET`: The API secret for authenticating with the remote cache. | ||
- `AWS_JSV3_TURBO_CACHE_API_ENDPOINT`: The API endpoint for the remote cache. | ||
|
||
## Usage | ||
|
||
To run the Turborepo build, execute the following command: | ||
|
||
``` | ||
node ./scripts/turbo build <Optional Turborepo Args> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Build script to handle Turborepo build execution | ||
const { spawnProcess } = require("../utils/spawn-process"); | ||
const path = require("path"); | ||
|
||
const runTurbo = async (task, args, apiSecret, apiEndpoint) => { | ||
let command = ["turbo", "run", task]; | ||
if (apiSecret && apiEndpoint) { | ||
command = command.concat([ | ||
`--api=${apiEndpoint}`, | ||
"--team=aws-sdk-js", | ||
`--token=${apiSecret}`, | ||
"--concurrency=100%", | ||
]); | ||
} | ||
command = command.concat(args); | ||
const turboRoot = path.join(__dirname, "..", ".."); | ||
try { | ||
return await spawnProcess("npx", command, { stdio: "inherit", cwd: turboRoot }); | ||
} catch (error) { | ||
console.error("Error running turbo:", error); | ||
} | ||
}; | ||
|
||
const main = async () => { | ||
const apiSecret = process.env.AWS_JSV3_TURBO_CACHE_API_SECRET; | ||
const apiEndpoint = process.env.AWS_JSV3_TURBO_CACHE_API_ENDPOINT; | ||
|
||
const args = process.argv.slice(2); | ||
|
||
if (!apiSecret || !apiEndpoint) { | ||
await runTurbo(args[0], args.slice(1)); | ||
} else { | ||
await runTurbo(args[0], args.slice(1), apiSecret, apiEndpoint); | ||
} | ||
}; | ||
|
||
main(); |
Oops, something went wrong.