From 564a0f0dab223fbaf2ad4a7a3a5332aa50e27eb0 Mon Sep 17 00:00:00 2001 From: Anthony Shew Date: Thu, 16 Feb 2023 10:04:10 -0800 Subject: [PATCH] Add `outputs` to all examples (#3830) 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 --- docs/pages/repo/docs/ci/circleci.mdx | 1 + docs/pages/repo/docs/ci/github-actions.mdx | 1 + docs/pages/repo/docs/ci/gitlabci.mdx | 1 + docs/pages/repo/docs/ci/travisci.mdx | 1 + docs/pages/repo/docs/core-concepts/caching.mdx | 3 ++- .../core-concepts/monorepos/running-tasks.mdx | 18 +++++++++++++----- .../repo/docs/reference/configuration.mdx | 5 ++++- 7 files changed, 23 insertions(+), 7 deletions(-) diff --git a/docs/pages/repo/docs/ci/circleci.mdx b/docs/pages/repo/docs/ci/circleci.mdx index a51793d9ec556..c102dabd73771 100644 --- a/docs/pages/repo/docs/ci/circleci.mdx +++ b/docs/pages/repo/docs/ci/circleci.mdx @@ -31,6 +31,7 @@ And a `turbo.json`: "$schema": "https://turbo.build/schema.json", "pipeline": { "build": { + "outputs": [".next/**", "!.next/cache/**"], "dependsOn": ["^build"] }, "test": { diff --git a/docs/pages/repo/docs/ci/github-actions.mdx b/docs/pages/repo/docs/ci/github-actions.mdx index 6076abea24552..3b69a94e7ddef 100644 --- a/docs/pages/repo/docs/ci/github-actions.mdx +++ b/docs/pages/repo/docs/ci/github-actions.mdx @@ -31,6 +31,7 @@ And a `turbo.json`: "$schema": "https://turbo.build/schema.json", "pipeline": { "build": { + "outputs": [".next/**", "!.next/cache/**"], "dependsOn": ["^build"] }, "test": { diff --git a/docs/pages/repo/docs/ci/gitlabci.mdx b/docs/pages/repo/docs/ci/gitlabci.mdx index a1b327e73a60d..f8321d0999485 100644 --- a/docs/pages/repo/docs/ci/gitlabci.mdx +++ b/docs/pages/repo/docs/ci/gitlabci.mdx @@ -31,6 +31,7 @@ And a `turbo.json`: "$schema": "https://turbo.build/schema.json", "pipeline": { "build": { + "outputs": [".svelte-kit/**"], "dependsOn": ["^build"] }, "test": { diff --git a/docs/pages/repo/docs/ci/travisci.mdx b/docs/pages/repo/docs/ci/travisci.mdx index 443cdf3e70a81..29a09e596b531 100644 --- a/docs/pages/repo/docs/ci/travisci.mdx +++ b/docs/pages/repo/docs/ci/travisci.mdx @@ -31,6 +31,7 @@ And a `turbo.json`: "$schema": "https://turbo.build/schema.json", "pipeline": { "build": { + "outputs": [".svelte-kit/**"], "dependsOn": ["^build"] }, "test": { diff --git a/docs/pages/repo/docs/core-concepts/caching.mdx b/docs/pages/repo/docs/core-concepts/caching.mdx index 180a516275d09..e833771367445 100644 --- a/docs/pages/repo/docs/core-concepts/caching.mdx +++ b/docs/pages/repo/docs/core-concepts/caching.mdx @@ -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": { @@ -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"] } } diff --git a/docs/pages/repo/docs/core-concepts/monorepos/running-tasks.mdx b/docs/pages/repo/docs/core-concepts/monorepos/running-tasks.mdx index 7910fd4067089..91974d2b7162c 100644 --- a/docs/pages/repo/docs/core-concepts/monorepos/running-tasks.mdx +++ b/docs/pages/repo/docs/core-concepts/monorepos/running-tasks.mdx @@ -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": {}, @@ -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 @@ -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. @@ -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/**"] } } } @@ -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"] @@ -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"], diff --git a/docs/pages/repo/docs/reference/configuration.mdx b/docs/pages/repo/docs/reference/configuration.mdx index 7564ae717f163..5510864d9190a 100644 --- a/docs/pages/repo/docs/reference/configuration.mdx +++ b/docs/pages/repo/docs/reference/configuration.mdx @@ -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": { @@ -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": { @@ -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"] @@ -299,6 +301,7 @@ Set type of output logging. "pipeline": { "build": { "dependsOn": ["^build"], + "outputs": [".svelte-kit/**", "dist/**"], "outputMode": "new-only" }, "test": {