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

[rush] Add option to run bulk command in only specified project #1399

Closed
1 task done
mikeharder opened this issue Jul 18, 2019 · 10 comments
Closed
1 task done

[rush] Add option to run bulk command in only specified project #1399

mikeharder opened this issue Jul 18, 2019 · 10 comments
Labels
enhancement The issue is asking for a new feature or design change priority The maintainers consider it to be an important issue. We should try to fix it soon.

Comments

@mikeharder
Copy link
Contributor

  • Feature

Currently, Rush has two options for running bulk commands:

  -t PROJECT1, --to PROJECT1
                        Run command in the specified project and all of its
                        dependencies
  -f PROJECT2, --from PROJECT2
                        Run command in all projects that directly or
                        indirectly depend on the specified project

These cover most of our needs, but sometimes we want to run a command in only a single project, and neither its dependencies nor projects which depend on it. It would be great if Rush could add an option for this, like:

  --only PROJECT1
                        Run command in only the specified project

It might be better to use a different name for the parameter to avoid confusion with the existing option:

  -o, --changed-projects-only
                        If specified, the incremental build will only rebuild
                        projects that have changed, but not any projects that
                        directly or indirectly depend on the changed package.
@apostolisms
Copy link
Contributor

@mikeharder Do you envision this to be an option primarily for rush build or all commands? Can you give an example use case ?
Thanks

@mikeharder
Copy link
Contributor Author

All commands. For example:

  • You have 3 projects in a dependency chain A -> B -> C
  • You have 3 command build, test and lint
  • You want to validate a pull request which changes B

You would run these commands:

  • rush build --to B --from B
    • Before you can build B, you need to build all its dependencies
    • You also want to build everything which depends on B, to ensure there are no breaking changes in B.
  • rush test --from B
    • You should test B and everything which depends on it, again to ensure there are no breaking changes in B.
    • However, you do not need to run tests for the dependencies of B, since they are not changed in the pull request.
  • rush lint --only B
    • You only need to run a static analysis tool like lint on code which has actually changed, not dependencies in either direction.

@octogonz
Copy link
Collaborator

Suppose there was also a project D, and someone did this:

rush build --to B --only D

I think I would expect it to build A+B+D. I wouldn't expect it to build "only" D.

Here are some other possible names to compare with:
rush build --to B --include D
rush build --to B --select D
rush build --to B --with D
rush build --to B --project D

BTW #1241 has a related discussion about project selection.

@octogonz octogonz added the needs design The next step is for someone to propose the details of an approach for solving the problem label Jul 18, 2019
@mikeharder
Copy link
Contributor Author

mikeharder commented Jul 18, 2019

@octogonz: I agree the name --only is confusing if this option is composed with --to or --from. My favorite of the alternative names you proposed is --project, since it seems the clearest when used by itself:

rush build --include D
rush build --select D
rush build --with D
rush build --project D

@octogonz
Copy link
Collaborator

Currently the short name -p is used by --parallelism.

If we call it --project, I would definitely to use -p for that instead.

@octogonz octogonz added enhancement The issue is asking for a new feature or design change and removed needs design The next step is for someone to propose the details of an approach for solving the problem labels Jul 19, 2019
@mikeharder
Copy link
Contributor Author

My favorite is still --project. If you want to avoid conflict with -p, you could use -j, --project.

@octogonz
Copy link
Collaborator

I agree --project is the best name. (That's why I removed the needs design tag heheh.)

@rakeshpatnaik rakeshpatnaik added the priority The maintainers consider it to be an important issue. We should try to fix it soon. label Jul 19, 2019
@scamden
Copy link
Contributor

scamden commented Mar 18, 2021

i'd add a little suggestion to make --project take more than one. my use case would be a command to start up a certain constellation of dev servers. i.e rush servers --project backend-api frontend-ui or similar

@scamden
Copy link
Contributor

scamden commented Mar 18, 2021

aaaand just saw that --only already exists and can be used multiple times. please ignore.

can this issue be closed then? or were you using it to track renaming the option to --project?

@mikeharder
Copy link
Contributor Author

mikeharder commented Mar 18, 2021

Closing since I believe this issue has been fixed by #2422.

@octogonz: Feel free to re-open if you disagree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue is asking for a new feature or design change priority The maintainers consider it to be an important issue. We should try to fix it soon.
Projects
None yet
Development

No branches or pull requests

5 participants