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

Passing the root workspace name as a package to --filter does not work as expected #9578

Open
1 task done
dstaley opened this issue Dec 5, 2024 · 3 comments
Open
1 task done

Comments

@dstaley
Copy link

dstaley commented Dec 5, 2024

Verify canary release

  • I verified that the issue exists in the latest Turborepo canary release.

Link to code that reproduces this issue

https://github.com/dstaley/turborepo-root-filter

Which canary version will you have in your reproduction?

2.3.4-canary.2

Enviroment information

turbo 2.3.4-canary.2

CLI:
   Version: 2.3.4-canary.2
   Path to executable: /Users/dstaley/Desktop/turborepo-root-filter/node_modules/.pnpm/[email protected]/node_modules/turbo-darwin-arm64/bin/turbo
   Daemon status: Running
   Package manager: pnpm9

Platform:
   Architecture: aarch64
   Operating system: macos
   WSL: false
   Available memory (MB): 4167
   Available CPU cores: 12

Environment:
   CI: None
   Terminal (TERM): xterm-256color
   Terminal program (TERM_PROGRAM): vscode
   Terminal program version (TERM_PROGRAM_VERSION): 1.95.3
   Shell (SHELL): /bin/zsh
   stdin: false

Expected behavior

turbo-ignore correctly detects when the dependencies of a task defined for the root workspace have changed compared against the main branch, and reports that the //#test:integration task will be run.

Actual behavior

The following error occurs:

x No package found with name 'turborepo-root-filter' in workspace

To Reproduce

  1. turbo-ignore --task test:integration --fallback main

Additional context

I believe passing the root workspace package name as // sort of works, but I'm not able to get it to correctly detect when a dependency has changed.

To reproduce that,

  1. Make a new branch off of main
  2. Make an edit to packages/package-b/src/build.js and commit it.
  3. Run npx turbo run "test:integration" --filter="//...[main]" --dry

Expected result:
Turbo reports that the //#test:integration, @repo/package-a#build, and @repo/package-b#build tasks will be run.

@dstaley dstaley added kind: bug Something isn't working needs: triage New issues get this label. Remove it after triage labels Dec 5, 2024
@chris-olszewski chris-olszewski removed kind: bug Something isn't working needs: triage New issues get this label. Remove it after triage labels Dec 5, 2024
@chris-olszewski
Copy link
Member

--filter works exclusively on the package graph and has no knowledge of task definitions so //...[main] is: "any package that is the root package or a dependency that has changed since main".

Only @repo/package-b changed since main and since in the package graph, it isn't a dependency of the root package, nothing gets included in the filter.

@dstaley
Copy link
Author

dstaley commented Dec 6, 2024

Ah that makes sense! Is there a way to declare a package graph dependency without that dependency being added to the package manager? In this situation I want a way to know if I need to run a root-level task when one of the dependencies of that task has changed.

@gruckion
Copy link

gruckion commented Dec 9, 2024

This can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants