Skip to content

Commit

Permalink
fix: download section
Browse files Browse the repository at this point in the history
  • Loading branch information
marco-ippolito committed Apr 19, 2024
1 parent f65c680 commit f72ecc9
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions lib/security_blog.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import fs from 'node:fs';
import path from 'node:path';
import _ from 'lodash';
import nv from '@pkgjs/nv';
import {
PLACEHOLDERS,
getVulnerabilitiesJSON,
Expand Down Expand Up @@ -197,7 +198,7 @@ export default class SecurityBlog {
.replaceAll(PLACEHOLDERS.reports, await this.getReportsTemplate(content))
.replaceAll(PLACEHOLDERS.dependencyUpdates,
this.getDependencyUpdatesTemplate(dependencyUpdates))
.replaceAll(PLACEHOLDERS.downloads, this.getDownloadsTemplate());
.replaceAll(PLACEHOLDERS.downloads, await this.getDownloadsTemplate(affectedVersions));
}

async getReportsTemplate(content) {
Expand Down Expand Up @@ -265,8 +266,17 @@ export default class SecurityBlog {
return template;
}

getDownloadsTemplate() {
return '';
async getDownloadsTemplate(affectedVersions) {
let template = '';
const versionsToBeReleased = (await nv('supported')).filter(
(v) => affectedVersions.split(', ').includes(`${v.major}.x`)
);
for (const version of versionsToBeReleased) {
const v = `v${version.major}.${version.minor}.${Number(version.patch) + 1}`;
template += `- [Node.js ${v}](/blog/release/${v}/)\n`;
}

return template;
}

getSlug(releaseDate) {
Expand Down

0 comments on commit f72ecc9

Please sign in to comment.