diff --git a/lib/prepare_security.js b/lib/prepare_security.js index 278f7974..f103f578 100644 --- a/lib/prepare_security.js +++ b/lib/prepare_security.js @@ -33,12 +33,16 @@ export default class SecurityReleaseSteward { const req = new Request(credentials); const release = new PrepareSecurityRelease(req); const releaseDate = await release.promptReleaseDate(cli); - validateDate(releaseDate); + if (releaseDate !== 'TBD') { + validateDate(releaseDate); + } + const createVulnerabilitiesJSON = await release.promptVulnerabilitiesJSON(cli); let securityReleasePRUrl; if (createVulnerabilitiesJSON) { - securityReleasePRUrl = await this.createVulnerabilitiesJSON(req, release, { cli }); + securityReleasePRUrl = await this.createVulnerabilitiesJSON( + req, release, releaseDate, { cli }); } const createIssue = await release.promptCreateRelaseIssue(cli); @@ -51,7 +55,7 @@ export default class SecurityReleaseSteward { cli.ok('Done!'); } - async createVulnerabilitiesJSON(req, release, { cli }) { + async createVulnerabilitiesJSON(req, release, releaseDate, { cli }) { // checkout on the next-security-release branch checkoutOnSecurityReleaseBranch(cli, this.repository); @@ -61,8 +65,7 @@ export default class SecurityReleaseSteward { const deps = _.groupBy(depUpdates, 'name'); // create the vulnerabilities.json file in the security-release repo - const filePath = await release.createVulnerabilitiesJSON(reports, deps, { cli }); - + const filePath = await release.createVulnerabilitiesJSON(reports, deps, releaseDate, { cli }); // review the vulnerabilities.json file const review = await release.promptReviewVulnerabilitiesJSON(cli); @@ -127,7 +130,7 @@ class PrepareSecurityRelease { nextWeekDate.setDate(nextWeekDate.getDate() + 7); // Format the date as YYYY/MM/DD const formattedDate = nextWeekDate.toISOString().slice(0, 10).replace(/-/g, '/'); - return cli.prompt('Enter target release date in YYYY/MM/DD format:', { + return cli.prompt('Enter target release date in YYYY/MM/DD format (TBD if not defined yet):', { questionType: 'input', defaultAnswer: formattedDate }); @@ -217,9 +220,10 @@ class PrepareSecurityRelease { return selectedReports; } - async createVulnerabilitiesJSON(reports, dependencies, { cli }) { + async createVulnerabilitiesJSON(reports, dependencies, releaseDate, { cli }) { cli.separator('Creating vulnerabilities.json...'); const file = JSON.stringify({ + releaseDate, reports, dependencies }, null, 2);