Skip to content

Commit 51bd2cd

Browse files
committed
Checking W3C group homepages
1 parent b959990 commit 51bd2cd

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

lib/2026.js

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -316,18 +316,15 @@ async function compute(group, template, deliverables, charter) {
316316
}
317317
if (checkGroups.length > 0) {
318318
status('Checking W3C group homepages...');
319-
const w3cGroups = Array.from(await listGroups());
320-
console.log(w3cGroups);
319+
const groups = await w3cgroups();
321320
checkGroups.forEach(a => {
322321
const name = a.textContent.trim();
323322
const href = a.href;
324-
console.log(`Checking group link: ${name} / ${href}`);
325-
let match = w3cGroups.find(g => g.name === name);
323+
let match = groups.find(g => g.name === name);
326324
if (!match) {
327325
// try to be more flexible
328-
match = w3cGroups.find(g => g["_links"]["homepage"] === href);
326+
match = groups.find(g => g["_links"]["homepage"] === href);
329327
}
330-
console.log(match);
331328
if (match && match["_links"]["homepage"]) {
332329
a.href = match["_links"]["homepage"].href;
333330
a.textContent = match.name;
@@ -399,6 +396,7 @@ async function compute(group, template, deliverables, charter) {
399396
config.timeStamp = new Date().toISOString();
400397
scriptConfig.textContent = JSON.stringify(config, null, 2);
401398
head.appendChild(scriptConfig);
399+
if (config.debug) console.log(config);
402400
}
403401

404402

@@ -523,11 +521,18 @@ async function fetchGroupData() {
523521
if (publiclists.length > 0) {
524522
group.publicList = publiclists[0];
525523
}
524+
if (config.debug) console.log(group);
526525
return group;
527526
}
528527

529-
export
530-
async function* listGroups() {
531-
for await (const v of iterateHAL("groups", `${config.w3cAPI}/groups`, true))
532-
yield v;
533-
}
528+
async function w3cgroups() {
529+
const groups = [];
530+
async function* listGroups() {
531+
for await (const v of hal("groups", `${config.w3cAPI}/groups`, true))
532+
yield v;
533+
}
534+
for await (const group of listGroups()) {
535+
groups.push(group);
536+
}
537+
return groups;
538+
}

0 commit comments

Comments
 (0)