Skip to content

Commit 6aba264

Browse files
committed
Fix OIDC published plugins author links on site
1 parent 9574e72 commit 6aba264

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

scripts/generate_site_plugins.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ const EXCLUDED_PLUGINS = [
2727
"jsonforms-typedoc-theme",
2828
"typedoc-jsonforms-theme",
2929
"suika-docs-theme",
30+
31+
// Improperly tagged, not actually a TypeDoc plugin
32+
"typedoc-toolbox",
3033
];
3134

3235
const EXCLUDED_PLUGIN_USERS = [
@@ -63,6 +66,7 @@ async function getSupportedVersions(npmPackage) {
6366
* @prop {string} version
6467
* @prop {string} description
6568
* @prop {{ username: string}} publisher
69+
* @prop {Array<{ username: string }>} maintainers
6670
* @prop {string} license
6771
* @prop {string} date
6872
* @prop {NpmLinks} links
@@ -108,6 +112,7 @@ function getSupportingPlugins(typedocVersion, plugins) {
108112
for (const plugin of plugins) {
109113
if (EXCLUDED_PLUGINS.includes(plugin.name)) continue;
110114
if (EXCLUDED_PLUGIN_USERS.includes(plugin.publisher.username)) continue;
115+
if (plugin.maintainers.some(n => EXCLUDED_PLUGIN_USERS.includes(n.username))) continue;
111116

112117
let version = plugin.peer.trim();
113118
if (!version) continue;
@@ -185,6 +190,9 @@ function relativeDate(date) {
185190
}
186191

187192
const deltaWeeks = Math.floor(deltaDays / 7);
193+
if (deltaWeeks === 1) {
194+
return `1 week ago`;
195+
}
188196
if (deltaWeeks <= 3) {
189197
return `${deltaWeeks} weeks ago`;
190198
}
@@ -232,9 +240,15 @@ async function createInclude(plugins, checkVersions, path) {
232240
` <p class="box-title"><a href="${plugin.links.npm}" target="_blank">${plugin.name}</a></p>`,
233241
);
234242
out.push(` <p>${miniMarkdown(plugin.description || "")}</p>`);
243+
let owner = "";
244+
if (plugin.publisher.username.toLowerCase() === "github actions") {
245+
owner = plugin.maintainers[0].username;
246+
} else {
247+
owner = plugin.publisher.username;
248+
}
235249
out.push(
236250
` <p>`,
237-
` <a href="https://www.npmjs.com/~${plugin.publisher.username}" target="_blank">${plugin.publisher.username}</a> •`,
251+
` <a href="https://www.npmjs.com/~${owner}" target="_blank">${owner}</a> •`,
238252
` ${plugin.version} •`,
239253
` ${relativeDate(plugin.date)} •`,
240254
` ${plugin.license || "no license"}`,

0 commit comments

Comments
 (0)