Skip to content

[rush] Running a specific phase for a specific project safely #4206

Open

Description

Something I would like to be able to do but isn't currently supported is running a specific phase, in a specific project, but in a safe manner.

Summary

Currently the only choice I'm aware of is rush <phase-name> -o <project-name> but that is an unsafe operation, if there are other phases that need to be executed to execute this phase Rush won't do it, instead the phase will fail.

But if I do something like rush <phase-name> -t <project-name> it will do it safely, but it will execute this phase for all upstream projects as well which isn't what I want. I want only the required upstream phases to run, not including the phase itself as I only want that to run in the specific project (unless the phase depended on it's upstream phases to, like build would).

ie, we have a phase to run the build-storybook script. I want to build a specific packages storybook, but I want to ensure that all of it's upstream dependencies have been built. Currently I would have to do rush build -t <project-name> and then rush build-storybook -o <project-name> when I really just want to go rush build-storybook --only-but-safe <project-name>.

That causes the build phase to run for all upstream packages, but the build-storybook phase only runs in <project-name> instead of all upstream packages.

I already raised this on Zulip where Pete replied, so I'll copy in his reply for extra context

This makes sense, but there are lots of design possibilities. Here's a couple other ideas:

  • rush test --to my-project --phased-dependences: This flag would modify the selector parameters (--from, --impacted-by, --to -except) so that their granularity is phases rather than commands.
  • rush run-phase --to my-project[_phase:build]: This syntax would allow specifying a phase name as a target, and then --to would automatically have granularity of phases (for that CLI parameter). If you wanted multiple phases, they could be separated by commas: rush run-phase --to my-project[_phase:build,_phase:docs] --from my-library
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

design proposalA new direction that is complex enough to have open questions but specific enough to implementeffort: mediumNeeds a somewhat experienced developer

Type

No type

Projects

  • Status

    General Discussions

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions