这是indexloc提供的服务,不要输入任何密码
Skip to content

Implement root tasks #1040

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

Merged
merged 14 commits into from
May 17, 2022
Merged

Implement root tasks #1040

merged 14 commits into from
May 17, 2022

Conversation

gsoltis
Copy link
Contributor

@gsoltis gsoltis commented Apr 12, 2022

Adds the ability to run tasks from the root package.json file.

Implementation notes that will need to be documented:

  • Tasks run from the root are opt-in. That is, turbo.jsonmust have an entry for _root#<task> to enable running that task at the root.
  • _root is available in filters, so turbo run my-task --filter=_root will run _root#my-task.
  • If an entry exists in turbo.json for _root#task, then turbo run task will also run that task for the root.
  • There is some best-effort cycle detection in place. If the root package.json has "build": "turbo run build", then even after opting in, turbo run build --filter=_root will produce an error. This cycle detection can be circumvented with aliases or other indirection used to run turbo.
  • For the purposes of changed files, any changed file in a repo that doesn't belong to another package is considered to belong to the root.
    • Note that this could cause frequent runs of root tasks if they are triggered from git changes. With inputs specified, they should hit cache if nothing relevant has changed.

Additional changes:

  • e2e tests now include a root task
  • a package task is now sufficient to mark a particular task as runnable by turbo. e.g. if you defined foo#my-task but not my-task in turbo.json, previously running turbo run my-task would be an error, now it will run foo#my-task.

Fixes #845

@vercel
Copy link

vercel bot commented Apr 12, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
turbo-site ✅ Ready (Inspect) Visit Preview May 17, 2022 at 4:17PM (UTC)

Greg Soltis and others added 2 commits April 12, 2022 10:28
Co-authored-by: Jared Palmer <jared@jaredpalmer.com>
Co-authored-by: Jared Palmer <jared@jaredpalmer.com>
@gsoltis
Copy link
Contributor Author

gsoltis commented Apr 12, 2022

Windows e2e test is still broken, so not quite ready for merge yet

@foogazy
Copy link

foogazy commented Apr 19, 2022

Hello! This would be huge! How can we help for this to be merged?

@gsoltis
Copy link
Contributor Author

gsoltis commented Apr 20, 2022

@foogazy thanks for your interest!

This is coming soon, although there may be some slight tweaks.

The most helpful thing would be to verify that it works for your use cases.

@foogazy
Copy link

foogazy commented Apr 22, 2022

@gsoltis Hello! Thank you so much for all your amazing work!

Sure! I tested on my system at can verify it works fine:

System details:

  • Macbook Pro - MacOS Monterey - M1 Chip - 16GB Memory
  • Node v. 16
  • Yarn 1.22.18
  • npm 8.3.1

Hope this helps. :)

@gsoltis
Copy link
Contributor Author

gsoltis commented Apr 25, 2022

@foogazy Awesome, glad to hear it!

@dagda1
Copy link

dagda1 commented May 17, 2022

Oh man, I wish this was merged.

@trevorr
Copy link
Contributor

trevorr commented Jul 2, 2022

@gsoltis Does this support referencing root package-tasks in dependsOn? When I try that with v1.3.1, I get error preparing engine: found reference to unknown package: //.

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

Successfully merging this pull request may close these issues.

Run tasks from root directory
5 participants