-
Notifications
You must be signed in to change notification settings - Fork 657
[rush-sdk] Introduce a proxy API for customizing how rush-lib is loaded #4270
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
Conversation
…an API for controlling how rush-sdk is loaded
|
Consider extracting this into an exported function (https://github.com/microsoft/rushstack/blob/main/libraries/rush-lib/src/scripts/install-run-rush.ts#L20-L44) and using it. Since this project is webpacked, that should be easy. |
|
@iclanton wrote:
@dmichon-msft suggested the same thing in #4270 (comment) I feel like we should get this PR merged to unblock further work on the VS Code extension, and then come back and improve |
…e since it is easily computable from the promise resolution
…n AbortError exception rather than resolving successfully
…) should fail if it was already loaded
Summary
The Rush Stack VS Code extension works in debug mode but currently is broken when published to the marketplace, because it relies on
@rushstack/rush-sdkto loadrush-lib, but there is now way to specify therushJsonSearchFolderto search for rush.json.Details
Today,
rush-sdkautomatically discovers and loadsrush-libas part of a synchronous operation ofrequire():For the VS Code extension, we need to carefully control when
rush-libis loaded, where it's loaded from, and report progress for the underlyingnpm installoperation, and also cancel the installation if needed. The new API looks like this:The actual install currently still runs via
Executable.spawnSync()so theasyncand progress monitoring will currently block the main thread and the progress bar jumps from 0 to 100%. We'll improve the underlying implementation in a future PR.How it was tested
There are 5 scenarios for Rush SDK:
require("@rushstack/rush-sdk")Impacted documentation
rush-sdkis currently considered "experimental" and only has README.md docs@dmichon-msft @iclanton @william2958 @chengcyber