github-milestone-roadmap 0.1.0__py3-none-any.whl
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.
- github_milestone_roadmap/__init__.py +8 -0
- github_milestone_roadmap/build.py +169 -0
- github_milestone_roadmap/changes.py +377 -0
- github_milestone_roadmap/cli.py +142 -0
- github_milestone_roadmap/config.py +304 -0
- github_milestone_roadmap/static/app.js +577 -0
- github_milestone_roadmap/static/index.html +49 -0
- github_milestone_roadmap/static/styles.css +589 -0
- github_milestone_roadmap-0.1.0.dist-info/METADATA +134 -0
- github_milestone_roadmap-0.1.0.dist-info/RECORD +13 -0
- github_milestone_roadmap-0.1.0.dist-info/WHEEL +4 -0
- github_milestone_roadmap-0.1.0.dist-info/entry_points.txt +2 -0
- github_milestone_roadmap-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,577 @@
|
|
|
1
|
+
const API_ROOT = "https://api.github.com";
|
|
2
|
+
const CACHE_TTL_MS = 15 * 60 * 1000;
|
|
3
|
+
|
|
4
|
+
// Filled from config.json, which `github-milestone-roadmap build` writes next to this file.
|
|
5
|
+
let CACHE_PREFIX = "roadmap:";
|
|
6
|
+
let REPOS = [];
|
|
7
|
+
|
|
8
|
+
const roadmapEl = document.querySelector("#roadmap");
|
|
9
|
+
|
|
10
|
+
if ("scrollRestoration" in history) {
|
|
11
|
+
history.scrollRestoration = "manual";
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
loadRoadmap();
|
|
15
|
+
|
|
16
|
+
async function loadRoadmap() {
|
|
17
|
+
try {
|
|
18
|
+
const config = await loadConfig();
|
|
19
|
+
CACHE_PREFIX = `${config.cache_key}:`;
|
|
20
|
+
REPOS = config.repos;
|
|
21
|
+
} catch (error) {
|
|
22
|
+
const message = document.createElement("p");
|
|
23
|
+
message.className = "empty";
|
|
24
|
+
message.textContent = `Could not load the roadmap configuration (config.json): ${apiErrorMessage(error)}`;
|
|
25
|
+
roadmapEl.replaceChildren(message);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
renderRoadmap(REPOS.map((repo) => ({ ...repo, loading: true, releases: [] })));
|
|
30
|
+
REPOS.forEach((repo) => refreshPackage(repo.name));
|
|
31
|
+
|
|
32
|
+
if (!location.hash) {
|
|
33
|
+
window.scrollTo({ top: 0, left: 0 });
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async function loadConfig() {
|
|
38
|
+
const response = await fetch("config.json", { cache: "no-cache" });
|
|
39
|
+
if (!response.ok) {
|
|
40
|
+
throw new Error(`request failed with ${response.status} ${response.statusText}`);
|
|
41
|
+
}
|
|
42
|
+
return response.json();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function repoUrl(repo) {
|
|
46
|
+
return `https://github.com/${repo.owner}/${repo.name}`;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async function refreshPackage(repoName, options = {}) {
|
|
50
|
+
const repo = REPOS.find((item) => item.name === repoName);
|
|
51
|
+
if (!repo) return;
|
|
52
|
+
|
|
53
|
+
replacePackageCard({ ...repo, loading: true, releases: [] });
|
|
54
|
+
const pkg = await loadPackageRoadmap(repo, options);
|
|
55
|
+
replacePackageCard(pkg);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async function loadPackageRoadmap(repo, options = {}) {
|
|
59
|
+
try {
|
|
60
|
+
const [milestones, items, closedPulls] = await Promise.all([
|
|
61
|
+
githubJson(`/repos/${repo.owner}/${repo.name}/milestones?state=open&per_page=100`, options),
|
|
62
|
+
githubJson(`/repos/${repo.owner}/${repo.name}/issues?state=open&per_page=100`, options),
|
|
63
|
+
githubJson(`/repos/${repo.owner}/${repo.name}/pulls?state=closed&sort=updated&direction=desc&per_page=100`, options),
|
|
64
|
+
]);
|
|
65
|
+
const releases = groupMilestonesByRelease(milestones);
|
|
66
|
+
const itemsByMilestone = groupItemsByMilestone(items);
|
|
67
|
+
const mergedPullsByMilestone = groupMergedPullsByMilestone(closedPulls);
|
|
68
|
+
|
|
69
|
+
for (const release of releases) {
|
|
70
|
+
release.roadmap = itemsForMilestone(itemsByMilestone, release.roadmapMilestone);
|
|
71
|
+
release.proposed = itemsForMilestone(itemsByMilestone, release.proposedMilestone);
|
|
72
|
+
release.merged = mergedPullsForMilestone(mergedPullsByMilestone, release.roadmapMilestone);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
await addReviewStatuses(repo, releases, options);
|
|
76
|
+
|
|
77
|
+
return {
|
|
78
|
+
...repo,
|
|
79
|
+
url: repoUrl(repo),
|
|
80
|
+
releases: releases.filter((release) => release.roadmap.length > 0 || release.proposed.length > 0 || release.merged.length > 0),
|
|
81
|
+
};
|
|
82
|
+
} catch (error) {
|
|
83
|
+
return {
|
|
84
|
+
...repo,
|
|
85
|
+
url: repoUrl(repo),
|
|
86
|
+
error: apiErrorMessage(error),
|
|
87
|
+
releases: [],
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function groupMilestonesByRelease(milestones) {
|
|
93
|
+
const byVersion = new Map();
|
|
94
|
+
|
|
95
|
+
for (const milestone of milestones) {
|
|
96
|
+
const match = milestone.title.trim().match(/^(v?\d+\.\d+\.\d+)(?:\s*\(proposed\))?$/i);
|
|
97
|
+
if (!match) continue;
|
|
98
|
+
|
|
99
|
+
const version = normalizeVersion(match[1]);
|
|
100
|
+
const proposed = /\(proposed\)$/i.test(milestone.title.trim());
|
|
101
|
+
|
|
102
|
+
if (!byVersion.has(version)) {
|
|
103
|
+
byVersion.set(version, {
|
|
104
|
+
version,
|
|
105
|
+
roadmapMilestone: null,
|
|
106
|
+
proposedMilestone: null,
|
|
107
|
+
roadmap: [],
|
|
108
|
+
proposed: [],
|
|
109
|
+
merged: [],
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const release = byVersion.get(version);
|
|
114
|
+
if (proposed) {
|
|
115
|
+
release.proposedMilestone = milestone;
|
|
116
|
+
} else {
|
|
117
|
+
release.roadmapMilestone = milestone;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return [...byVersion.values()].sort((a, b) => compareVersions(a.version, b.version));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function groupItemsByMilestone(items) {
|
|
125
|
+
const byMilestone = new Map();
|
|
126
|
+
|
|
127
|
+
for (const item of items) {
|
|
128
|
+
if (!item.milestone) continue;
|
|
129
|
+
const existing = byMilestone.get(item.milestone.number) || [];
|
|
130
|
+
existing.push(item);
|
|
131
|
+
byMilestone.set(item.milestone.number, existing);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return byMilestone;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function groupMergedPullsByMilestone(pulls) {
|
|
138
|
+
const byMilestone = new Map();
|
|
139
|
+
|
|
140
|
+
for (const pull of pulls) {
|
|
141
|
+
if (!pull.merged_at || !pull.milestone) continue;
|
|
142
|
+
const existing = byMilestone.get(pull.milestone.number) || [];
|
|
143
|
+
existing.push(pull);
|
|
144
|
+
byMilestone.set(pull.milestone.number, existing);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return byMilestone;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function itemsForMilestone(itemsByMilestone, milestone) {
|
|
151
|
+
if (!milestone) return [];
|
|
152
|
+
|
|
153
|
+
return (itemsByMilestone.get(milestone.number) || [])
|
|
154
|
+
.map((item) => ({
|
|
155
|
+
title: item.title,
|
|
156
|
+
number: item.number,
|
|
157
|
+
url: item.html_url,
|
|
158
|
+
type: item.pull_request ? "pr" : "issue",
|
|
159
|
+
reviewStatus: null,
|
|
160
|
+
labels: item.labels.map((label) => label.name),
|
|
161
|
+
author: item.user?.login || null,
|
|
162
|
+
assignees: item.assignees.map((assignee) => assignee.login),
|
|
163
|
+
updatedAt: item.updated_at,
|
|
164
|
+
}))
|
|
165
|
+
.sort((a, b) => new Date(b.updatedAt) - new Date(a.updatedAt));
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
function mergedPullsForMilestone(pullsByMilestone, milestone) {
|
|
169
|
+
if (!milestone) return [];
|
|
170
|
+
|
|
171
|
+
return (pullsByMilestone.get(milestone.number) || [])
|
|
172
|
+
.map((pull) => ({
|
|
173
|
+
title: pull.title,
|
|
174
|
+
number: pull.number,
|
|
175
|
+
url: pull.html_url,
|
|
176
|
+
type: "pr",
|
|
177
|
+
reviewStatus: null,
|
|
178
|
+
labels: (pull.labels || []).map((label) => label.name),
|
|
179
|
+
author: pull.user?.login || null,
|
|
180
|
+
assignees: (pull.assignees || []).map((assignee) => assignee.login),
|
|
181
|
+
updatedAt: pull.updated_at,
|
|
182
|
+
mergedAt: pull.merged_at,
|
|
183
|
+
}))
|
|
184
|
+
.sort((a, b) => new Date(b.mergedAt) - new Date(a.mergedAt));
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
async function addReviewStatuses(repo, releases, options = {}) {
|
|
188
|
+
const pullRequests = releases.flatMap((release) => [
|
|
189
|
+
...release.roadmap.filter((item) => item.type === "pr"),
|
|
190
|
+
...release.proposed.filter((item) => item.type === "pr"),
|
|
191
|
+
]);
|
|
192
|
+
|
|
193
|
+
await Promise.all(pullRequests.map(async (item) => {
|
|
194
|
+
try {
|
|
195
|
+
const reviews = await githubJson(`/repos/${repo.owner}/${repo.name}/pulls/${item.number}/reviews?per_page=100`, options);
|
|
196
|
+
item.reviewStatus = reviewStatusFromReviews(reviews);
|
|
197
|
+
} catch {
|
|
198
|
+
item.reviewStatus = null;
|
|
199
|
+
}
|
|
200
|
+
}));
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function reviewStatusFromReviews(reviews) {
|
|
204
|
+
const latestByReviewer = new Map();
|
|
205
|
+
|
|
206
|
+
for (const review of reviews) {
|
|
207
|
+
if (!review.user?.login || !review.submitted_at) continue;
|
|
208
|
+
latestByReviewer.set(review.user.login, review.state);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
const states = [...latestByReviewer.values()];
|
|
212
|
+
if (states.includes("CHANGES_REQUESTED")) {
|
|
213
|
+
return { type: "changes", text: "🔴 Changes requested" };
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
if (states.includes("APPROVED")) {
|
|
217
|
+
return { type: "approved", text: "🟢 Approved" };
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
return { type: "review", text: "🟡 Review required" };
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
async function githubJson(path, options = {}) {
|
|
224
|
+
const cached = readCache(path);
|
|
225
|
+
if (!options.forceRefresh && cached && Date.now() - cached.savedAt < CACHE_TTL_MS) {
|
|
226
|
+
return cached.data;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const response = await fetch(`${API_ROOT}${path}`, {
|
|
230
|
+
headers: {
|
|
231
|
+
Accept: "application/vnd.github+json",
|
|
232
|
+
"X-GitHub-Api-Version": "2022-11-28",
|
|
233
|
+
},
|
|
234
|
+
});
|
|
235
|
+
|
|
236
|
+
if (!response.ok) {
|
|
237
|
+
const remaining = response.headers.get("x-ratelimit-remaining");
|
|
238
|
+
const reset = response.headers.get("x-ratelimit-reset");
|
|
239
|
+
if (response.status === 403 && remaining === "0" && cached) {
|
|
240
|
+
return cached.data;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
const message = response.status === 403 && remaining === "0"
|
|
244
|
+
? `GitHub API rate limit reached. Try again after ${formatResetTime(reset)}.`
|
|
245
|
+
: `GitHub API request failed with ${response.status} ${response.statusText}.`;
|
|
246
|
+
throw new Error(message);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
const data = await response.json();
|
|
250
|
+
writeCache(path, data);
|
|
251
|
+
return data;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
function readCache(path) {
|
|
255
|
+
try {
|
|
256
|
+
const value = localStorage.getItem(`${CACHE_PREFIX}${path}`);
|
|
257
|
+
return value ? JSON.parse(value) : null;
|
|
258
|
+
} catch {
|
|
259
|
+
return null;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
function writeCache(path, data) {
|
|
264
|
+
try {
|
|
265
|
+
localStorage.setItem(`${CACHE_PREFIX}${path}`, JSON.stringify({ savedAt: Date.now(), data }));
|
|
266
|
+
} catch {
|
|
267
|
+
// Ignore full or unavailable storage; the live API response is still usable.
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
function renderRoadmap(packages) {
|
|
272
|
+
const fragment = document.createDocumentFragment();
|
|
273
|
+
|
|
274
|
+
for (const pkg of packages) {
|
|
275
|
+
fragment.appendChild(renderPackage(pkg));
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
roadmapEl.replaceChildren(fragment);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
function replacePackageCard(pkg) {
|
|
282
|
+
const current = roadmapEl.querySelector(`[data-repo="${pkg.name}"]`);
|
|
283
|
+
const next = renderPackage(pkg);
|
|
284
|
+
|
|
285
|
+
if (current) {
|
|
286
|
+
current.replaceWith(next);
|
|
287
|
+
} else {
|
|
288
|
+
roadmapEl.appendChild(next);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
function renderPackage(pkg) {
|
|
293
|
+
const article = document.createElement("article");
|
|
294
|
+
article.className = `package-card${pkg.error ? " error" : ""}`;
|
|
295
|
+
article.dataset.repo = pkg.name;
|
|
296
|
+
article.id = pkg.name;
|
|
297
|
+
|
|
298
|
+
const header = document.createElement("header");
|
|
299
|
+
header.className = "package-header";
|
|
300
|
+
|
|
301
|
+
const headingGroup = document.createElement("div");
|
|
302
|
+
const heading = document.createElement("h2");
|
|
303
|
+
heading.textContent = pkg.name;
|
|
304
|
+
const description = document.createElement("p");
|
|
305
|
+
description.textContent = packageStatusText(pkg);
|
|
306
|
+
headingGroup.append(heading, description);
|
|
307
|
+
|
|
308
|
+
const actions = document.createElement("div");
|
|
309
|
+
actions.className = "package-actions";
|
|
310
|
+
|
|
311
|
+
const link = document.createElement("a");
|
|
312
|
+
link.className = "repo-link";
|
|
313
|
+
link.href = pkg.url || repoUrl(pkg);
|
|
314
|
+
link.rel = "noreferrer";
|
|
315
|
+
link.textContent = "View repo";
|
|
316
|
+
|
|
317
|
+
const reload = document.createElement("button");
|
|
318
|
+
reload.className = "reload-button";
|
|
319
|
+
reload.type = "button";
|
|
320
|
+
reload.setAttribute("aria-label", pkg.loading ? `Reloading ${pkg.name}` : `Reload ${pkg.name}`);
|
|
321
|
+
reload.disabled = Boolean(pkg.loading);
|
|
322
|
+
reload.addEventListener("click", () => refreshPackage(pkg.name, { forceRefresh: true }));
|
|
323
|
+
|
|
324
|
+
const reloadIcon = document.createElement("span");
|
|
325
|
+
reloadIcon.className = "reload-icon";
|
|
326
|
+
reloadIcon.setAttribute("aria-hidden", "true");
|
|
327
|
+
reloadIcon.textContent = "↻";
|
|
328
|
+
|
|
329
|
+
const reloadText = document.createElement("span");
|
|
330
|
+
reloadText.textContent = pkg.loading ? "Loading" : "Reload";
|
|
331
|
+
reload.append(reloadIcon, reloadText);
|
|
332
|
+
|
|
333
|
+
actions.append(link, reload);
|
|
334
|
+
|
|
335
|
+
header.append(headingGroup, actions);
|
|
336
|
+
article.appendChild(header);
|
|
337
|
+
|
|
338
|
+
const releaseList = document.createElement("div");
|
|
339
|
+
releaseList.className = "release-list";
|
|
340
|
+
|
|
341
|
+
if (pkg.loading) {
|
|
342
|
+
const loading = document.createElement("p");
|
|
343
|
+
loading.className = "empty";
|
|
344
|
+
loading.textContent = "Fetching open milestones, issues, and pull requests from GitHub.";
|
|
345
|
+
releaseList.appendChild(loading);
|
|
346
|
+
} else if (pkg.releases.length === 0 && !pkg.error) {
|
|
347
|
+
const empty = document.createElement("p");
|
|
348
|
+
empty.className = "empty";
|
|
349
|
+
empty.textContent = "No open roadmap items found.";
|
|
350
|
+
releaseList.appendChild(empty);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
if (!pkg.loading && pkg.releases.length > 0) {
|
|
354
|
+
releaseList.appendChild(renderReleaseNav(pkg));
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
for (const release of pkg.releases) {
|
|
358
|
+
releaseList.appendChild(renderRelease(pkg.name, release));
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
article.appendChild(releaseList);
|
|
362
|
+
return article;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
function packageStatusText(pkg) {
|
|
366
|
+
if (pkg.loading) return "Loading open roadmap items from GitHub.";
|
|
367
|
+
if (pkg.error) return pkg.error;
|
|
368
|
+
return pkg.description;
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
function renderReleaseNav(pkg) {
|
|
372
|
+
const nav = document.createElement("nav");
|
|
373
|
+
nav.className = "release-nav";
|
|
374
|
+
nav.setAttribute("aria-label", `${pkg.name} planned releases`);
|
|
375
|
+
|
|
376
|
+
const label = document.createElement("span");
|
|
377
|
+
label.textContent = "Jump to release";
|
|
378
|
+
nav.appendChild(label);
|
|
379
|
+
|
|
380
|
+
for (const release of pkg.releases) {
|
|
381
|
+
const link = document.createElement("a");
|
|
382
|
+
link.href = `#${releaseId(pkg.name, release.version)}`;
|
|
383
|
+
link.textContent = release.version;
|
|
384
|
+
nav.appendChild(link);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
return nav;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
function renderRelease(repoName, release) {
|
|
391
|
+
const section = document.createElement("section");
|
|
392
|
+
section.className = "release-row";
|
|
393
|
+
const id = releaseId(repoName, release.version);
|
|
394
|
+
section.id = id;
|
|
395
|
+
|
|
396
|
+
const heading = document.createElement("div");
|
|
397
|
+
heading.className = "release-label";
|
|
398
|
+
|
|
399
|
+
const title = document.createElement("h3");
|
|
400
|
+
title.textContent = release.version;
|
|
401
|
+
|
|
402
|
+
const counts = document.createElement("div");
|
|
403
|
+
counts.className = "release-counts";
|
|
404
|
+
counts.append(
|
|
405
|
+
renderReleaseCount(`🗺️ ${release.roadmap.length} on roadmap`, `${id}-roadmap`),
|
|
406
|
+
renderReleaseCount(`💡 ${release.proposed.length} proposed`, `${id}-proposed`),
|
|
407
|
+
renderReleaseCount(`✅ ${release.merged.length} merged`, `${id}-merged`),
|
|
408
|
+
);
|
|
409
|
+
|
|
410
|
+
heading.append(title, counts);
|
|
411
|
+
|
|
412
|
+
const grid = document.createElement("div");
|
|
413
|
+
grid.className = "release-grid";
|
|
414
|
+
grid.append(
|
|
415
|
+
renderLane("🗺️ On roadmap", release.roadmap, release.roadmapMilestone, "No open items.", `${id}-roadmap`),
|
|
416
|
+
renderLane("💡 Proposed", release.proposed, release.proposedMilestone, "No open items.", `${id}-proposed`),
|
|
417
|
+
renderLane("✅ Merged", release.merged, release.roadmapMilestone, "No merged PRs.", `${id}-merged`),
|
|
418
|
+
);
|
|
419
|
+
|
|
420
|
+
section.append(heading, grid);
|
|
421
|
+
return section;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
function renderReleaseCount(text, targetId) {
|
|
425
|
+
const count = document.createElement("a");
|
|
426
|
+
count.className = "release-count";
|
|
427
|
+
count.href = `#${targetId}`;
|
|
428
|
+
count.textContent = text;
|
|
429
|
+
|
|
430
|
+
return count;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
function releaseId(repoName, version) {
|
|
434
|
+
return `${repoName}-${version}`.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "");
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
function renderLane(title, items, milestone, emptyText, id) {
|
|
438
|
+
const lane = document.createElement("section");
|
|
439
|
+
lane.className = "lane";
|
|
440
|
+
lane.id = id;
|
|
441
|
+
|
|
442
|
+
const heading = document.createElement("h4");
|
|
443
|
+
const label = milestone?.html_url ? document.createElement("a") : document.createElement("span");
|
|
444
|
+
label.textContent = title;
|
|
445
|
+
if (milestone?.html_url) {
|
|
446
|
+
label.className = "milestone-link";
|
|
447
|
+
label.href = milestone.html_url;
|
|
448
|
+
label.rel = "noreferrer";
|
|
449
|
+
}
|
|
450
|
+
const count = document.createElement("span");
|
|
451
|
+
count.className = "count";
|
|
452
|
+
count.textContent = items.length;
|
|
453
|
+
heading.append(label, count);
|
|
454
|
+
lane.appendChild(heading);
|
|
455
|
+
|
|
456
|
+
if (items.length === 0) {
|
|
457
|
+
const empty = document.createElement("p");
|
|
458
|
+
empty.className = "empty";
|
|
459
|
+
empty.textContent = emptyText;
|
|
460
|
+
lane.appendChild(empty);
|
|
461
|
+
return lane;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
const list = document.createElement("ul");
|
|
465
|
+
list.className = "item-list";
|
|
466
|
+
for (const item of items) {
|
|
467
|
+
list.appendChild(renderItem(item));
|
|
468
|
+
}
|
|
469
|
+
lane.appendChild(list);
|
|
470
|
+
return lane;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
function renderItem(item) {
|
|
474
|
+
const row = document.createElement("li");
|
|
475
|
+
row.className = "item";
|
|
476
|
+
|
|
477
|
+
const titleRow = document.createElement("div");
|
|
478
|
+
titleRow.className = "item-title-row";
|
|
479
|
+
|
|
480
|
+
const link = document.createElement("a");
|
|
481
|
+
link.className = "item-title";
|
|
482
|
+
link.href = item.url;
|
|
483
|
+
link.rel = "noreferrer";
|
|
484
|
+
link.textContent = item.title;
|
|
485
|
+
|
|
486
|
+
const number = document.createElement("a");
|
|
487
|
+
number.className = "item-number";
|
|
488
|
+
number.href = item.url;
|
|
489
|
+
number.rel = "noreferrer";
|
|
490
|
+
number.textContent = `#${item.number}`;
|
|
491
|
+
|
|
492
|
+
const itemActions = document.createElement("div");
|
|
493
|
+
itemActions.className = "item-actions";
|
|
494
|
+
|
|
495
|
+
if (item.reviewStatus) {
|
|
496
|
+
const status = document.createElement("span");
|
|
497
|
+
status.className = `review-status ${item.reviewStatus.type}`;
|
|
498
|
+
status.textContent = item.reviewStatus.text;
|
|
499
|
+
itemActions.appendChild(status);
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
itemActions.appendChild(number);
|
|
503
|
+
titleRow.append(link, itemActions);
|
|
504
|
+
row.appendChild(titleRow);
|
|
505
|
+
|
|
506
|
+
const footer = document.createElement("div");
|
|
507
|
+
footer.className = "item-footer";
|
|
508
|
+
|
|
509
|
+
const labels = document.createElement("div");
|
|
510
|
+
labels.className = "labels";
|
|
511
|
+
if (item.labels.length > 0) {
|
|
512
|
+
for (const labelText of item.labels) {
|
|
513
|
+
const label = document.createElement("span");
|
|
514
|
+
label.className = "pill";
|
|
515
|
+
label.textContent = labelText;
|
|
516
|
+
labels.appendChild(label);
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
const people = document.createElement("div");
|
|
521
|
+
people.className = "people";
|
|
522
|
+
for (const personInfo of itemPeople(item)) {
|
|
523
|
+
const person = document.createElement("span");
|
|
524
|
+
person.className = `person ${personInfo.type}`;
|
|
525
|
+
person.textContent = personInfo.text;
|
|
526
|
+
people.appendChild(person);
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
if (labels.children.length > 0 || people.children.length > 0) {
|
|
530
|
+
footer.append(labels, people);
|
|
531
|
+
row.appendChild(footer);
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
return row;
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
function itemPeople(item) {
|
|
538
|
+
const people = [];
|
|
539
|
+
|
|
540
|
+
if (item.type === "pr" && item.author) {
|
|
541
|
+
people.push({ type: "owner", text: `👤 Owner @${item.author}` });
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
for (const assignee of item.assignees) {
|
|
545
|
+
people.push({ type: "assignee", text: `🛠️ Assignee @${assignee}` });
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
return people;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
function normalizeVersion(version) {
|
|
552
|
+
return version.startsWith("v") ? version : `v${version}`;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
function compareVersions(a, b) {
|
|
556
|
+
const left = a.replace(/^v/i, "").split(".").map(Number);
|
|
557
|
+
const right = b.replace(/^v/i, "").split(".").map(Number);
|
|
558
|
+
|
|
559
|
+
for (let index = 0; index < Math.max(left.length, right.length); index += 1) {
|
|
560
|
+
const diff = (left[index] || 0) - (right[index] || 0);
|
|
561
|
+
if (diff !== 0) return diff;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
return 0;
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
function apiErrorMessage(error) {
|
|
568
|
+
return error instanceof Error ? error.message : "An unknown error occurred.";
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
function formatResetTime(resetSeconds) {
|
|
572
|
+
if (!resetSeconds) return "the rate limit resets";
|
|
573
|
+
return new Date(Number(resetSeconds) * 1000).toLocaleTimeString([], {
|
|
574
|
+
hour: "2-digit",
|
|
575
|
+
minute: "2-digit",
|
|
576
|
+
});
|
|
577
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<meta name="description" content="${description}">
|
|
7
|
+
<meta name="generator" content="github-milestone-roadmap ${version}">
|
|
8
|
+
<title>${title}</title>
|
|
9
|
+
<link rel="stylesheet" href="styles.css">
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<header class="site-header">
|
|
13
|
+
<nav class="nav" aria-label="Main navigation">
|
|
14
|
+
<a class="brand" href="${home_url}">${home_text}</a>
|
|
15
|
+
${source_link}
|
|
16
|
+
</nav>
|
|
17
|
+
|
|
18
|
+
<section class="hero">
|
|
19
|
+
<h1>${heading}</h1>
|
|
20
|
+
${subtitle_paragraph}
|
|
21
|
+
<blockquote>
|
|
22
|
+
This page reads live roadmap data from GitHub milestones. An issue/PR with a milestone named
|
|
23
|
+
<strong>vX.Y.Z</strong> is on the roadmap; issues/PRs with a milestone named <strong>vX.Y.Z (proposed)</strong>
|
|
24
|
+
contains issues/PRs proposed for that release (and will be discussed in the next community dev meeting).
|
|
25
|
+
</blockquote>
|
|
26
|
+
<nav class="repo-jump" aria-label="Jump to package roadmap">
|
|
27
|
+
<span>Jump to package</span>
|
|
28
|
+
${repo_links}
|
|
29
|
+
</nav>
|
|
30
|
+
</section>
|
|
31
|
+
</header>
|
|
32
|
+
|
|
33
|
+
<main>
|
|
34
|
+
<section id="roadmap" class="roadmap" aria-label="Roadmap packages"></section>
|
|
35
|
+
</main>
|
|
36
|
+
|
|
37
|
+
<footer class="site-footer">
|
|
38
|
+
<p>
|
|
39
|
+
Data is loaded directly from the public GitHub API. Only open issues and pull
|
|
40
|
+
requests assigned to open roadmap milestones are shown.
|
|
41
|
+
</p>
|
|
42
|
+
<p class="generator">
|
|
43
|
+
Built with <a href="https://github.com/mllam/github-milestone-roadmap" rel="noreferrer">github-milestone-roadmap</a> ${version}.
|
|
44
|
+
</p>
|
|
45
|
+
</footer>
|
|
46
|
+
|
|
47
|
+
<script src="app.js" defer></script>
|
|
48
|
+
</body>
|
|
49
|
+
</html>
|