microsoft / rushstack

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

[rush] Shareable rush configuration #2500

Open RuBAN-GT opened 3 years ago

RuBAN-GT commented 3 years ago

Summary

Hi everyone,

From zulip chat I suggested an idea to create a shareable common rush configuration in case of multiple but similar monorepos.

Hi everyone, I have a plan to have a couple monorepos with similar structure but for different projects with own requirements. The question is how I can unify and maintain common parts of theses projects with rush configs? They will have the one structure, probably custom commands, etc. For example, eslint provides shareable configs. Can I do sth similar with rush? Thank you!

I can suggest to follow something like this:

1) Add a new attribute to json schemas extend like tsconfig or eslint configuration files:

command-line.json:

{
  "$schema": "https://developer.microsoft.com/json-schemas/rush/v5/command-line.schema.json",
  "extends": ["@myproduct/rush-shared/command-line"],
  "commands": []
}

2) @myproduct/rush-shared package should expose command-line json or js file with resulted object configuration. 3) We can combine/mix these config for different purposes (decompose, shared data, etc).

Thank you!

iclanton commented 3 years ago

We don't have a notion of globally installed packages, so there would need to be a new way to install packages that are allowed to be extended from. We could use the autoinstaller feature that's currently used by things like the prettier hook in this repo.

@octogonz

octogonz commented 3 years ago

there would need to be a new way to install packages that are allowed to be extended from

Such a facility could ALSO be used to download optional components of Rush on demand. For example the AWS and Azure cloud cache drivers bring in somewhat large dependencies, and nobody will ever use both of them simultaneously.

The implementation of that could definitely be unified with the autoinstaller implementation.