turbo icon indicating copy to clipboard operation
turbo copied to clipboard

Not able to configure `inputs` to include ignored/ untracked files

Open gabrielgrijincu opened this issue 2 years ago • 2 comments

What version of Turborepo are you using?

1.2.9

What package manager are you using / does the bug impact?

Yarn v1

What operating system are you using?

Mac

Describe the Bug

An app I'm working on relies on dynamically generated API client and while this is a blast, we don't really want the generated files to be checked into git for several reasons (CI with type checking based on fresh generated APIs, clearer and more concise PRs without clutter due to generated code etc.).

However, if I add an ignored folder to inputs, it won't trigger the cache miss. After some digging, I found out that turbo actually pipes the inputs directly to git ls-files which isn't listing any of the ignored files.

One of the steps for what constitutes a cache hit vs. miss for a given task states the following:

Hash the contents of all not-gitignored files in the package folder or the files matching the inputs globs, if present

This led me to believe that no gitignored files are taken into consideration when hashing unless those files are specified in inputs. I think this should be documented more clearly if this is not the expected behaviour.

Expected Behavior

Take gitignored files into consideration when hashing, or add some other option for this kind of files.

To Reproduce

Let's say we have this .gitignore file:

packages/api/src/generated

And this turbo.json file:

{
  "pipeline": {
    "build": {
      "cache": true,
      "dependsOn": ["^build"],
      "outputs": ["dist/**"],
      "inputs": ["src/**/*.ts", "src/generated/**/*"]
    }
  }
}

When running turbo run build, hashing is not influenced by these generated files.

gabrielgrijincu avatar May 30 '22 14:05 gabrielgrijincu

I am blocked by this as well.

sppatel avatar Jun 12 '22 19:06 sppatel

Up! Would be really helpful to have this. Any plans to fix this?

sasweb avatar Aug 09 '22 14:08 sasweb

Fixed in https://github.com/vercel/turborepo/pull/1699

tknickman avatar Aug 22 '22 13:08 tknickman