-
Notifications
You must be signed in to change notification settings - Fork 604
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] Support for only installing Rush components needed for the current repo. #2408
Comments
I had similar issues when I wrote a small script to run to determine what to rush install/build, where I wanted to use one npm dependency. Installing that dependency itself would have lead to a 15 second delay just to be able to run the script, so I opted for writing the logic myself. In cases like what you describe however, it seems inevitable to have to download some things only when needed, kind of like lazy-loading for the web. I wonder, would you want to have separate rush npm packages that contain the needed extras? Like rush-aws, for example. It's hard for me to think of any bigger designs at the moment.. |
Here's some possible design alternatives:
|
Just want to note that v3 of the AWS SDK is modular and much smaller - but still 15 MB for just the S3 client and dependencies. |
Regarding the design alternatives @octogonz suggested, a plug-in architecture based on regular packages would just feel natural to Rush. Please note that a plug-in architecture could also be beneficial when a user wants to provide a custom implementation within the monorepo as (autoinstaller) package (see #2393 (comment)) or to manage multiple monorepos, as discussed at #2500. And I don't see why the end user experience from the Rush CLI would suffer from such an architecture. The simple use cases (that would just use the official components) shouldn’t need any more configuration/complexity and a lazy install model would still make sense to keep the Rush installation as quick as possible. |
This could also be a partial solution for #2492. @HipsterZipster had given feedback recently that:
Ideally we should eliminate the CC @mikeharder (who opened the upstream issue Azure/azure-sdk-for-js#13950 ) |
As a user, the "plugin" approach is really appealing to me -- for example, if the docs explained that naming a project "plugins" and adding a package.json with various packages in it would automatically include any packages in it as part of the rush runtime. (So if I was using the S3 build cache, or even a custom build cache, just add that package to the plugins project and it's good to use.) As a contributor, the question with any plugin model is how to make it work without ending up with a giant list of abstract "extension points" and factories ala Jenkins... |
As rush has widely adopted in Bytedance across multiple groups, we are also looking for a way to share common logic (like useful commands) and custom cache implementation based on our own object storage. |
May just make cache functionality as "plugin" mode first would make this issue currently doable. |
I favor the plugin model; we're doing decently well with them in Heft right now. The tapable hooks model retains solid performance and enumerating the plugins to install in the config file is very user-friendly. I envision having a list of plugins in If the CLI command does not match "rush install", "rush update", (plus arguments), then rush will load all your configured plugins (some of which will affect the CLI parser), then parse the command and execute it. All plugins should be designed to load only a stub initially and defer load their logic in the event that they are actually used, so as to minimize their impact on boot performance. One side benefit here is that the core rush runtime would then tend to have a very stable version, and the rush plugins would roll into your lockfile like everything else in the repo. |
As we've been building out the Rush build cache feature and adding support for cloud-based cache providers like Azure Storage and AWS S3, it's become evident that the SDK packages for Azure and AWS have a large install footprint.
It would be useful to carve these pieces of Rush into separate packages that are only installed (potentially during a repo's
rush install
step?) when a repo needs them. We already do something similar with Rush's version selector feature.I think the best way to structure this is to have a central listing of version-lockstepped "feature packages" in
rush-lib
that code can request, and will be installed in the user's~/.rush
folder. This can work one of two ways:rush install
may not depend on any of these packages, and it installs them for the repo's configuration therefore making them available to the rest of RushEach approach has upsides and downsides, and will require design work to not introduce circular dependencies, but I wanted to get the ball rolling on figuring this out. We'll probably want to use this when adding support for S3 a cache provider as the AWS SDK is 57MB.
The text was updated successfully, but these errors were encountered: