Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions lib/update_security_release.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,17 +268,27 @@ Summary: ${summary}\n`,
async calculateVersions(affectedVersions, supportedVersions) {
const h1AffectedVersions = [];
const patchedVersions = [];
let isPatchRelease = true;
for (const affectedVersion of affectedVersions) {
const major = affectedVersion.split('.')[0];
const latest = supportedVersions.find((v) => v.major === Number(major)).version;
const affectedMajor = affectedVersion.split('.')[0];
const latest = supportedVersions.find((v) => v.major === Number(affectedMajor)).version;
const version = await this.cli.prompt(
`What is the affected version (<=) for release line ${affectedVersion}?`,
{ questionType: 'input', defaultAnswer: latest });

const nextPatchVersion = parseInt(version.split('.')[2]) + 1;
const [major, minor, patch] = version.split('.');
const nextPatchVersion = `${major}.${minor}.${parseInt(patch) + 1}`;
const nextMinorVersion = `${major}.${parseInt(minor) + 1}.0`;
const patchedVersion = await this.cli.prompt(
`What is the patched version (>=) for release line ${affectedVersion}?`,
{ questionType: 'input', defaultAnswer: nextPatchVersion });
{
questionType: 'input',
defaultAnswer: isPatchRelease ? nextPatchVersion : nextMinorVersion
});

if (patchedVersion !== nextPatchVersion) {
isPatchRelease = false; // is a minor release
}

patchedVersions.push(patchedVersion);
h1AffectedVersions.push({
Expand Down
Loading