Skip to content

Commit 9517d53

Browse files
committed
fix(dts-generator): fix download-apijson by querying differently
Don't use the scoped search, which apparently stopped working, and use standard search instead. The max supported limit of search results is 250 right now and the current number of hits is still lower (183). This number might increase over time to a degree where relevant libraries are not within the first 250. Results are sorted by popularity etc., so the libraries are right now still at the very beginning of the result list. This creates a comfortable buffer for the time being. Fixes #488
1 parent e3e6a84 commit 9517d53

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

packages/dts-generator/src/js-utils/ui5-metadata.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export async function getSAPUI5LibsMeta(version) {
6161
export async function getOpenUI5PossibleLibNames() {
6262
const fetch = (await import("node-fetch")).default;
6363
const openUI5OrgResponse = await fetch(
64-
`https://registry.npmjs.com/-/v1/search?text=scope:openui5&size=100`,
64+
`https://registry.npmjs.com/-/v1/search?text=@openui5&size=250`,
6565
{
6666
headers: {
6767
"User-Agent": "@ui5-dts-generator",
@@ -74,9 +74,10 @@ export async function getOpenUI5PossibleLibNames() {
7474
}
7575
const openUI5OrgSearchText = await openUI5OrgResponse.text();
7676
const openUI5OrgSearch = JSON.parse(openUI5OrgSearchText);
77-
const possibleOpenUI5LibNames = map(openUI5OrgSearch.objects, (_) =>
78-
_.package.name.substr("@openui5/".length),
79-
);
77+
const possibleOpenUI5LibNames = openUI5OrgSearch.objects
78+
.map((packageObject) => packageObject.package.name)
79+
.filter((name) => name.startsWith("@openui5/sap"))
80+
.map((name) => name.replace("@openui5/", ""));
8081
return possibleOpenUI5LibNames;
8182
}
8283

0 commit comments

Comments
 (0)