@ckeditor/ckeditor5-dev-release-tools 39.2.1 → 39.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -58,6 +58,9 @@ const noteInfo = `[ℹ️](${ VERSIONING_POLICY_URL }#major-and-minor-breaking-c
58
58
  *
59
59
  * @param {String|null} [options.nextVersion=null] Next version to use. If not provided, a user needs to provide via CLI.
60
60
  *
61
+ * @param {FormatDateCallback} [options.formatDate] A callback allowing defining a custom format of the date inserted into the changelog.
62
+ * If not specified, the default date matches the `YYYY-MM-DD` pattern.
63
+ *
61
64
  * @returns {Promise.<undefined|String>}
62
65
  */
63
66
  module.exports = async function generateChangelogForMonoRepository( options ) {
@@ -406,7 +409,8 @@ module.exports = async function generateChangelogForMonoRepository( options ) {
406
409
  previousTag: options.from ? options.from : 'v' + rootPkgJson.version,
407
410
  isPatch: semver.diff( version, rootPkgJson.version ) === 'patch',
408
411
  skipCommitsLink: Boolean( options.skipLinks ),
409
- skipCompareLink: Boolean( options.skipLinks )
412
+ skipCompareLink: Boolean( options.skipLinks ),
413
+ date: options.formatDate ? options.formatDate( new Date() ) : changelogUtils.getFormattedDate()
410
414
  };
411
415
 
412
416
  const writerOptions = getWriterOptions( {
@@ -748,3 +752,11 @@ module.exports = async function generateChangelogForMonoRepository( options ) {
748
752
  * @param {String} [releaseBranch] A name of the branch that should be used for releasing packages. If not specified, the branch
749
753
  * used for the main repository will be used.
750
754
  */
755
+
756
+ /**
757
+ * @callback FormatDateCallback
758
+ *
759
+ * @param {Date} now The current date.
760
+ *
761
+ * @returns {String} The formatted date inserted into the changelog.
762
+ */
@@ -35,6 +35,9 @@ const SKIP_GENERATE_CHANGELOG = 'Typed "skip" as a new version. Aborting.';
35
35
  *
36
36
  * @param {String} [options.releaseBranch='master'] A name of the branch that should be used for releasing packages.
37
37
  *
38
+ * @param {FormatDateCallback} [options.formatDate] A callback allowing defining a custom format of the date inserted into the changelog.
39
+ * If not specified, the default date matches the `YYYY-MM-DD` pattern.
40
+ *
38
41
  * @returns {Promise}
39
42
  */
40
43
  module.exports = async function generateChangelogForSinglePackage( options = {} ) {
@@ -102,7 +105,8 @@ module.exports = async function generateChangelogForSinglePackage( options = {}
102
105
  isPatch: semver.diff( version, pkgJson.version ) === 'patch',
103
106
  isInternalRelease,
104
107
  skipCommitsLink: Boolean( options.skipLinks ),
105
- skipCompareLink: Boolean( options.skipLinks )
108
+ skipCompareLink: Boolean( options.skipLinks ),
109
+ date: options.formatDate ? options.formatDate( new Date() ) : changelogUtils.getFormattedDate()
106
110
  };
107
111
 
108
112
  const writerOptions = getWriterOptions( {
@@ -192,3 +196,11 @@ module.exports = async function generateChangelogForSinglePackage( options = {}
192
196
  log[ method ]( `${ startWithNewLine ? '\n' : '' }${ ' '.repeat( indentLevel * cli.INDENT_SIZE ) }` + message );
193
197
  }
194
198
  };
199
+
200
+ /**
201
+ * @callback FormatDateCallback
202
+ *
203
+ * @param {Date} now The current date.
204
+ *
205
+ * @returns {String} The formatted date inserted into the changelog.
206
+ */
@@ -7,6 +7,7 @@
7
7
 
8
8
  const fs = require( 'fs' );
9
9
  const path = require( 'path' );
10
+ const { format } = require( 'date-fns' );
10
11
  const { getRepositoryUrl } = require( './transformcommitutils' );
11
12
 
12
13
  const utils = {
@@ -95,6 +96,13 @@ const utils = {
95
96
  const truncatedChangelog = utils.changelogHeader + truncatedEntries.join( '\n' ).trim() + changelogFooter;
96
97
 
97
98
  utils.saveChangelog( truncatedChangelog, cwd );
99
+ },
100
+
101
+ /**
102
+ * @returns {String}
103
+ */
104
+ getFormattedDate() {
105
+ return format( new Date(), 'yyyy-MM-dd' );
98
106
  }
99
107
  };
100
108
 
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-dev-release-tools",
3
- "version": "39.2.1",
3
+ "version": "39.4.0",
4
4
  "description": "Tools used for releasing CKEditor 5 and related packages.",
5
5
  "keywords": [],
6
6
  "main": "lib/index.js",
7
7
  "dependencies": {
8
- "@ckeditor/ckeditor5-dev-utils": "^39.2.1",
8
+ "@ckeditor/ckeditor5-dev-utils": "^39.4.0",
9
9
  "@octokit/rest": "^19.0.0",
10
10
  "chalk": "^4.0.0",
11
11
  "cli-table": "^0.3.1",
@@ -15,6 +15,7 @@
15
15
  "conventional-changelog-writer": "^6.0.0",
16
16
  "conventional-commits-filter": "^3.0.0",
17
17
  "conventional-commits-parser": "^4.0.0",
18
+ "date-fns": "^2.30.0",
18
19
  "diff": "^5.0.0",
19
20
  "fs-extra": "^9.1.0",
20
21
  "git-raw-commits": "^3.0.0",