Skip to content

Commit 15b7658

Browse files
authored
Extract CredentialCache from Rush into @rushstack/credential-cache (#5421)
* Add new credential-cache package * Add test command * Factor out CredentialCache * Fix routing * Fix API * Update readme * Update readme * rush update * Forward rush-user folder name * Remove old credentials schema * Restore caching in getHomeFolder * Remove reexport of areDeepEqual * Update API md * Centralize polyfill --------- Co-authored-by: David Michon <[email protected]>
1 parent 7c66e04 commit 15b7658

File tree

59 files changed

+740
-284
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+740
-284
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ These GitHub repositories provide supplementary resources for Rush Stack:
8080
| [/heft-plugins/heft-webpack4-plugin](./heft-plugins/heft-webpack4-plugin/) | [![npm version](https://badge.fury.io/js/%40rushstack%2Fheft-webpack4-plugin.svg)](https://badge.fury.io/js/%40rushstack%2Fheft-webpack4-plugin) | [changelog](./heft-plugins/heft-webpack4-plugin/CHANGELOG.md) | [@rushstack/heft-webpack4-plugin](https://www.npmjs.com/package/@rushstack/heft-webpack4-plugin) |
8181
| [/heft-plugins/heft-webpack5-plugin](./heft-plugins/heft-webpack5-plugin/) | [![npm version](https://badge.fury.io/js/%40rushstack%2Fheft-webpack5-plugin.svg)](https://badge.fury.io/js/%40rushstack%2Fheft-webpack5-plugin) | [changelog](./heft-plugins/heft-webpack5-plugin/CHANGELOG.md) | [@rushstack/heft-webpack5-plugin](https://www.npmjs.com/package/@rushstack/heft-webpack5-plugin) |
8282
| [/libraries/api-extractor-model](./libraries/api-extractor-model/) | [![npm version](https://badge.fury.io/js/%40microsoft%2Fapi-extractor-model.svg)](https://badge.fury.io/js/%40microsoft%2Fapi-extractor-model) | [changelog](./libraries/api-extractor-model/CHANGELOG.md) | [@microsoft/api-extractor-model](https://www.npmjs.com/package/@microsoft/api-extractor-model) |
83+
| [/libraries/credential-cache](./libraries/credential-cache/) | [![npm version](https://badge.fury.io/js/%40rushstack%2Fcredential-cache.svg)](https://badge.fury.io/js/%40rushstack%2Fcredential-cache) | [changelog](./libraries/credential-cache/CHANGELOG.md) | [@rushstack/credential-cache](https://www.npmjs.com/package/@rushstack/credential-cache) |
8384
| [/libraries/debug-certificate-manager](./libraries/debug-certificate-manager/) | [![npm version](https://badge.fury.io/js/%40rushstack%2Fdebug-certificate-manager.svg)](https://badge.fury.io/js/%40rushstack%2Fdebug-certificate-manager) | [changelog](./libraries/debug-certificate-manager/CHANGELOG.md) | [@rushstack/debug-certificate-manager](https://www.npmjs.com/package/@rushstack/debug-certificate-manager) |
8485
| [/libraries/heft-config-file](./libraries/heft-config-file/) | [![npm version](https://badge.fury.io/js/%40rushstack%2Fheft-config-file.svg)](https://badge.fury.io/js/%40rushstack%2Fheft-config-file) | [changelog](./libraries/heft-config-file/CHANGELOG.md) | [@rushstack/heft-config-file](https://www.npmjs.com/package/@rushstack/heft-config-file) |
8586
| [/libraries/load-themed-styles](./libraries/load-themed-styles/) | [![npm version](https://badge.fury.io/js/%40microsoft%2Fload-themed-styles.svg)](https://badge.fury.io/js/%40microsoft%2Fload-themed-styles) | [changelog](./libraries/load-themed-styles/CHANGELOG.md) | [@microsoft/load-themed-styles](https://www.npmjs.com/package/@microsoft/load-themed-styles) |
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@microsoft/rush",
5+
"comment": "Extract CredentialCache API out into \"@rushstack/credential-cache\". Reference directly in plugins to avoid pulling in all of \"@rushstack/rush-sdk\" unless necessary.",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@microsoft/rush"
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@rushstack/credential-cache",
5+
"comment": "Create dedicated package for the Rush \"CredentialCache\" API. This API manages credential persistence on the local machine.",
6+
"type": "minor"
7+
}
8+
],
9+
"packageName": "@rushstack/credential-cache"
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@rushstack/node-core-library",
5+
"comment": "Add \"Objects.areDeepEqual\" and \"User.getHomeFolder\" APIs.",
6+
"type": "minor"
7+
}
8+
],
9+
"packageName": "@rushstack/node-core-library"
10+
}

common/config/rush/nonbrowser-approved-packages.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,10 @@
130130
"name": "@rspack/dev-server",
131131
"allowedCategories": [ "libraries" ]
132132
},
133+
{
134+
"name": "@rushstack/credential-cache",
135+
"allowedCategories": [ "libraries" ]
136+
},
133137
{
134138
"name": "@rushstack/debug-certificate-manager",
135139
"allowedCategories": [ "libraries", "vscode-extensions" ]

common/config/subspaces/build-tests-subspace/pnpm-lock.yaml

Lines changed: 23 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// DO NOT MODIFY THIS FILE MANUALLY BUT DO COMMIT IT. It is generated and used by Rush.
22
{
3-
"pnpmShrinkwrapHash": "1dc2b69423ca353582cec8716410a0b8a8210aff",
3+
"pnpmShrinkwrapHash": "c9e998d8d98c587075f2380a11aa0816aecfd2fc",
44
"preferredVersionsHash": "550b4cee0bef4e97db6c6aad726df5149d20e7d9",
5-
"packageJsonInjectedDependenciesHash": "7bf222162008849ca931709cbaa90632d56766da"
5+
"packageJsonInjectedDependenciesHash": "9c50330f156d5d74c5dd1fb2e3aa6b9c2a2403c7"
66
}

common/config/subspaces/default/pnpm-lock.yaml

Lines changed: 31 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
## API Report File for "@rushstack/credential-cache"
2+
3+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
4+
5+
```ts
6+
7+
// @public (undocumented)
8+
export class CredentialCache implements Disposable {
9+
// (undocumented)
10+
[Symbol.dispose](): void;
11+
// (undocumented)
12+
deleteCacheEntry(cacheId: string): void;
13+
// (undocumented)
14+
dispose(): void;
15+
// (undocumented)
16+
static initializeAsync(options: ICredentialCacheOptions): Promise<CredentialCache>;
17+
// (undocumented)
18+
saveIfModifiedAsync(): Promise<void>;
19+
// (undocumented)
20+
setCacheEntry(cacheId: string, entry: ICredentialCacheEntry): void;
21+
// (undocumented)
22+
trimExpiredEntries(): void;
23+
// (undocumented)
24+
tryGetCacheEntry(cacheId: string): ICredentialCacheEntry | undefined;
25+
// (undocumented)
26+
static usingAsync(options: ICredentialCacheOptions, doActionAsync: (credentialCache: CredentialCache) => Promise<void> | void): Promise<void>;
27+
}
28+
29+
// @public (undocumented)
30+
export interface ICredentialCacheEntry {
31+
// (undocumented)
32+
credential: string;
33+
// (undocumented)
34+
credentialMetadata?: object;
35+
// (undocumented)
36+
expires?: Date;
37+
}
38+
39+
// @public (undocumented)
40+
export interface ICredentialCacheOptions {
41+
// (undocumented)
42+
cacheFilePath?: string;
43+
// (undocumented)
44+
supportEditing: boolean;
45+
}
46+
47+
// @public
48+
export const RUSH_USER_FOLDER_NAME: '.rush-user';
49+
50+
```

0 commit comments

Comments
 (0)