epicshop 6.50.1 → 6.50.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/workshops.js +32 -10
- package/package.json +2 -2
|
@@ -105,18 +105,40 @@ async function fetchAvailableWorkshops() {
|
|
|
105
105
|
swr: 1000 * 60 * 60 * 6, // 6 hours stale-while-revalidate
|
|
106
106
|
async getFreshValue() {
|
|
107
107
|
// Note: `archived:false` is supported by GitHub search.
|
|
108
|
-
const
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
108
|
+
const baseUrl = `https://api.github.com/search/repositories?q=topic:workshop+org:${GITHUB_ORG}+archived:false&sort=stars&order=desc`;
|
|
109
|
+
const perPage = 100;
|
|
110
|
+
// GitHub Search API is paginated and defaults to 30 per page.
|
|
111
|
+
// It also caps results to the first 1000 items (10 pages at 100/page).
|
|
112
|
+
const maxPages = 10;
|
|
113
|
+
const allItems = [];
|
|
114
|
+
let totalCount = null;
|
|
115
|
+
for (let page = 1; page <= maxPages; page++) {
|
|
116
|
+
const url = new URL(baseUrl);
|
|
117
|
+
url.searchParams.set('per_page', String(perPage));
|
|
118
|
+
url.searchParams.set('page', String(page));
|
|
119
|
+
const response = await fetch(url, {
|
|
120
|
+
headers: getGitHubHeaders(),
|
|
121
|
+
});
|
|
122
|
+
if (!response.ok) {
|
|
123
|
+
if (response.status === 403) {
|
|
124
|
+
throw new Error('GitHub API rate limit exceeded. Please try again in a minute.');
|
|
125
|
+
}
|
|
126
|
+
throw new Error(`Failed to fetch workshops from GitHub: ${response.status}`);
|
|
127
|
+
}
|
|
128
|
+
const data = (await response.json());
|
|
129
|
+
const items = Array.isArray(data.items) ? data.items : [];
|
|
130
|
+
if (typeof data.total_count === 'number') {
|
|
131
|
+
totalCount = data.total_count;
|
|
115
132
|
}
|
|
116
|
-
|
|
133
|
+
allItems.push(...items);
|
|
134
|
+
// Stop when there are no more results for the next page.
|
|
135
|
+
if (items.length < perPage)
|
|
136
|
+
break;
|
|
137
|
+
// Or when we've already collected everything GitHub says exists.
|
|
138
|
+
if (totalCount !== null && allItems.length >= totalCount)
|
|
139
|
+
break;
|
|
117
140
|
}
|
|
118
|
-
|
|
119
|
-
return Array.isArray(data.items) ? data.items : [];
|
|
141
|
+
return allItems;
|
|
120
142
|
},
|
|
121
143
|
});
|
|
122
144
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "epicshop",
|
|
3
|
-
"version": "6.50.
|
|
3
|
+
"version": "6.50.2",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"build:watch": "nx watch --projects=epicshop -- nx run \\$NX_PROJECT_NAME:build"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@epic-web/workshop-utils": "6.50.
|
|
53
|
+
"@epic-web/workshop-utils": "6.50.2",
|
|
54
54
|
"@inquirer/prompts": "^7.5.1",
|
|
55
55
|
"chalk": "^5.6.2",
|
|
56
56
|
"close-with-grace": "^2.3.0",
|