@ckeditor/ckeditor5-dev-release-tools 44.0.0-alpha.4 → 44.0.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.
Files changed (46) hide show
  1. package/lib/tasks/cleanuppackages.js +22 -22
  2. package/lib/tasks/commitandtag.js +4 -4
  3. package/lib/tasks/creategithubrelease.js +11 -11
  4. package/lib/tasks/generatechangelogformonorepository.js +54 -54
  5. package/lib/tasks/generatechangelogforsinglepackage.js +11 -11
  6. package/lib/tasks/preparerepository.js +19 -19
  7. package/lib/tasks/publishpackages.js +10 -10
  8. package/lib/tasks/push.js +4 -4
  9. package/lib/tasks/reassignnpmtags.js +8 -8
  10. package/lib/tasks/updatedependencies.js +14 -14
  11. package/lib/tasks/updateversions.js +18 -18
  12. package/lib/tasks/verifypackagespublishedcorrectly.js +4 -4
  13. package/lib/utils/assertfilestopublish.js +6 -6
  14. package/lib/utils/assertnpmauthorization.js +1 -1
  15. package/lib/utils/assertnpmtag.js +4 -4
  16. package/lib/utils/assertpackages.js +4 -4
  17. package/lib/utils/checkversionavailability.js +2 -2
  18. package/lib/utils/configurereleaseoptions.js +1 -1
  19. package/lib/utils/confirmincludingpackage.js +1 -1
  20. package/lib/utils/confirmnpmtag.js +3 -3
  21. package/lib/utils/displaycommits.js +4 -4
  22. package/lib/utils/executeinparallel.js +20 -19
  23. package/lib/utils/generatechangelog.js +23 -23
  24. package/lib/utils/getchangedfilesforcommit.js +2 -2
  25. package/lib/utils/getchangelog.js +2 -2
  26. package/lib/utils/getchangesforversion.js +3 -3
  27. package/lib/utils/getcommits.js +7 -6
  28. package/lib/utils/getformatteddate.js +1 -1
  29. package/lib/utils/getnewversiontype.js +1 -1
  30. package/lib/utils/getnpmtagfromversion.js +2 -2
  31. package/lib/utils/getpackagejson.js +2 -2
  32. package/lib/utils/getpackagespaths.js +9 -9
  33. package/lib/utils/getwriteroptions.js +1 -1
  34. package/lib/utils/isversionpublishablefortag.js +4 -4
  35. package/lib/utils/parallelworker.js +2 -2
  36. package/lib/utils/providenewversionformonorepository.js +6 -6
  37. package/lib/utils/providetoken.js +1 -1
  38. package/lib/utils/provideversion.js +12 -12
  39. package/lib/utils/publishpackageonnpmcallback.js +3 -3
  40. package/lib/utils/savechangelog.js +2 -2
  41. package/lib/utils/transformcommitfactory.js +27 -27
  42. package/lib/utils/transformcommitutils.js +13 -13
  43. package/lib/utils/truncatechangelog.js +2 -2
  44. package/lib/utils/validaterepositorytorelease.js +6 -6
  45. package/lib/utils/versions.js +14 -14
  46. package/package.json +2 -2
@@ -17,16 +17,16 @@ import upath from 'upath';
17
17
  * The eligible dependencies are distinguished by the return value from the `options.shouldUpdateVersionCallback` function. Only if this
18
18
  * callback returns a truthy value for a given dependency, its version will be updated.
19
19
  *
20
- * @param {Object} options
21
- * @param {String} options.version Target version or a range version to which all eligible dependencies will be updated.
20
+ * @param {object} options
21
+ * @param {string} options.version Target version or a range version to which all eligible dependencies will be updated.
22
22
  * Examples: `1.0.0`, `^1.0.0`, etc.
23
23
  * @param {UpdateVersionCallback} options.shouldUpdateVersionCallback Callback function that decides whether to update a version
24
24
  * for a dependency. It receives a package name as an argument and should return a boolean value.
25
25
  * @param {UpdateDependenciesPackagesDirectoryFilter|null} [options.packagesDirectoryFilter=null] An optional callback allowing
26
26
  * filtering out directories/packages that should not be touched by the task.
27
- * @param {String} [options.packagesDirectory] Relative path to a location of packages to update their dependencies. If not specified,
27
+ * @param {string} [options.packagesDirectory] Relative path to a location of packages to update their dependencies. If not specified,
28
28
  * only the root package is checked.
29
- * @param {String} [options.cwd=process.cwd()] Current working directory from which all paths will be resolved.
29
+ * @param {string} [options.cwd=process.cwd()] Current working directory from which all paths will be resolved.
30
30
  * @returns {Promise}
31
31
  */
32
32
  export default async function updateDependencies( options ) {
@@ -62,9 +62,9 @@ export default async function updateDependencies( options ) {
62
62
  /**
63
63
  * Updates the version for each eligible dependency.
64
64
  *
65
- * @param {String} version
66
- * @param {Function} callback
67
- * @param {Object} [dependencies]
65
+ * @param {string} version
66
+ * @param {function} callback
67
+ * @param {object} [dependencies]
68
68
  */
69
69
  function updateVersion( version, callback, dependencies ) {
70
70
  if ( !dependencies ) {
@@ -79,10 +79,10 @@ function updateVersion( version, callback, dependencies ) {
79
79
  }
80
80
 
81
81
  /**
82
- * @param {String} cwd
83
- * @param {Array.<String>} globPatterns
82
+ * @param {string} cwd
83
+ * @param {Array.<string>} globPatterns
84
84
  * @param {UpdateDependenciesPackagesDirectoryFilter|null} packagesDirectoryFilter
85
- * @returns {Promise.<Array.<String>>}
85
+ * @returns {Promise.<Array.<string>>}
86
86
  */
87
87
  async function getPackageJsonPaths( cwd, globPatterns, packagesDirectoryFilter ) {
88
88
  const globOptions = {
@@ -103,15 +103,15 @@ async function getPackageJsonPaths( cwd, globPatterns, packagesDirectoryFilter )
103
103
  /**
104
104
  * @callback UpdateVersionCallback
105
105
  *
106
- * @param {String} packageName A package name.
106
+ * @param {string} packageName A package name.
107
107
  *
108
- * @returns {Boolean} Whether to update (`true`) or ignore (`false`) bumping the package version.
108
+ * @returns {boolean} Whether to update (`true`) or ignore (`false`) bumping the package version.
109
109
  */
110
110
 
111
111
  /**
112
112
  * @callback UpdateDependenciesPackagesDirectoryFilter
113
113
  *
114
- * @param {String} packageJsonPath An absolute path to a `package.json` file.
114
+ * @param {string} packageJsonPath An absolute path to a `package.json` file.
115
115
  *
116
- * @returns {Boolean} Whether to include (`true`) or skip (`false`) processing the given directory/package.
116
+ * @returns {boolean} Whether to include (`true`) or skip (`false`) processing the given directory/package.
117
117
  */
@@ -22,13 +22,13 @@ const { normalizeTrim, toUnix, dirname, join } = upath;
22
22
  * Exception: passing a version starting with the `0.0.0-nightly` string. It is used for publishing
23
23
  * a nightly release.
24
24
  *
25
- * @param {Object} options
26
- * @param {String} options.version Version to store in a `package.json` file under the `version` key.
25
+ * @param {object} options
26
+ * @param {string} options.version Version to store in a `package.json` file under the `version` key.
27
27
  * @param {UpdateVersionsPackagesDirectoryFilter|null} [options.packagesDirectoryFilter=null] An optional callback allowing filtering out
28
28
  * directories/packages that should not be touched by the task.
29
- * @param {String} [options.packagesDirectory] Relative path to a location of packages to update. If not specified,
29
+ * @param {string} [options.packagesDirectory] Relative path to a location of packages to update. If not specified,
30
30
  * only the root package is checked.
31
- * @param {String} [options.cwd=process.cwd()] Current working directory from which all paths will be resolved.
31
+ * @param {string} [options.cwd=process.cwd()] Current working directory from which all paths will be resolved.
32
32
  * @returns {Promise}
33
33
  */
34
34
  export default async function updateVersions( options ) {
@@ -66,10 +66,10 @@ export default async function updateVersions( options ) {
66
66
  }
67
67
 
68
68
  /**
69
- * @param {String} cwd
70
- * @param {Array.<String>} globPatterns
69
+ * @param {string} cwd
70
+ * @param {Array.<string>} globPatterns
71
71
  * @param {UpdateVersionsPackagesDirectoryFilter|null} packagesDirectoryFilter
72
- * @returns {Promise.<Array.<String>>}
72
+ * @returns {Promise.<Array.<string>>}
73
73
  */
74
74
  async function getPackageJsonPaths( cwd, globPatterns, packagesDirectoryFilter ) {
75
75
  const pkgJsonPaths = await glob( globPatterns, {
@@ -86,8 +86,8 @@ async function getPackageJsonPaths( cwd, globPatterns, packagesDirectoryFilter )
86
86
  }
87
87
 
88
88
  /**
89
- * @param {String} packagesDirectory
90
- * @returns {Promise.<Object>}
89
+ * @param {string} packagesDirectory
90
+ * @returns {Promise.<object>}
91
91
  */
92
92
  function readPackageJson( packagesDirectory ) {
93
93
  const packageJsonPath = join( packagesDirectory, 'package.json' );
@@ -96,8 +96,8 @@ function readPackageJson( packagesDirectory ) {
96
96
  }
97
97
 
98
98
  /**
99
- * @param {String|null} packagesDirectory
100
- * @returns {Array.<String>}
99
+ * @param {string|null} packagesDirectory
100
+ * @returns {Array.<string>}
101
101
  */
102
102
  function getGlobPatterns( packagesDirectory ) {
103
103
  const patterns = [ 'package.json' ];
@@ -110,9 +110,9 @@ function getGlobPatterns( packagesDirectory ) {
110
110
  }
111
111
 
112
112
  /**
113
- * @param {Array.<String>} pkgJsonPaths
114
- * @param {String|null} packagesDirectory
115
- * @returns {Object}
113
+ * @param {Array.<string>} pkgJsonPaths
114
+ * @param {string|null} packagesDirectory
115
+ * @returns {object}
116
116
  */
117
117
  function getRandomPackagePath( pkgJsonPaths, packagesDirectory ) {
118
118
  const randomPkgJsonPaths = packagesDirectory ?
@@ -128,8 +128,8 @@ function getRandomPackagePath( pkgJsonPaths, packagesDirectory ) {
128
128
  *
129
129
  * A nightly version is always considered as valid.
130
130
  *
131
- * @param {String} newVersion
132
- * @param {String} currentVersion
131
+ * @param {string} newVersion
132
+ * @param {string} currentVersion
133
133
  */
134
134
  function checkIfVersionIsValid( newVersion, currentVersion ) {
135
135
  if ( newVersion.startsWith( '0.0.0-nightly' ) ) {
@@ -144,7 +144,7 @@ function checkIfVersionIsValid( newVersion, currentVersion ) {
144
144
  /**
145
145
  * @callback UpdateVersionsPackagesDirectoryFilter
146
146
  *
147
- * @param {String} packageJsonPath An absolute path to a `package.json` file.
147
+ * @param {string} packageJsonPath An absolute path to a `package.json` file.
148
148
  *
149
- * @returns {Boolean} Whether to include (`true`) or skip (`false`) processing the given directory/package.
149
+ * @returns {boolean} Whether to include (`true`) or skip (`false`) processing the given directory/package.
150
150
  */
@@ -12,10 +12,10 @@ import checkVersionAvailability from '../utils/checkversionavailability.js';
12
12
  * Npm sometimes throws incorrect error 409 while publishing, while the package uploads correctly.
13
13
  * The purpose of the script is to validate if packages that threw 409 are uploaded correctly to npm.
14
14
  *
15
- * @param {Object} options
16
- * @param {String} options.packagesDirectory Relative path to a location of packages to release.
17
- * @param {String} options.version Version of the current release.
18
- * @param {Function} options.onSuccess Callback fired when function is successful.
15
+ * @param {object} options
16
+ * @param {string} options.packagesDirectory Relative path to a location of packages to release.
17
+ * @param {string} options.version Version of the current release.
18
+ * @param {function} options.onSuccess Callback fired when function is successful.
19
19
  * @returns {Promise}
20
20
  */
21
21
  export default async function verifyPackagesPublishedCorrectly( options ) {
@@ -10,8 +10,8 @@ import { glob } from 'glob';
10
10
  /**
11
11
  * Checks if all files expected to be released actually exist in the package directory. Verification takes place for all packages.
12
12
  *
13
- * @param {String} packagePaths
14
- * @param {Object.<String, Array.<String>>|null} optionalEntries
13
+ * @param {string} packagePaths
14
+ * @param {Object.<string, Array.<string>>|null} optionalEntries
15
15
  * @returns {Promise}
16
16
  */
17
17
  export default async function assertFilesToPublish( packagePaths, optionalEntries = null ) {
@@ -62,10 +62,10 @@ export default async function assertFilesToPublish( packagePaths, optionalEntrie
62
62
  /**
63
63
  * Filters out the optional entries from the `files` field and returns only the required ones.
64
64
  *
65
- * @param {Array.<String>} entries
66
- * @param {String} packageName
67
- * @param {Object.<String, Array.<String>>|null} optionalEntries
68
- * @returns {Array.<String>}
65
+ * @param {Array.<string>} entries
66
+ * @param {string} packageName
67
+ * @param {Object.<string, Array.<string>>|null} optionalEntries
68
+ * @returns {Array.<string>}
69
69
  */
70
70
  function getRequiredEntries( entries, packageName, optionalEntries ) {
71
71
  if ( !optionalEntries ) {
@@ -8,7 +8,7 @@ import { tools } from '@ckeditor/ckeditor5-dev-utils';
8
8
  /**
9
9
  * Checks whether a user is logged to npm as the provided account name.
10
10
  *
11
- * @param {String} npmOwner Expected npm account name that should be logged into npm.
11
+ * @param {string} npmOwner Expected npm account name that should be logged into npm.
12
12
  * @returns {Promise}
13
13
  */
14
14
  export default async function assertNpmAuthorization( npmOwner ) {
@@ -10,8 +10,8 @@ import semver from 'semver';
10
10
  /**
11
11
  * Checks if the npm tag matches the tag calculated from the package version. Verification takes place for all packages.
12
12
  *
13
- * @param {Array.<String>} packagePaths
14
- * @param {String} npmTag
13
+ * @param {Array.<string>} packagePaths
14
+ * @param {string} npmTag
15
15
  * @returns {Promise}
16
16
  */
17
17
  export default async function assertNpmTag( packagePaths, npmTag ) {
@@ -44,8 +44,8 @@ export default async function assertNpmTag( packagePaths, npmTag ) {
44
44
  * For the official release, returns the "latest" tag. For a non-official release (pre-release), returns the version tag extracted from
45
45
  * the package version.
46
46
  *
47
- * @param {String} version
48
- * @returns {String}
47
+ * @param {string} version
48
+ * @returns {string}
49
49
  */
50
50
  function getVersionTag( version ) {
51
51
  const [ versionTag ] = semver.prerelease( version ) || [ 'latest' ];
@@ -9,11 +9,11 @@ import upath from 'upath';
9
9
  /**
10
10
  * Checks if all packages in the provided directories contain the `package.json` file.
11
11
  *
12
- * @param {Array.<String>} packagePaths
13
- * @param {Object} options
14
- * @param {Boolean} options.requireEntryPoint Whether to verify if packages to publish define an entry point. In other words,
12
+ * @param {Array.<string>} packagePaths
13
+ * @param {object} options
14
+ * @param {boolean} options.requireEntryPoint Whether to verify if packages to publish define an entry point. In other words,
15
15
  * whether their `package.json` define the `main` field.
16
- * @param {Array.<String>} options.optionalEntryPointPackages If the entry point validator is enabled (`requireEntryPoint=true`),
16
+ * @param {Array.<string>} options.optionalEntryPointPackages If the entry point validator is enabled (`requireEntryPoint=true`),
17
17
  * this array contains a list of packages that will not be checked. In other words, they do not have to define the entry point.
18
18
  * @returns {Promise}
19
19
  */
@@ -12,8 +12,8 @@ import shellEscape from 'shell-escape';
12
12
  * Returns a promise that resolves to `true` if the provided version does not exist or resolves the promise to `false` otherwise.
13
13
  * If the `npm show` command exits with an error, it is re-thrown.
14
14
  *
15
- * @param {String} version
16
- * @param {String} packageName
15
+ * @param {string} version
16
+ * @param {string} packageName
17
17
  * @returns {Promise}
18
18
  */
19
19
  export default async function checkVersionAvailability( version, packageName ) {
@@ -11,7 +11,7 @@ import provideToken from './providetoken.js';
11
11
  *
12
12
  * If the user choices a GitHub, required token also has to be provided.
13
13
  *
14
- * @returns {Promise.<Object>}
14
+ * @returns {Promise.<object>}
15
15
  */
16
16
  export default async function configureReleaseOptions() {
17
17
  const options = {};
@@ -8,7 +8,7 @@ import inquirer from 'inquirer';
8
8
  /**
9
9
  * Asks a user for a confirmation for including a package that does not contain all required files.
10
10
  *
11
- * @returns {Promise.<Boolean>}
11
+ * @returns {Promise.<boolean>}
12
12
  */
13
13
  export default async function confirmIncludingPackage() {
14
14
  const confirmQuestion = {
@@ -9,9 +9,9 @@ import chalk from 'chalk';
9
9
  /**
10
10
  * Asks a user for a confirmation for updating and tagging versions of the packages.
11
11
  *
12
- * @param {String} versionTag A version tag based on a package version specified in `package.json`.
13
- * @param {String} npmTag A tag typed by the user when using the release tools.
14
- * @returns {Promise.<Boolean>}
12
+ * @param {string} versionTag A version tag based on a package version specified in `package.json`.
13
+ * @param {string} npmTag A tag typed by the user when using the release tools.
14
+ * @returns {Promise.<boolean>}
15
15
  */
16
16
  export default function confirmNpmTag( versionTag, npmTag ) {
17
17
  const areVersionsEqual = versionTag === npmTag;
@@ -10,9 +10,9 @@ import { CLI_COMMIT_INDENT_SIZE, CLI_INDENT_SIZE } from './constants.js';
10
10
 
11
11
  /**
12
12
  * @param {Array.<Commit>|Set.<Commit>} commits
13
- * @param {Object} [options={}]
14
- * @param {Boolean} [options.attachLinkToCommit=false] Whether to attach a link to parsed commit.
15
- * @param {Number} [options.indentLevel=1] The indent level.
13
+ * @param {object} [options={}]
14
+ * @param {boolean} [options.attachLinkToCommit=false] Whether to attach a link to parsed commit.
15
+ * @param {number} [options.indentLevel=1] The indent level.
16
16
  */
17
17
  export default function displayCommits( commits, options = {} ) {
18
18
  const log = logger();
@@ -28,7 +28,7 @@ export default function displayCommits( commits, options = {} ) {
28
28
  const COMMITS_SEPARATOR = listIndent + chalk.gray( '-'.repeat( 112 ) );
29
29
 
30
30
  // Group of commits by the commit's hash.
31
- /** @type {Map.<String, Set.<Commit>>} */
31
+ /** @type {Map.<string, Set.<Commit>>} */
32
32
  const commitGroups = new Map();
33
33
 
34
34
  for ( const singleCommit of commits ) {
@@ -23,17 +23,17 @@ const WORKER_SCRIPT = new URL( './parallelworker.js', import.meta.url );
23
23
  * Functions cannot be passed to workers. Hence, we store the callback as a Node.js file loaded by workers.
24
24
  *
25
25
  * @see https://nodejs.org/api/worker_threads.html
26
- * @param {Object} options
27
- * @param {String} options.packagesDirectory Relative path to a location of packages to execute a task.
28
- * @param {Function} options.taskToExecute A callback that is executed on all found packages.
26
+ * @param {object} options
27
+ * @param {string} options.packagesDirectory Relative path to a location of packages to execute a task.
28
+ * @param {function} options.taskToExecute A callback that is executed on all found packages.
29
29
  * It receives an absolute path to a package as an argument. It can be synchronous or may return a promise.
30
30
  * @param {ListrTaskObject} [options.listrTask={}] An instance of `ListrTask`.
31
31
  * @param {AbortSignal|null} [options.signal=null] Signal to abort the asynchronous process. If not set, default AbortController is created.
32
- * @param {Object} [options.taskOptions=null] Optional data required by the task.
32
+ * @param {object} [options.taskOptions=null] Optional data required by the task.
33
33
  * @param {ExecuteInParallelPackagesDirectoryFilter|null} [options.packagesDirectoryFilter=null] An optional callback allowing filtering out
34
34
  * directories/packages that should not be touched by the task.
35
- * @param {String} [options.cwd=process.cwd()] Current working directory from which all paths will be resolved.
36
- * @param {Number} [options.concurrency=require( 'os' ).cpus().length / 2] Number of CPUs that will execute the task.
35
+ * @param {string} [options.cwd=process.cwd()] Current working directory from which all paths will be resolved.
36
+ * @param {number} [options.concurrency=require( 'os' ).cpus().length / 2] Number of CPUs that will execute the task.
37
37
  * @returns {Promise}
38
38
  */
39
39
  export default async function executeInParallel( options ) {
@@ -48,6 +48,7 @@ export default async function executeInParallel( options ) {
48
48
  concurrency = os.cpus().length / 2
49
49
  } = options;
50
50
 
51
+ const concurrencyAsInteger = Math.floor( concurrency ) || 1;
51
52
  const normalizedCwd = upath.toUnix( cwd );
52
53
  const packages = ( await glob( `${ packagesDirectory }/*/`, {
53
54
  cwd: normalizedCwd,
@@ -58,7 +59,7 @@ export default async function executeInParallel( options ) {
58
59
  packages.filter( packagesDirectoryFilter ) :
59
60
  packages;
60
61
 
61
- const packagesInThreads = getPackagesGroupedByThreads( packagesToProcess, concurrency );
62
+ const packagesInThreads = getPackagesGroupedByThreads( packagesToProcess, concurrencyAsInteger );
62
63
 
63
64
  const callbackModule = upath.join( cwd, crypto.randomUUID() + '.mjs' );
64
65
  await fs.writeFile( callbackModule, `export default ${ taskToExecute };`, 'utf-8' );
@@ -99,7 +100,7 @@ export default async function executeInParallel( options ) {
99
100
 
100
101
  /**
101
102
  * @param {ListrTaskObject} listrTask
102
- * @param {Number} total
103
+ * @param {number} total
103
104
  * @returns {Function}
104
105
  */
105
106
  function progressFactory( listrTask, total ) {
@@ -112,10 +113,10 @@ function progressFactory( listrTask, total ) {
112
113
  }
113
114
 
114
115
  /**
115
- * @param {Object} options
116
+ * @param {object} options
116
117
  * @param {AbortSignal} options.signal
117
- * @param {Function} options.onPackageDone
118
- * @param {Object} options.workerData
118
+ * @param {function} options.onPackageDone
119
+ * @param {object} options.workerData
119
120
  * @returns {Promise}
120
121
  */
121
122
  function createWorker( { signal, onPackageDone, workerData } ) {
@@ -149,9 +150,9 @@ function createWorker( { signal, onPackageDone, workerData } ) {
149
150
  *
150
151
  * To avoid having packages with a common prefix in a single thread, use a loop for attaching packages to threads.
151
152
  *
152
- * @param {Array.<String>} packages An array of absolute paths to packages.
153
- * @param {Number} concurrency A number of threads.
154
- * @returns {Array.<Array.<String>>}
153
+ * @param {Array.<string>} packages An array of absolute paths to packages.
154
+ * @param {number} concurrency A number of threads.
155
+ * @returns {Array.<Array.<string>>}
155
156
  */
156
157
  function getPackagesGroupedByThreads( packages, concurrency ) {
157
158
  return packages.reduce( ( collection, packageItem, index ) => {
@@ -168,19 +169,19 @@ function getPackagesGroupedByThreads( packages, concurrency ) {
168
169
  }
169
170
 
170
171
  /**
171
- * @typedef {Object} ListrTaskObject
172
+ * @typedef {object} ListrTaskObject
172
173
  *
173
174
  * @see https://listr2.kilic.dev/api/classes/ListrTaskObject.html
174
175
  *
175
- * @property {String} title Title of the task.
176
+ * @property {string} title Title of the task.
176
177
  *
177
- * @property {String} output Update the current output of the task.
178
+ * @property {string} output Update the current output of the task.
178
179
  */
179
180
 
180
181
  /**
181
182
  * @callback ExecuteInParallelPackagesDirectoryFilter
182
183
  *
183
- * @param {String} directoryPath An absolute path to a directory.
184
+ * @param {string} directoryPath An absolute path to a directory.
184
185
  *
185
- * @returns {Boolean} Whether to include (`true`) or skip (`false`) processing the given directory.
186
+ * @returns {boolean} Whether to include (`true`) or skip (`false`) processing the given directory.
186
187
  */
@@ -14,27 +14,27 @@ const UPDATED_TRANSLATION_COMMIT = '* Updated translations.';
14
14
  *
15
15
  * @param {Array.<Commit>} commits
16
16
  *
17
- * @param {Object} context
18
- * @param {String} context.version Current version for the release.
19
- * @param {String} context.repoUrl The repository URL.
20
- * @param {String} context.currentTag A tag for the current version.
21
- * @param {String} context.commit Commit keyword in the URL.
22
- * @param {String} [context.previousTag] A tag for the previous version.
23
- * @param {Boolean} [context.skipCommitsLink=false] Whether to skip adding links to commit.
24
- * @param {Boolean} [context.skipCompareLink=false] Whether to remove the compare URL in the header.
17
+ * @param {object} context
18
+ * @param {string} context.version Current version for the release.
19
+ * @param {string} context.repoUrl The repository URL.
20
+ * @param {string} context.currentTag A tag for the current version.
21
+ * @param {string} context.commit Commit keyword in the URL.
22
+ * @param {string} [context.previousTag] A tag for the previous version.
23
+ * @param {boolean} [context.skipCommitsLink=false] Whether to skip adding links to commit.
24
+ * @param {boolean} [context.skipCompareLink=false] Whether to remove the compare URL in the header.
25
25
  *
26
- * @param {Object} options
27
- * @param {Object} options.transform
28
- * @param {Function} options.transform.hash A function for mapping the commit's hash.
29
- * @param {Array.<String>|String} options.groupBy A key for grouping the commits.
30
- * @param {Function} options.commitGroupsSort A sort function for the groups.
31
- * @param {Function} options.noteGroupsSort A soft function for the notes.
32
- * @param {String} options.mainTemplate The main template for the changelog.
33
- * @param {String} options.headerPartial The "header" partial used in the main template.
34
- * @param {String} options.commitPartial The "commit" partial used in the main template.
35
- * @param {String} options.footerPartial The "footer" partial used in the main template.
26
+ * @param {object} options
27
+ * @param {object} options.transform
28
+ * @param {function} options.transform.hash A function for mapping the commit's hash.
29
+ * @param {Array.<string>|string} options.groupBy A key for grouping the commits.
30
+ * @param {function} options.commitGroupsSort A sort function for the groups.
31
+ * @param {function} options.noteGroupsSort A soft function for the notes.
32
+ * @param {string} options.mainTemplate The main template for the changelog.
33
+ * @param {string} options.headerPartial The "header" partial used in the main template.
34
+ * @param {string} options.commitPartial The "commit" partial used in the main template.
35
+ * @param {string} options.footerPartial The "footer" partial used in the main template.
36
36
  *
37
- * @returns {Promise.<String>}
37
+ * @returns {Promise.<string>}
38
38
  */
39
39
  export default function generateChangelog( commits, context, options ) {
40
40
  const commitStream = new Readable( { objectMode: true } );
@@ -64,10 +64,10 @@ export default function generateChangelog( commits, context, options ) {
64
64
  /**
65
65
  * Merges multiple "Updated translations." entries into the single commit.
66
66
  *
67
- * @param {String} changelog Generated changelog.
68
- * @param {Object} [options={}]
69
- * @param {Boolean} [options.skipCommitsLink=false] Whether to skip adding links to commit.
70
- * @returns {String}
67
+ * @param {string} changelog Generated changelog.
68
+ * @param {object} [options={}]
69
+ * @param {boolean} [options.skipCommitsLink=false] Whether to skip adding links to commit.
70
+ * @returns {string}
71
71
  */
72
72
  function mergeUpdateTranslationsCommits( changelog, options = {} ) {
73
73
  let foundUpdatedTranslationCommit = false;
@@ -8,8 +8,8 @@ import { tools } from '@ckeditor/ckeditor5-dev-utils';
8
8
  /**
9
9
  * Returns an array with paths to changed files for given commit.
10
10
  *
11
- * @param {String} commitId
12
- * @returns {Array.<String>}
11
+ * @param {string} commitId
12
+ * @returns {Array.<string>}
13
13
  */
14
14
  export default function getChangedFilesForCommit( commitId ) {
15
15
  const gitCommand = `git log -m -1 --name-only --pretty="format:" ${ commitId }`;
@@ -8,8 +8,8 @@ import path from 'path';
8
8
  import { CHANGELOG_FILE } from './constants.js';
9
9
 
10
10
  /**
11
- * @param {String} [cwd=process.cwd()] Where to look for the changelog file.
12
- * @returns {String|null}
11
+ * @param {string} [cwd=process.cwd()] Where to look for the changelog file.
12
+ * @returns {string|null}
13
13
  */
14
14
  export default function getChangelog( cwd = process.cwd() ) {
15
15
  const changelogFile = path.join( cwd, CHANGELOG_FILE );
@@ -9,9 +9,9 @@ import getChangelog from './getchangelog.js';
9
9
  /**
10
10
  * Retrieves changes from the changelog for the given version (tag).
11
11
  *
12
- * @param {String} version
13
- * @param {String} [cwd=process.cwd()] Where to look for the changelog file.
14
- * @returns {String|null}
12
+ * @param {string} version
13
+ * @param {string} [cwd=process.cwd()] Where to look for the changelog file.
14
+ * @returns {string|null}
15
15
  */
16
16
  export default function getChangesForVersion( version, cwd = process.cwd() ) {
17
17
  version = version.replace( /^v/, '' );
@@ -9,15 +9,16 @@ import { getRawCommitsStream } from 'git-raw-commits';
9
9
  import concat from 'concat-stream';
10
10
  import parserOptions from './parseroptions.js';
11
11
  import { tools } from '@ckeditor/ckeditor5-dev-utils';
12
+ import shellEscape from 'shell-escape';
12
13
 
13
14
  /**
14
15
  * Returns a promise that resolves an array of commits since the last tag specified as `options.from`.
15
16
  *
16
- * @param {Function} transformCommit
17
- * @param {Object} options
18
- * @param {String} [options.from] A commit or tag name that will be the first param of the range of commits to collect.
19
- * @param {String} [options.releaseBranch='master'] A name of the branch that should be used for releasing packages.
20
- * @param {String} [options.mainBranch='master'] A name of the main branch in the repository.
17
+ * @param {function} transformCommit
18
+ * @param {object} options
19
+ * @param {string} [options.from] A commit or tag name that will be the first param of the range of commits to collect.
20
+ * @param {string} [options.releaseBranch='master'] A name of the branch that should be used for releasing packages.
21
+ * @param {string} [options.mainBranch='master'] A name of the main branch in the repository.
21
22
  * @returns {Promise.<Array.<Commit>>}
22
23
  */
23
24
  export default function getCommits( transformCommit, options = {} ) {
@@ -39,7 +40,7 @@ export default function getCommits( transformCommit, options = {} ) {
39
40
  } else {
40
41
  // Otherwise, (release branch is other than the main branch) we need to merge arrays of commits.
41
42
  // See: https://github.com/ckeditor/ckeditor5/issues/7492.
42
- const baseCommit = exec( `git merge-base ${ releaseBranch } ${ mainBranch }` ).trim();
43
+ const baseCommit = exec( `git merge-base ${ shellEscape( [ releaseBranch, mainBranch ] ) }` ).trim();
43
44
 
44
45
  const commitPromises = [
45
46
  // 1. Commits from the last release and to the point where the release branch was created (the merge-base commit).
@@ -6,7 +6,7 @@
6
6
  import { format } from 'date-fns';
7
7
 
8
8
  /**
9
- * @returns {String}
9
+ * @returns {string}
10
10
  */
11
11
  export default function getFormattedDate() {
12
12
  return format( new Date(), 'yyyy-MM-dd' );
@@ -7,7 +7,7 @@
7
7
  * Proposes new version based on commits.
8
8
  *
9
9
  * @param {Array.<Commit>} commits
10
- * @returns {String|null}
10
+ * @returns {string|null}
11
11
  */
12
12
  export default function getNewVersionType( commits ) {
13
13
  // No commits = no changes.
@@ -6,8 +6,8 @@
6
6
  import semver from 'semver';
7
7
 
8
8
  /**
9
- * @param {String} version
10
- * @returns {String}
9
+ * @param {string} version
10
+ * @returns {string}
11
11
  */
12
12
  export default function getNpmTagFromVersion( version ) {
13
13
  const [ versionTag ] = semver.prerelease( version ) || [ 'latest' ];
@@ -12,8 +12,8 @@ import upath from 'upath';
12
12
  * This function is helpful for testing the whole process. Allows mocking the file
13
13
  * instead of create the fixtures.
14
14
  *
15
- * @param {String} [cwd=process.cwd()] Where to look for package.json.
16
- * @returns {Object}
15
+ * @param {string} [cwd=process.cwd()] Where to look for package.json.
16
+ * @returns {object}
17
17
  */
18
18
  export default function getPackageJson( cwd = process.cwd() ) {
19
19
  let pkgJsonPath = cwd;
@@ -17,13 +17,13 @@ import getPackageJson from './getpackagejson.js';
17
17
  * - The second one is marked as `skipped` and means that packages should not be processed. They were listed as packages to skip
18
18
  * (`options.skipPackages` or don't mach to `options.scope`).
19
19
  *
20
- * @param {Object} options
21
- * @param {String} options.cwd Current work directory.
22
- * @param {String|null} options.packages Name of directory where to look for packages. If `null`, only repository specified under
20
+ * @param {object} options
21
+ * @param {string} options.cwd Current work directory.
22
+ * @param {string|null} options.packages Name of directory where to look for packages. If `null`, only repository specified under
23
23
  * `options.cwd` will be returned.
24
- * @param {String|Array.<String>} options.skipPackages Glob pattern(s) which describes which packages should be skipped.
25
- * @param {String} [options.scope] Package names have to match to specified glob pattern.
26
- * @param {Boolean} [options.skipMainRepository=false] If set on true, package found in `options.cwd` will be skipped.
24
+ * @param {string|Array.<string>} options.skipPackages Glob pattern(s) which describes which packages should be skipped.
25
+ * @param {string} [options.scope] Package names have to match to specified glob pattern.
26
+ * @param {boolean} [options.skipMainRepository=false] If set on true, package found in `options.cwd` will be skipped.
27
27
  * @returns {PathsCollection}
28
28
  */
29
29
  export default function getPackagesPaths( options ) {
@@ -80,9 +80,9 @@ export default function getPackagesPaths( options ) {
80
80
  }
81
81
 
82
82
  /**
83
- * @typedef {Object} PathsCollection
83
+ * @typedef {object} PathsCollection
84
84
  *
85
- * @property {Set.<String>} matched Packages that match given criteria.
85
+ * @property {Set.<string>} matched Packages that match given criteria.
86
86
  *
87
- * @property {Set.<String>} skipped Packages that do not match given criteria.
87
+ * @property {Set.<string>} skipped Packages that do not match given criteria.
88
88
  */
@@ -15,7 +15,7 @@ const templatePath = path.join( __dirname, '..', 'templates' );
15
15
 
16
16
  /**
17
17
  * @param {WriterOptionsTransformCallback} transform
18
- * @returns {Object}
18
+ * @returns {object}
19
19
  */
20
20
  export default function getWriterOptions( transform ) {
21
21
  return {