Skip to content

Commit

Permalink
feat(docs): add "!.next/cache/**" everywhere (vercel#4159)
Browse files Browse the repository at this point in the history
Turbo doesn't need to cache this (it's cached by the Vercel build cache)
and can make cache unnecessarily large.
  • Loading branch information
tknickman authored Mar 17, 2023
1 parent 6f98ef0 commit f843837
Show file tree
Hide file tree
Showing 36 changed files with 67 additions and 59 deletions.
2 changes: 1 addition & 1 deletion docs/pages/blog/turbo-0-4-0.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ Building on the example from above, you can now set cache output conventions acr
"pipeline": {
"build": {
// Cache anything in dist or .next directories emitted by a `build` command
"outputs": ["dist/**", ".next/**"]
"outputs": ["dist/**", ".next/**", "!.next/cache/**"]
"dependsOn": ["^build"]
},
"test": {
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/blog/turbo-1-1-0.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ You can now control `turbo`'s [cache fingerprinting (a.k.a. hashing)](/repo/docs
"$NEXT_PUBLIC_STRIPE_PUBLIC_KEY",
"$NEXT_PUBLIC_ANALYTICS_ID",
],
"outputs": [".next/**"],
"outputs": [".next/**", "!.next/cache/**"],
},
"docs#build": { // override settings for the "build" task for the "docs" app
"dependsOn": [
Expand All @@ -113,7 +113,7 @@ You can now control `turbo`'s [cache fingerprinting (a.k.a. hashing)](/repo/docs
"$NEXT_PUBLIC_STRIPE_PUBLIC_KEY",
"$NEXT_PUBLIC_ANALYTICS_ID",
],
"outputs": [".next/**"],
"outputs": [".next/**", "!.next/cache/**"],
}
},
"globalDependencies": [
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/blog/turbo-1-3-0.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ Let's assume that the Next.js `docs-site` renders the markdown files from the `.
// ... omitted for brevity
"build": {
"dependsOn": ["^build"],
"outputs": [".next/**", "dist/**"]
"outputs": [".next/**", "!.next/cache/**", "dist/**"]
},
"docs#build": {
"dependsOn": ["^build"],
"outputs": [".next/**"],
"outputs": [".next/**", "!.next/cache/**"],
// Define set of relevant globs which impact caching of docs site
// builds
"inputs": [
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/blog/turbo-1-6-0.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Try it out now by [starting from the example](https://github.com/vercel/turbo/tr
{
"pipeline": {
"build": {
"outputs": [".next/**"]
"outputs": [".next/**", "!.next/cache/**"]
},
"lint": {
"outputs": []
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/blog/turbo-1-8-0.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ For example, imagine your monorepo has a Next.js app and a SvelteKit app, and yo
"pipeline": {
"build": {
// dependsOn is inherited from root
"outputs": [".next/**"]
"outputs": [".next/**", "!.next/cache/**"]
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions docs/pages/repo/docs/core-concepts/caching.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ the values of environment variables:
"NEXT_PUBLIC_STRIPE_PUBLIC_KEY",
"NEXT_PUBLIC_ANALYTICS_ID"
],
"outputs": [".next/**"]
"outputs": [".next/**", "!.next/cache/**"]
}
}
}
Expand Down Expand Up @@ -250,7 +250,7 @@ To alter the cache for _all_ tasks, you can declare environment variables in the
"NEXT_PUBLIC_STRIPE_PUBLIC_KEY",
"NEXT_PUBLIC_ANALYTICS_ID"
],
"outputs": [".next/**"],
"outputs": [".next/**", "!.next/cache/**"],
},
},
+ "globalEnv": [
Expand Down Expand Up @@ -376,7 +376,7 @@ invoking `turbo`!
"build": {
"dependsOn": ["^build"],
"env": ["SOME_ENV_VAR"],
"outputs": [".next/**"],
"outputs": [".next/**", "!.next/cache/**"],
},
}
}
Expand All @@ -401,7 +401,7 @@ To ensure you end up with the correct caching behavior for your task, add these
"build": {
"dependsOn": ["^build"],
"env": ["SOME_ENV_VAR"],
"outputs": [".next/**"],
"outputs": [".next/**", "!.next/cache/**"],
},
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ with a single `turbo.json` at the root like this:
{
"pipeline": {
"build": {
"outputs": [".next/**", ".svelte-kit/**"],
"outputs": [".next/**", "!.next/cache/**", ".svelte-kit/**"],
}
}
}
Expand Down Expand Up @@ -87,8 +87,8 @@ and remove the config from the root configuration:
{
"pipeline": {
"build": {
- "outputs": [".next/**", ".svelte-kit/**"]
+ "outputs": [".next/**"]
- "outputs": [".next/**", "!.next/cache/**", ".svelte-kit/**"]
+ "outputs": [".next/**", "!.next/cache/**"]
}
}
}
Expand Down Expand Up @@ -166,7 +166,7 @@ app again. Without a Workspace-specific task, you might configure your root
"build": {
"outputMode": "hash-only",
"inputs": ["src/**"],
"outputs": [".next/**"],
"outputs": [".next/**", "!.next/cache/**"],
},
"my-sveltekit-app#build": {
"outputMode": "hash-only", // must duplicate this
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/repo/docs/getting-started/add-to-project.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ For more information on configuring your `turbo.json`, see the [Configuration Op
"$schema": "https://turbo.build/schema.json",
"pipeline": {
"build": {
"outputs": [".next/**"]
"outputs": [".next/**", "!.next/cache/**"]
},
"lint": {}
}
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/repo/docs/getting-started/create-new.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ Let's take a look inside `turbo.json`, at the root:
"build": {
// ^^^^^
"dependsOn": ["^build"],
"outputs": ["dist/**", ".next/**"]
"outputs": ["dist/**", ".next/**", "!.next/cache/**"]
},
"lint": {},
"dev": {
Expand Down Expand Up @@ -448,7 +448,7 @@ Take a look inside `build` in `turbo.json`. There's some interesting config ther
{
"pipeline": {
"build": {
"outputs": [".next/**"]
"outputs": [".next/**", "!.next/cache/**"]
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/repo/docs/getting-started/existing-monorepo.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Workspaces that do not have the specified script defined in their `package.json`
"dependsOn": ["^build"],
// note: output globs are relative to each package's `package.json`
// (and not the monorepo root)
"outputs": [".next/**"]
"outputs": [".next/**", "!.next/cache/**"]
},
"test": {
// A package's `test` script depends on that package's
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/repo/docs/handbook/building-your-app.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Inside `turbo.json`, you can add `build` to the pipeline.
{
"pipeline": {
"build": {
"outputs": [".next/**"]
"outputs": [".next/**", "!.next/cache/**"]
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions docs/pages/repo/docs/reference/codemods.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ For example:
"pipeline": {
"build": {
"dependsOn": ["^build", "$API_BASE"],
"outputs": [".next/**"]
"outputs": [".next/**", "!.next/cache/**"]
},
"lint": {},
"dev": {
Expand All @@ -179,7 +179,7 @@ For example:
- "dependsOn": ["^build", "$API_BASE"],
+ "dependsOn": ["^build"],
+ "env": ["API_BASE"],
"outputs": [".next/**"],
"outputs": [".next/**", "!.next/cache/**"],
},
"lint": {},
"dev": {
Expand Down Expand Up @@ -224,7 +224,7 @@ For example:
"build": {
"dependsOn": ["^build"],
"env": ["API_BASE"],
"outputs": [".next/**"]
"outputs": [".next/**", "!.next/cache/**"]
},
"lint": {
"outputs": []
Expand All @@ -247,7 +247,7 @@ For example:
"build": {
"dependsOn": ["^build"],
"env": ["API_BASE"],
"outputs": [".next/**"]
"outputs": [".next/**", "!.next/cache/**"]
},
- "lint": {
- "outputs": []
Expand Down
6 changes: 3 additions & 3 deletions docs/pages/repo/docs/reference/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,12 @@ The list of environment variables a task depends on.
"build": {
"dependsOn": ["^build"],
"env": ["SOMETHING_ELSE"], // value will impact the hashes of all build tasks
"outputs": ["dist/**", ".next/**"]
"outputs": ["dist/**", ".next/**", "!.next/cache/**"]
},
"web#build": {
"dependsOn": ["^build"],
"env": ["STRIPE_SECRET_KEY"], // value will impact hash of only web's build task
"outputs": [".next/**"]
"outputs": [".next/**", "!.next/cache/**"]
}
},
"globalEnv": [
Expand Down Expand Up @@ -202,7 +202,7 @@ logs (and treat them like an artifact).
"build": {
// "Cache all files emitted to workspace's dist/** or .next
// directories by a `build` task"
"outputs": ["dist/**", ".next/**"],
"outputs": ["dist/**", ".next/**", "!.next/cache/**"],
"dependsOn": ["^build"]
},
"test": {
Expand Down
2 changes: 1 addition & 1 deletion examples/basic/turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"globalDependencies": ["**/.env.*local"],
"pipeline": {
"build": {
"outputs": [".next/**"]
"outputs": [".next/**", "!.next/cache/**"]
},
"lint": {},
"dev": {
Expand Down
1 change: 1 addition & 0 deletions examples/kitchen-sink/turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"outputs": [
"dist/**",
".next/**",
"!.next/cache/**",
"build/**",
"api/**",
"public/build/**"
Expand Down
2 changes: 1 addition & 1 deletion examples/non-monorepo/turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://turbo.build/schema.json",
"pipeline": {
"build": {
"outputs": [".next/**"]
"outputs": [".next/**", "!.next/cache/**"]
},
"lint": {},
"dev": {
Expand Down
2 changes: 1 addition & 1 deletion examples/with-changesets/turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"globalDependencies": ["**/.env.*local"],
"pipeline": {
"build": {
"outputs": ["dist/**", ".next/**"],
"outputs": ["dist/**", ".next/**", "!.next/cache/**"],
"dependsOn": ["^build"]
},
"test": {
Expand Down
2 changes: 1 addition & 1 deletion examples/with-docker/turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"globalEnv": ["PORT"],
"pipeline": {
"build": {
"outputs": ["dist/**", ".next/**", "public/dist/**"],
"outputs": ["dist/**", ".next/**", "!.next/cache/**", "public/dist/**"],
"dependsOn": ["^build"],
"env": ["NEXT_PUBLIC_API_HOST"]
},
Expand Down
2 changes: 1 addition & 1 deletion examples/with-npm/turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"pipeline": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**", ".next/**"]
"outputs": ["dist/**", ".next/**", "!.next/cache/**"]
},
"lint": {
"outputs": []
Expand Down
2 changes: 1 addition & 1 deletion examples/with-prisma/turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"pipeline": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**", ".next/**"]
"outputs": ["dist/**", ".next/**", "!.next/cache/**"]
},
"db:migrate:deploy": {},
"db:push": {},
Expand Down
2 changes: 1 addition & 1 deletion examples/with-react-native-web/turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"globalDependencies": ["**/.env.*local"],
"pipeline": {
"build": {
"outputs": ["dist/**", ".next/**"],
"outputs": ["dist/**", ".next/**", "!.next/cache/**"],
"dependsOn": ["^build"]
},
"dev": {
Expand Down
2 changes: 1 addition & 1 deletion examples/with-rollup/turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "https://turborepo.org/schema.json",
"pipeline": {
"build": {
"outputs": ["dist/**", "build/**", ".next/**"]
"outputs": ["dist/**", "build/**", ".next/**", "!.next/cache/**"]
},
"lint": {
"outputs": []
Expand Down
2 changes: 1 addition & 1 deletion examples/with-tailwind/turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"pipeline": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**", ".next/**"]
"outputs": ["dist/**", ".next/**", "!.next/cache/**"]
},
"lint": {},
"check-types": {},
Expand Down
2 changes: 1 addition & 1 deletion examples/with-yarn/turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"pipeline": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**", ".next/**"]
"outputs": ["dist/**", ".next/**", "!.next/cache/**"]
},
"lint": {},
"dev": {
Expand Down
2 changes: 1 addition & 1 deletion packages/create-turbo/templates/_shared_ts/turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"pipeline": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**", ".next/**"]
"outputs": ["dist/**", ".next/**", "!.next/cache/**"]
},
"lint": {
"outputs": []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Examples of **incorrect** code for this rule:
"pipeline": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**", ".next/**"]
"outputs": ["dist/**", ".next/**", "!.next/cache/**"]
},
"lint": {},
"dev": {
Expand All @@ -37,7 +37,7 @@ Examples of **correct** code for this rule:
"pipeline": {
"build": {
"dependsOn": ["^build"],
"outputs": ["dist/**", ".next/**"]
"outputs": ["dist/**", ".next/**", "!.next/cache/**"]
},
"lint": {},
"dev": {
Expand All @@ -53,7 +53,7 @@ Examples of **correct** code for this rule:
"build": {
"dependsOn": ["^build"],
"env": ["MY_API_TOKEN"],
"outputs": ["dist/**", ".next/**"]
"outputs": ["dist/**", ".next/**", "!.next/cache/**"]
},
"lint": {},
"dev": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
},
"build": {
"outputs": [
".next/**"
".next/**",
"!.next/cache/**"
]
},
"lint": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"persistent": true
},
"build": {
"outputs": [".next/**"]
"outputs": [".next/**", "!.next/cache/**"]
},
"lint": {
"outputs": []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"pipeline": {
"build": {
"outputs": [
".next/**"
".next/**",
"!.next/cache/**"
]
},
"lint": {
Expand Down
Loading

0 comments on commit f843837

Please sign in to comment.