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

Auto-Scoped Task Execution In Monorepo Packages #550

Closed
derekdowling opened this issue Jan 12, 2022 · 5 comments
Closed

Auto-Scoped Task Execution In Monorepo Packages #550

derekdowling opened this issue Jan 12, 2022 · 5 comments

Comments

@derekdowling
Copy link

derekdowling commented Jan 12, 2022

Describe the feature you'd like to request

This is similar to the request in #417.

It would be extremely helpful to be able to run turbo-repo commands within individual packages rather than solely at the root of a monorepo. Often times it can be faster and easier to run commands (test, lint, etc) within a specific package while developing, especially if that package is depended on by many other packages or apps within the project.

Describe the solution you'd like

Within a package, I can run turbo run <task>. When this happens, turbo-repo will automatically determine the correct "scope" of the task to the directory the command was executed in, run dependsOn tasks, but not execute the task for any dependencies of the package. Any outputs of this should feed back into turbo-repo's cache.

I believe this maps to:
turbo run <task> --scope="<monorepo-rel-path-to-cwd>" --no-deps --include-dependencies

Describe alternatives you've considered

Updating package.json in 50+ monorepo packages * N different tasks to perform:cd ../<monorepo-root> && yarn turbo run <task> --scope=<package-path> which is extremely time consuming and brittle.

@jaredpalmer
Copy link
Contributor

Agree 100000000%. It's annoying. There are two parts of this: turbo run web#build should just work as you described and then also see #144.

@alexbchr
Copy link

Totally agree! Or at least have a way to run turborepo on a specific package including its dependencies, but excluding the package itself. So for example I can run turbo run build on the dependencies of a website package, but excluding the website package itself.

This would even be more versatile I suppose as it could be used with Yarn 2+. We use Yarn v3 and turbo is only installed in the root workspace, so our packages don't have access to the turbo script as it is not installed in them.

@jaredpalmer
Copy link
Contributor

This exclusion feature is coming with --filter flag #80 #81

@hariombalhara
Copy link

hariombalhara commented Jun 24, 2022

To workaround this problem I have created a nodejs script(turbo-w.js) that execute the given command as turbo command even when it's run from the package itself. Just sharing if it can help someone else as well https://gist.github.com/hariombalhara/b69deed932dd1ce73bb7cb86cada5a8b

I would still need to go and update the package scripts itself.

@mehulkar
Copy link
Contributor

You can do this by installing turbo globally now https://turbo.build/repo/docs/installing#install-globally

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

5 participants