What's New?
Hashing Environment Variables
When you use turbo
with tools which inline environment variables at build time (e.g. Next.js or Create React App), it is important you tell turbo
about it. Otherwise, you could ship a cached artifact with the wrong environment variables!
With this PR, you can now change a task hash by doing any of the following:
- Including environment variables in a
dependsOn
in yourpipeline
definition prefixed by a$
will impact the cache fingerprint on a per-task or per-package-task basis. - Including environment variables in
globalDependencies
list prefixed by a$
will impact the cache fingerprint of all tasks. - Including files or globs of files in
globalDependencies
will impact the cache fingerprint of all tasks. - The value of any environment variable that includes
THASH
in its name will impact the cache fingerprint of all tasks.
Example Configuration
{
"turbo": {
"pipeline": {
"build": {
"dependsOn": {
"^build"
// env vars will impact hashes of all "build" tasks
"$SOME_ENV_VAR"
},
"outputs": ["dist/**"]
},
"web#build": { // override settings for the "build" task for the "web" app
"dependsOn": [
"^build",
// env vars that will impact the hash of "build" task for only "web" app
"$STRIPE_SECRET_KEY",
"$NEXT_PUBLIC_STRIPE_PUBLIC_KEY",
"$NEXT_PUBLIC_ANALYTICS_ID",
],
"outputs": [".next/**"],
},
"docs#build": { // override settings for the "build" task for the "docs" app
"dependsOn": [
"^build",
// env vars that will impact the hash of "build" task for only "web" app
"$STRIPE_SECRET_KEY",
"$NEXT_PUBLIC_STRIPE_PUBLIC_KEY",
"$NEXT_PUBLIC_ANALYTICS_ID",
],
"outputs": [".next/**"],
}
},
"baseBranch": "origin/main",
"globalDependencies": [
"$GITHUB_TOKEN"// env var that will impact the hashes of all tasks,
"tsconfig.json" // file contents will impact the hashes of all tasks,
".env.*" // glob file contents will impact the hashes of all tasks,
],
}
}
Commits
- Bump @babel/core from 7.16.0 to 7.16.7 by @dependabot in #477
- fix kitchen-sink test #466 by @kbenrafik in #473
- Bump @types/jest from 27.0.3 to 27.4.0 by @dependabot in #476
- docs: Fix gap on open mobile nav with banner by @jaredpalmer in #507
- docs: Papercuts by @jaredpalmer in #513
- docs: add missing flag for pnpm install command by @fwouts in #520
- docs: add privacy / security questions to faq by @jaredpalmer in #522
- fix: pnpx command is deprecated in version 6.x by @KieSun in #486
New Contributors
- @kbenrafik made their first contribution in #473
- @fwouts made their first contribution in #520
- @KieSun made their first contribution in #486
Full Changelog: v1.0.24...v1.0.25-canary.0