Skip to content

Commit

Permalink
Add outputs to all examples (#3830)
Browse files Browse the repository at this point in the history
As of 1.7, you're required to specify your outputs.

The docs weren't caught up yet, though, leaving a lot of the old
implicit cache behavior.

In the interest of always educating with "the happy path", I've added
output arrays to our examples with various combinations of `.next/**`,
`.svelte-kit`, and `dist/**`.

---------

Co-authored-by: Nathan Hammond <nathan.hammond@vercel.com>
  • Loading branch information
anthonyshew and nathanhammond committed Feb 16, 2023
1 parent 8173a3b commit 564a0f0
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 7 deletions.
1 change: 1 addition & 0 deletions docs/pages/repo/docs/ci/circleci.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ And a `turbo.json`:
"$schema": "https://turbo.build/schema.json",
"pipeline": {
"build": {
"outputs": [".next/**", "!.next/cache/**"],
"dependsOn": ["^build"]
},
"test": {
Expand Down
1 change: 1 addition & 0 deletions docs/pages/repo/docs/ci/github-actions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ And a `turbo.json`:
"$schema": "https://turbo.build/schema.json",
"pipeline": {
"build": {
"outputs": [".next/**", "!.next/cache/**"],
"dependsOn": ["^build"]
},
"test": {
Expand Down
1 change: 1 addition & 0 deletions docs/pages/repo/docs/ci/gitlabci.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ And a `turbo.json`:
"$schema": "https://turbo.build/schema.json",
"pipeline": {
"build": {
"outputs": [".svelte-kit/**"],
"dependsOn": ["^build"]
},
"test": {
Expand Down
1 change: 1 addition & 0 deletions docs/pages/repo/docs/ci/travisci.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ And a `turbo.json`:
"$schema": "https://turbo.build/schema.json",
"pipeline": {
"build": {
"outputs": [".svelte-kit/**"],
"dependsOn": ["^build"]
},
"test": {
Expand Down
3 changes: 2 additions & 1 deletion docs/pages/repo/docs/core-concepts/caching.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ To override the default cache output behavior, pass an array of globs to a [`pip
"$schema": "https://turbo.build/schema.json",
"pipeline": {
"build": {
"outputs": ["dist/**", ".next/**"],
"outputs": [".next/**", "!.next/cache/**"],
"dependsOn": ["^build"]
},
"test": {
Expand Down Expand Up @@ -315,6 +315,7 @@ For example, consider a monorepo with three workspaces: a Next.js project, a Cre
{
"pipeline": {
"build": {
"outputs": [".next/**", "!.next/cache/**" "dist/**"],
"dependsOn": ["^build"]
}
}
Expand Down
18 changes: 13 additions & 5 deletions docs/pages/repo/docs/core-concepts/monorepos/running-tasks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ First, we declare our tasks inside `turbo.json`:
"build": {
// ^build means build must be run in dependencies
// before it can be run in this workspace
"outputs": [".next/**", "!.next/cache/**",".svelte-kit/**"],
"dependsOn": ["^build"]
},
"test": {},
Expand Down Expand Up @@ -83,7 +84,8 @@ The `pipeline` configuration declares which tasks depend on each other in your m
// topological dependencies' and devDependencies'
// `build` tasks being completed first. The `^` symbol
// indicates an upstream dependency.
"dependsOn": ["^build"]
"dependsOn": ["^build"],
"outputs": [".next/**", "!.next/cache/**", ".svelte-kit/**"]
},
"test": {
// A workspace's `test` task depends on that workspace's
Expand Down Expand Up @@ -120,7 +122,10 @@ If both tasks are in the same workspace, you can specify the relationship like t
{
"$schema": "https://turbo.build/schema.json",
"pipeline": {
"build": {},
"build": {
"dependsOn": ["^build"],
"outputs": [".next/**", "!.next/cache/**", ".svelte-kit/**"]
},
"deploy": {
// A workspace's `deploy` task depends on the `build`,
// task of the same workspace being completed.
Expand All @@ -145,7 +150,8 @@ The `^` symbol explicitly declares that the task has a dependency on a task in a
"build": {
// "A workspace's `build` command depends on its dependencies'
// and devDependencies' `build` commands being completed first"
"dependsOn": ["^build"]
"dependsOn": ["^build"],
"outputs": [".next/**", "!.next/cache/**", ".svelte-kit/**"]
}
}
}
Expand Down Expand Up @@ -179,7 +185,8 @@ The example below describes the `deploy` script of a `frontend` application that
"pipeline": {
// Standard configuration
"build": {
"dependsOn": ["^build"]
"dependsOn": ["^build"],
"outputs": [".next/**", "!.next/cache/**", ".svelte-kit/**"]
},
"test": {
"dependsOn": ["^build"]
Expand Down Expand Up @@ -224,7 +231,8 @@ A sample pipeline that defines the root task `format` and opts the root into `te
"$schema": "https://turbo.build/schema.json",
"pipeline": {
"build": {
"dependsOn": ["^build"]
"dependsOn": ["^build"],
"outputs": [".next/**", "!.next/cache/**", ".svelte-kit/**"]
},
"test": {
"dependsOn": ["^build"],
Expand Down
5 changes: 4 additions & 1 deletion docs/pages/repo/docs/reference/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ Items in `dependsOn` without `^` prefix, express the relationships between tasks
"build": {
// "A workspace's `build` command depends on its dependencies'
// or devDependencies' `build` command being completed first"
"outputs": [".next/**", "!.next/cache/**", "dist/**"]
"dependsOn": ["^build"]
},
"test": {
Expand Down Expand Up @@ -230,6 +231,7 @@ Defaults to `true`. Whether or not to cache the task [`outputs`](#outputs). Sett
"$schema": "https://turbo.build/schema.json",
"pipeline": {
"build": {
"outputs": [".svelte-kit/**", "dist/**"],
"dependsOn": ["^build"]
},
"test": {
Expand Down Expand Up @@ -269,7 +271,7 @@ Specifying `[]` will cause the task to be rerun when any file in the workspace c
// A workspace's `test` task depends on that workspace's
// own `build` task being completed first.
"dependsOn": ["build"],
"outputs": [""],
"outputs": [".next/**", "!.next/cache/**"],
// A workspace's `test` task should only be rerun when
// either a `.tsx` or `.ts` file has changed.
"inputs": ["src/**/*.tsx", "src/**/*.ts", "test/**/*.ts"]
Expand Down Expand Up @@ -299,6 +301,7 @@ Set type of output logging.
"pipeline": {
"build": {
"dependsOn": ["^build"],
"outputs": [".svelte-kit/**", "dist/**"],
"outputMode": "new-only"
},
"test": {
Expand Down

1 comment on commit 564a0f0

@vercel
Copy link

@vercel vercel bot commented on 564a0f0 Feb 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.