From 79731b61bd68d5eed47ff397ea4665ffb0c1346b Mon Sep 17 00:00:00 2001 From: pinage404 Date: Thu, 11 Jun 2026 15:43:24 +0000 Subject: [PATCH 1/4] check URL of communities --- package.json | 1 + scripts/test-communities-check-url.mjs | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 scripts/test-communities-check-url.mjs diff --git a/package.json b/package.json index a5b92db..6e770ad 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,7 @@ "test": "npm-run-all test:data test:js", "test:data": "node scripts/test-communities.js && node scripts/test-conferences.js", "test:js": "jest", + "test:data:url": "node scripts/test-communities-check-url.mjs", "watch": "npm-run-all build:communities build:conferences build:conferences-ics -p dev" }, "jest": { diff --git a/scripts/test-communities-check-url.mjs b/scripts/test-communities-check-url.mjs new file mode 100644 index 0000000..b70b9d9 --- /dev/null +++ b/scripts/test-communities-check-url.mjs @@ -0,0 +1,24 @@ +import path from 'path'; +import fs from 'fs'; + +const communitiesDir = path.resolve(import.meta.dirname, '../communities/'); + +const communitiesPath = fs + .readdirSync(communitiesDir) + .filter(file => file.endsWith('.json')) + .map(file => path.join(communitiesDir, file)); + +const communities = communitiesPath + .map(file => fs.readFileSync(file).toString()) + .map(fileContent => JSON.parse(fileContent)); + +const fetchCommunities = communities.map(community => fetch(community.url)); + +const failedURL = (await Promise.all(fetchCommunities)) + .filter(communityResponse => !communityResponse.ok) + .map(communityResponse => communityResponse.url); + +if (failedURL.length > 0) { + console.log(failedURL); + process.exit(1); +} From 071d6dfaea2c632b47439032af9000481a09bff8 Mon Sep 17 00:00:00 2001 From: pinage404 Date: Sun, 14 Jun 2026 23:50:48 +0200 Subject: [PATCH 2/4] check Meetup URL --- scripts/test-communities-check-url.mjs | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/scripts/test-communities-check-url.mjs b/scripts/test-communities-check-url.mjs index b70b9d9..66f5c03 100644 --- a/scripts/test-communities-check-url.mjs +++ b/scripts/test-communities-check-url.mjs @@ -14,10 +14,28 @@ const communities = communitiesPath const fetchCommunities = communities.map(community => fetch(community.url)); -const failedURL = (await Promise.all(fetchCommunities)) +const communitiesResponses = await Promise.all(fetchCommunities); + +const failedURLNotOK = communitiesResponses .filter(communityResponse => !communityResponse.ok) .map(communityResponse => communityResponse.url); +// meetup.com answer with HTTP 200 when a group is not found +const meetupGroupsNotFound = ( + await Promise.all( + communitiesResponses + .filter(communityResponse => communityResponse.ok) + .map(async communityResponse => { + const communityHTML = await communityResponse.text(); + return /]*>Meetup | Group not found<\/title>/.test(communityHTML) + ? communityResponse.url + : null; + }) + ) +).filter(maybeURL => maybeURL !== null); + +const failedURL = failedURLNotOK.concat(meetupGroupsNotFound); + if (failedURL.length > 0) { console.log(failedURL); process.exit(1); From 6dedbdd67b0f368f977a6b9053156a912c1613aa Mon Sep 17 00:00:00 2001 From: pinage404 Date: Sun, 14 Jun 2026 23:51:00 +0200 Subject: [PATCH 3/4] display stats --- scripts/test-communities-check-url.mjs | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/test-communities-check-url.mjs b/scripts/test-communities-check-url.mjs index 66f5c03..3d88245 100644 --- a/scripts/test-communities-check-url.mjs +++ b/scripts/test-communities-check-url.mjs @@ -38,5 +38,6 @@ const failedURL = failedURLNotOK.concat(meetupGroupsNotFound); if (failedURL.length > 0) { console.log(failedURL); + console.log('%i communities URL are failing on a total of %i', failedURL.length, communitiesPath.length); process.exit(1); } From 50527de88443a6cde08042d422f725c4392b05b7 Mon Sep 17 00:00:00 2001 From: pinage404 Date: Sun, 14 Jun 2026 23:59:07 +0200 Subject: [PATCH 4/4] display stats with valid JSON outputs --- scripts/test-communities-check-url.mjs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/test-communities-check-url.mjs b/scripts/test-communities-check-url.mjs index 3d88245..17b1657 100644 --- a/scripts/test-communities-check-url.mjs +++ b/scripts/test-communities-check-url.mjs @@ -37,7 +37,6 @@ const meetupGroupsNotFound = ( const failedURL = failedURLNotOK.concat(meetupGroupsNotFound); if (failedURL.length > 0) { - console.log(failedURL); - console.log('%i communities URL are failing on a total of %i', failedURL.length, communitiesPath.length); + console.log({ failedURL, failedURLCount: failedURL.length, total: communitiesPath.length }); process.exit(1); }