Skip to content

Commit 05518e4

Browse files
Clean up old official extensions registry code (#8998)
* feat: Add unit tests for src/extensions/resolveSource.ts This commit adds unit tests for the `getExtensionRegistry` function in `src/extensions/resolveSource.ts`. The tests cover the following cases: - Fetching the full extension registry. - Fetching only the featured extensions. - Handling cases where the `mods` or `featured` properties are missing from the API response. The tests use `nock` to mock the API responses and `chai` for assertions. Note: The `npm run format` and `npm run test` commands are currently failing due to an ESLint configuration issue in the repository. The tests were run directly using `npm run mocha` to bypass the linter. * lint * THis code is unused, kill it --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
1 parent fb0dbb5 commit 05518e4

File tree

3 files changed

+0
-71
lines changed

3 files changed

+0
-71
lines changed

src/extensions/extensionsHelper.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@ marked.use(markedTerminal() as any);
1313

1414
import { extensionsOrigin, extensionsPublisherOrigin, storageOrigin } from "../api";
1515
import { archiveDirectory } from "../archiveDirectory";
16-
import { convertOfficialExtensionsToList } from "./utils";
1716
import { getFirebaseConfig } from "../functionsConfig";
1817
import { getProjectAdminSdkConfigOrCached } from "../emulator/adminSdkConfig";
19-
import { getExtensionRegistry } from "./resolveSource";
2018
import { FirebaseError } from "../error";
2119
import { diagnose } from "./diagnose";
2220
import { checkResponse } from "./askUserForParam";
@@ -1138,20 +1136,6 @@ export function displayReleaseNotes(args: {
11381136
logger.info(message);
11391137
}
11401138

1141-
/**
1142-
* Display list of all official extensions and prompt user to select one.
1143-
* @param message The prompt message to display
1144-
* @return Promise that resolves to the extension name (e.g. storage-resize-images)
1145-
*/
1146-
export async function promptForOfficialExtension(message: string): Promise<string> {
1147-
const officialExts = await getExtensionRegistry(true);
1148-
return await select<string>({
1149-
message,
1150-
choices: convertOfficialExtensionsToList(officialExts),
1151-
pageSize: Object.keys(officialExts).length,
1152-
});
1153-
}
1154-
11551139
// TODO(inlined): Fix prompt library so that a choices array doesn't assume all values
11561140
// must be the same type as the literal of the first
11571141
type repeateInstanceResponse = "updateExisting" | "installNew" | "cancel";

src/extensions/resolveSource.ts

Lines changed: 0 additions & 38 deletions
This file was deleted.

src/extensions/utils.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import {
44
FUNCTIONS_RESOURCE_TYPE,
55
FUNCTIONS_V2_RESOURCE_TYPE,
66
} from "./types";
7-
import { RegistryEntry } from "./resolveSource";
87
import { Runtime } from "../deploy/functions/runtimes/supported";
98
import { Choice } from "../prompt";
109

@@ -21,22 +20,6 @@ export function convertExtensionOptionToLabeledList(options: ParamOption[]): Cho
2120
});
2221
}
2322

24-
/**
25-
* Convert map of RegistryEntry into Inquirer-friendly list for prompt, with all items unchecked.
26-
*/
27-
export function convertOfficialExtensionsToList(officialExts: {
28-
[key: string]: RegistryEntry;
29-
}): Choice<string>[] {
30-
const l = Object.entries(officialExts).map(([key, entry]) => {
31-
return {
32-
checked: false,
33-
value: `${entry.publisher}/${key}`,
34-
};
35-
});
36-
l.sort((a, b) => a.value.localeCompare(b.value));
37-
return l;
38-
}
39-
4023
/**
4124
* Generates a random string of lowercase letters and numbers
4225
* @param length The length of the string

0 commit comments

Comments
 (0)