diff --git a/components/git/release.js b/components/git/release.js index ae82e0ae..6c340bf2 100644 --- a/components/git/release.js +++ b/components/git/release.js @@ -32,6 +32,10 @@ const releaseOptions = { startLTS: { describe: 'Mark the release as the transition from Current to LTS', type: 'boolean' + }, + releaseDate: { + describe: 'Default relase date when --prepare is used. It must be YYYY-MM-DD', + type: 'string' } }; diff --git a/docs/git-node.md b/docs/git-node.md index b539a69f..3d86a1c7 100644 --- a/docs/git-node.md +++ b/docs/git-node.md @@ -224,6 +224,8 @@ Options: --security Demarcate the new security release as a security release [boolean] --startLTS Mark the release as the transition from Current to LTS [boolean] --filterLabel Filter PR by label when preparing a security release [string] + --releaseDate Default relase date when --prepare is used. + It must be YYYY-MM-DD [string] ``` ### Example @@ -462,7 +464,7 @@ It will retrieve all the triaged HackerOne reports and add creates the `vulnerab This command updates the `vulnerabilities.json` with target date of the security release. Example: - + ```sh git node security --update-date=2023/12/31 ``` @@ -471,7 +473,7 @@ Example: This command creates a pre-release announcement for the security release. Example: - + ```sh git node security --pre-release ``` diff --git a/lib/prepare_release.js b/lib/prepare_release.js index 6b0aa131..41e7605b 100644 --- a/lib/prepare_release.js +++ b/lib/prepare_release.js @@ -25,6 +25,7 @@ export default class ReleasePreparation extends Session { this.isLTS = false; this.isLTSTransition = argv.startLTS; this.runBranchDiff = !argv.skipBranchDiff; + this.defaultReleaseDate = argv.releaseDate ?? new Date().toISOString().slice(0, 10); this.ltsCodename = ''; this.date = ''; this.filterLabels = argv.filterLabel && argv.filterLabel.split(','); @@ -241,9 +242,8 @@ export default class ReleasePreparation extends Session { cli.stopSpinner('Updated REPLACEME items in docs'); // Fetch date to use in release commit & changelogs. - const todayDate = new Date().toISOString().split('T')[0]; this.date = await cli.prompt('Enter release date in YYYY-MM-DD format:', - { questionType: 'input', defaultAnswer: todayDate }); + { questionType: 'input', defaultAnswer: this.defaultReleaseDate }); cli.startSpinner('Updating CHANGELOG.md'); await this.updateMainChangelog();