turbo icon indicating copy to clipboard operation
turbo copied to clipboard

--global-deps is ignored

Open cinan opened this issue 2 years ago • 5 comments

What version of Turborepo are you using?

1.2.8

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

Yarn v2/v3 (node_modules linker only)

What operating system are you using?

Mac

Describe the Bug

Turbo ignores --global-deps value. Tested in vanilla npx create-turbo repo.

Expected Behavior

Turbo shouldn't ignore the switch.

To Reproduce

npx create-turbo@latest
yarn lint # cache miss; ok
echo "// ignore" >> packages/eslint-config-acme/index.js # to break cache
yarn lint --global-deps="packages/eslint-config-acme/*.js" # cache hit, should be miss

I tried to define globalDependencies in turbo.json instead of --global-deps switch and in that way turbo missed cache correctly.

cinan avatar May 12 '22 10:05 cinan

Turbo version : 1.2.8 Windows 10

The behavior when specifying the "globalDependencies" property in turbo.json seems broken .. Anything that I put in there seems ignored..

With the "--global-deps" flag, it seems to work only partially, as only files that are directly at the root of my workspace (ex: --global-deps="file.json") are considered. Any file that are at least one level deep in a directory (ex: --global-deps="directory/file.json") are ignored.

ThomZz avatar May 12 '22 18:05 ThomZz

This does indeed look like a bug.

I think adding the global deps in turbo.json will work as a workaround, but this flag should also work. Thanks for the report!

gsoltis avatar Sep 14 '22 22:09 gsoltis

After a conversation we may be deprecating this functionality as:

  • it does not work presently, implying that nobody is relying on it.
  • turbo.json is a better place for this information in every scenario we are able to identify.

Can you help us identify any use-case where specifying via command line would be better than via turbo.json?

nathanhammond avatar Sep 15 '22 09:09 nathanhammond

In general, when running test/dev/build/... scripts I don't care about eslint configuration. But when running lint (and only then), I want to depend on extra eslint configuration file. Currently after eslint configuration I mustn't forget to use --force when running lint script.

My root package.json would look like:

"scripts": {
    "build": "turbo run build",
    "dev": "turbo run dev",
    "lint": "turbo run lint --global-deps=...",
}

cinan avatar Sep 19 '22 10:09 cinan

want to depend on extra eslint configuration file - @cinan

Is that lint configuration file in your repository? You can specify that file to be included as a dependency when linting using something that looks like "inputs": ["../../.eslintrc.js"]. Also, if you use our recommended linting setup, this is also not typically a requirement. An example of that setup can be found here:

https://github.com/vercel/turborepo/blob/main/examples/basic/.eslintrc.js

nathanhammond avatar Sep 19 '22 15:09 nathanhammond

I wasn't aware of the inputs option. It seems I don't need anymore --global-deps. Thanks!

cinan avatar Sep 26 '22 08:09 cinan