-
Notifications
You must be signed in to change notification settings - Fork 641
[rush-lib] Add support for custom CredentialCache
paths
#5240
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
Merged
iclanton
merged 12 commits into
microsoft:main
from
delilahw:feat/credcache-custom-paths
Jun 10, 2025
Merged
[rush-lib] Add support for custom CredentialCache
paths
#5240
iclanton
merged 12 commits into
microsoft:main
from
delilahw:feat/credcache-custom-paths
Jun 10, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The `CredentialCache` does not rely on the Rush user configuration. It can be used outside of `@rush/rush-sdk` by directly importing it from `@microsoft/rush-lib`. To support such use cases, we should allow the consumer to specify a file path for their cache, rather than the fixed `~/.rush-user/credentials.json` path. Non-breaking change because the default path remains the same, and we add support for additional options in `ICredentialCacheOptions`. | `ICredentialCacheOptions.cacheDirectory` | `.cacheName` | Resulting Path | |-|-|-| | `undefined` | `undefined` | `~/.rush-user/credentials.json` (default) | | `undefined` | `custom-name` | `~/.rush-user/custom-name.json` | | `/custom-dir` | `undefined` | `/custom-dir/credentials.json` | | `/custom-dir` | `custom-name` | `/custom-dir/custom-name.json` |
delilahw
commented
May 30, 2025
iclanton
reviewed
Jun 3, 2025
delilahw
commented
Jun 4, 2025
Reverts unintended change in lockfile path.
iclanton
reviewed
Jun 10, 2025
iclanton
reviewed
Jun 10, 2025
common/changes/@microsoft/rush/feat-credcache-custom-paths_2025-05-30-04-23.json
Outdated
Show resolved
Hide resolved
delilahw
commented
Jun 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much @iclanton for the suggestions!! I've rebased your commits from delilahw#1 to include them in this PR, which should resolve all of the comments. 😇
iclanton
approved these changes
Jun 10, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
The
CredentialCache
does not rely on the Rush user configuration; it can be used outside@rush/rush-sdk
(e.g. by importing directly from@microsoft/rush-lib
instead). To support these use cases, we should allow the consumer to pass a custom file path for their cache, rather than using the fixed~/.rush-user/credentials.json
path. This allowsCredentialCache
to be used in non-Rush codebases, or when we prefer a different location.Details
cacheFilePath?: string
option to the CredentialCache.~/.rush-user/credentials.json
is used.How it was tested
Added new tests to verify that default and custom paths are respected.
Impacted documentation
Only the extracted API is affected: https://api.rushstack.io/pages/rush-lib.credentialcache/.