microsoft / rushstack

Monorepo for tools developed by the Rush Stack community
https://rushstack.io/
Other
5.82k stars 592 forks source link

[rush] Tree of rush-managed projects that contain rush-managed projects? #1699

Open trusktr opened 4 years ago

trusktr commented 4 years ago

This is more for discussion; not a bug or feat request.

Can we have a tree of rush-managed projects?

For example, can we have a rush repo with packages in it, where each "package" may be from another repo that uses rush to manage multiple packages?

I'm just wondering if this may be doable. Because sometimes it makes sense to split a package into several closely-related packages, but these packages may be completely un-related to a rush-managed application that consumes them.

So the structure might be:

my-app
  src/ # a "package" managed by rush
  packages/ # other "packages" managed by rush
    one/
    two/
    three/ # this "package" is actually made of several sub-packages. It is placed here as a git submodule, lives outside of this repo.
      src/ # a "package" managed by rush
      packages/  # other "packages" managed by rush
        four/

In that example, three might be some package that has no idea about app, and it makes sense for three not to know anything about my-app. my-app might be made by one person, and three by another person, in separate github accounts, and the author of my-app may want to adopt the three package into the my-app project not as a dependency from NPM, but as a git submodule so that editing the source is possible.

Any experience with this sort of thing? I imagine it is perfectly doable; the parent rush project managing the commands needed to manage the rush sub-project.

trusktr commented 4 years ago

Turns out I discovered this isn't currently possible, because there may be issues related to https://github.com/microsoft/rushstack/issues/1702.

rush would need to traverse up to find the nearest rush.json, and from that tree-node in the tree of rush projects it could lookup sub-folder projects and know if the current working directory is one of those projects.

There may need to be a new rule or two regarding project paths. F.e.: