Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[turborepo] can't force a single workspace to run task that has dependsOn #2939

Closed
scamden opened this issue Dec 5, 2022 · 6 comments
Closed
Labels
kind: bug Something isn't working

Comments

@scamden
Copy link

scamden commented Dec 5, 2022

What version of Turborepo are you using?

1.6.2

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

pnpm

What operating system are you using?

Mac

Describe the Bug

if i have a task compile specified as

    "compile": {
      "dependsOn": ["^compile"],
      "outputs": ["build/**"]
    },

i can't exclude the dependencies of the task no matter what i try.

my best attempt was
turbo compile --filter="\!app^..." --filter="app" --force

Expected Behavior

explicitly excluding deps should override the behavior of dependsOn and not run the task for dependencies

To Reproduce

make a monorepo with workspace app which depends on workspace anyother and with task compile specified as

    "compile": {
      "dependsOn": ["^compile"],
      "outputs": ["build/**"]
    },

run
turbo compile --filter="\!app^..." --filter="app" --force

Reproduction Repo

No response

cc: @spikebrehm @adamrneary

@scamden scamden added area: turborepo kind: bug Something isn't working labels Dec 5, 2022
@tknickman
Copy link
Member

@scamden --only is designed to do what you're looking for here (ignore dependsOn). Checkout the docs here.

@scamden
Copy link
Author

scamden commented Jan 4, 2023

@tknickman thanks for the reply. unfortunately this doesn't seem to work for tasks dependent on the same task. running: turbo run --only compile --filter app still runs dependent compiles for me on turbo v1.6.3

And actually I don't think I want to ignore dependsOn entirely. For example, if i have a build task that has dependsOn : ['^compile', 'lint'] i would want a way to run all the tasks within the workspace but not the dependents. so still run build, compile, and lint within the workspace, but not upstream compile if that makes sense. I think we need something like --only-filtered-workspaces so it runs everything in the dependsOn but only for the workspaces we've filtered to if that makes sense.

@gajus
Copy link

gajus commented Nov 16, 2023

@tknickman Is there a workaround for this?

@chris-olszewski chris-olszewski added the needs: team input Filter for core team meetings label Nov 18, 2023
@chris-olszewski chris-olszewski removed the needs: team input Filter for core team meetings label Feb 26, 2024
@chris-olszewski
Copy link
Member

@gajus @spikebrehm @scamden

Hi all, could you help me understand the reasoning for wanting to run a single task in a single package and ignore all dependencies? We could add an additional flag just for this behavior, but we want to make sure we are understanding the problem you're encountering/what you're trying to achieve before we add another flag.

@gajus
Copy link

gajus commented Feb 26, 2024

@chris-olszewski The linked issue illustrates the use case I've had for --only to work this way.

#6480

@anthonyshew
Copy link
Contributor

The behavior of --only has changed to include what's being requested in this issue per #8163.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants