@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.
- package/lib/tasks/cleanuppackages.js +22 -22
- package/lib/tasks/commitandtag.js +4 -4
- package/lib/tasks/creategithubrelease.js +11 -11
- package/lib/tasks/generatechangelogformonorepository.js +54 -54
- package/lib/tasks/generatechangelogforsinglepackage.js +11 -11
- package/lib/tasks/preparerepository.js +19 -19
- package/lib/tasks/publishpackages.js +10 -10
- package/lib/tasks/push.js +4 -4
- package/lib/tasks/reassignnpmtags.js +8 -8
- package/lib/tasks/updatedependencies.js +14 -14
- package/lib/tasks/updateversions.js +18 -18
- package/lib/tasks/verifypackagespublishedcorrectly.js +4 -4
- package/lib/utils/assertfilestopublish.js +6 -6
- package/lib/utils/assertnpmauthorization.js +1 -1
- package/lib/utils/assertnpmtag.js +4 -4
- package/lib/utils/assertpackages.js +4 -4
- package/lib/utils/checkversionavailability.js +2 -2
- package/lib/utils/configurereleaseoptions.js +1 -1
- package/lib/utils/confirmincludingpackage.js +1 -1
- package/lib/utils/confirmnpmtag.js +3 -3
- package/lib/utils/displaycommits.js +4 -4
- package/lib/utils/executeinparallel.js +20 -19
- package/lib/utils/generatechangelog.js +23 -23
- package/lib/utils/getchangedfilesforcommit.js +2 -2
- package/lib/utils/getchangelog.js +2 -2
- package/lib/utils/getchangesforversion.js +3 -3
- package/lib/utils/getcommits.js +7 -6
- package/lib/utils/getformatteddate.js +1 -1
- package/lib/utils/getnewversiontype.js +1 -1
- package/lib/utils/getnpmtagfromversion.js +2 -2
- package/lib/utils/getpackagejson.js +2 -2
- package/lib/utils/getpackagespaths.js +9 -9
- package/lib/utils/getwriteroptions.js +1 -1
- package/lib/utils/isversionpublishablefortag.js +4 -4
- package/lib/utils/parallelworker.js +2 -2
- package/lib/utils/providenewversionformonorepository.js +6 -6
- package/lib/utils/providetoken.js +1 -1
- package/lib/utils/provideversion.js +12 -12
- package/lib/utils/publishpackageonnpmcallback.js +3 -3
- package/lib/utils/savechangelog.js +2 -2
- package/lib/utils/transformcommitfactory.js +27 -27
- package/lib/utils/transformcommitutils.js +13 -13
- package/lib/utils/truncatechangelog.js +2 -2
- package/lib/utils/validaterepositorytorelease.js +6 -6
- package/lib/utils/versions.js +14 -14
- package/package.json +2 -2
|
@@ -19,12 +19,12 @@ import { glob } from 'glob';
|
|
|
19
19
|
* - file pointed by the `types` field from `package.json`
|
|
20
20
|
* - Removes unnecessary fields from the `package.json` file.
|
|
21
21
|
*
|
|
22
|
-
* @param {
|
|
23
|
-
* @param {
|
|
24
|
-
* @param {Array.<
|
|
22
|
+
* @param {object} options
|
|
23
|
+
* @param {string} options.packagesDirectory Relative path to a location of packages to be cleaned up.
|
|
24
|
+
* @param {Array.<string>|PackageJsonFieldsToRemoveCallback} [options.packageJsonFieldsToRemove] Fields to remove from `package.json`.
|
|
25
25
|
* If not set, a predefined list is used. If the callback is used, the first argument is the list with defaults.
|
|
26
|
-
* @param {
|
|
27
|
-
* @param {
|
|
26
|
+
* @param {boolean} [options.preservePostInstallHook] Whether to preserve the postinstall hook in `package.json`.
|
|
27
|
+
* @param {string} [options.cwd] Current working directory from which all paths will be resolved.
|
|
28
28
|
* @returns {Promise}
|
|
29
29
|
*/
|
|
30
30
|
export default async function cleanUpPackages( options ) {
|
|
@@ -50,12 +50,12 @@ export default async function cleanUpPackages( options ) {
|
|
|
50
50
|
/**
|
|
51
51
|
* Prepares the configuration options for the script.
|
|
52
52
|
*
|
|
53
|
-
* @param {
|
|
54
|
-
* @param {
|
|
55
|
-
* @param {Array.<
|
|
56
|
-
* @param {
|
|
57
|
-
* @param {
|
|
58
|
-
* @returns {
|
|
53
|
+
* @param {object} options
|
|
54
|
+
* @param {string} options.packagesDirectory
|
|
55
|
+
* @param {Array.<string>|PackageJsonFieldsToRemoveCallback} [options.packageJsonFieldsToRemove=DefaultFieldsToRemove]
|
|
56
|
+
* @param {boolean} [options.preservePostInstallHook]
|
|
57
|
+
* @param {string} [options.cwd=process.cwd()]
|
|
58
|
+
* @returns {object}
|
|
59
59
|
*/
|
|
60
60
|
function parseOptions( options ) {
|
|
61
61
|
const defaultPackageJsonFieldsToRemove = [ 'devDependencies', 'depcheckIgnore', 'scripts', 'private' ];
|
|
@@ -79,8 +79,8 @@ function parseOptions( options ) {
|
|
|
79
79
|
/**
|
|
80
80
|
* Removes unnecessary files and directories from the package directory.
|
|
81
81
|
*
|
|
82
|
-
* @param {
|
|
83
|
-
* @param {
|
|
82
|
+
* @param {object} packageJson
|
|
83
|
+
* @param {string} packagePath
|
|
84
84
|
* @returns {Promise}
|
|
85
85
|
*/
|
|
86
86
|
async function cleanUpPackageDirectory( packageJson, packagePath ) {
|
|
@@ -129,8 +129,8 @@ async function cleanUpPackageDirectory( packageJson, packagePath ) {
|
|
|
129
129
|
/**
|
|
130
130
|
* Creates an array of patterns to ignore for the `glob` calls.
|
|
131
131
|
*
|
|
132
|
-
* @param {
|
|
133
|
-
* @returns {Array.<
|
|
132
|
+
* @param {object} packageJson
|
|
133
|
+
* @returns {Array.<string>}
|
|
134
134
|
*/
|
|
135
135
|
function getIgnoredFilePatterns( packageJson ) {
|
|
136
136
|
// The patterns supported by `package.json` in the `files` field do not correspond 1:1 to the patterns expected by the `glob`.
|
|
@@ -155,9 +155,9 @@ function getIgnoredFilePatterns( packageJson ) {
|
|
|
155
155
|
/**
|
|
156
156
|
* Removes unnecessary fields from the `package.json`.
|
|
157
157
|
*
|
|
158
|
-
* @param {
|
|
159
|
-
* @param {Array.<
|
|
160
|
-
* @param {
|
|
158
|
+
* @param {object} packageJson
|
|
159
|
+
* @param {Array.<string>} packageJsonFieldsToRemove
|
|
160
|
+
* @param {boolean} preservePostInstallHook
|
|
161
161
|
*/
|
|
162
162
|
function cleanUpPackageJson( packageJson, packageJsonFieldsToRemove, preservePostInstallHook ) {
|
|
163
163
|
for ( const key of Object.keys( packageJson ) ) {
|
|
@@ -176,9 +176,9 @@ function cleanUpPackageJson( packageJson, packageJsonFieldsToRemove, preservePos
|
|
|
176
176
|
/**
|
|
177
177
|
* Sort function that defines the order of the paths. It sorts paths from the most nested ones first.
|
|
178
178
|
*
|
|
179
|
-
* @param {
|
|
180
|
-
* @param {
|
|
181
|
-
* @returns {
|
|
179
|
+
* @param {string} firstPath
|
|
180
|
+
* @param {string} secondPath
|
|
181
|
+
* @returns {number}
|
|
182
182
|
*/
|
|
183
183
|
function sortPathsFromDeepestFirst( firstPath, secondPath ) {
|
|
184
184
|
const firstPathSegments = firstPath.split( '/' ).length;
|
|
@@ -194,5 +194,5 @@ function sortPathsFromDeepestFirst( firstPath, secondPath ) {
|
|
|
194
194
|
/**
|
|
195
195
|
* @callback PackageJsonFieldsToRemoveCallback
|
|
196
196
|
* @param {DefaultFieldsToRemove} defaults
|
|
197
|
-
* @returns {Array.<
|
|
197
|
+
* @returns {Array.<string>}
|
|
198
198
|
*/
|
|
@@ -13,10 +13,10 @@ const { toUnix } = upath;
|
|
|
13
13
|
/**
|
|
14
14
|
* Creates a commit and a tag for specified version.
|
|
15
15
|
*
|
|
16
|
-
* @param {
|
|
17
|
-
* @param {
|
|
18
|
-
* @param {Array.<
|
|
19
|
-
* @param {
|
|
16
|
+
* @param {object} options
|
|
17
|
+
* @param {string} options.version The commit will contain this param in its message and the tag will have a `v` prefix.
|
|
18
|
+
* @param {Array.<string>} options.files Array of glob patterns for files to be added to the release commit.
|
|
19
|
+
* @param {string} [options.cwd=process.cwd()] Current working directory from which all paths will be resolved.
|
|
20
20
|
* @returns {Promise}
|
|
21
21
|
*/
|
|
22
22
|
export default async function commitAndTag( { version, files, cwd = process.cwd() } ) {
|
|
@@ -12,12 +12,12 @@ const { getRepositoryUrl } = transformCommitUtils;
|
|
|
12
12
|
/**
|
|
13
13
|
* Create a GitHub release.
|
|
14
14
|
*
|
|
15
|
-
* @param {
|
|
16
|
-
* @param {
|
|
17
|
-
* @param {
|
|
18
|
-
* @param {
|
|
19
|
-
* @param {
|
|
20
|
-
* @returns {Promise.<
|
|
15
|
+
* @param {object} options
|
|
16
|
+
* @param {string} options.token Token used to authenticate with GitHub.
|
|
17
|
+
* @param {string} options.version Name of tag connected with the release.
|
|
18
|
+
* @param {string} options.description Description of the release.
|
|
19
|
+
* @param {string} [options.cwd=process.cwd()] Current working directory from which all paths will be resolved.
|
|
20
|
+
* @returns {Promise.<string>}
|
|
21
21
|
*/
|
|
22
22
|
export default async function createGithubRelease( options ) {
|
|
23
23
|
const {
|
|
@@ -51,8 +51,8 @@ export default async function createGithubRelease( options ) {
|
|
|
51
51
|
/**
|
|
52
52
|
* Returns an npm tag based on the specified release version.
|
|
53
53
|
*
|
|
54
|
-
* @param {
|
|
55
|
-
* @returns {
|
|
54
|
+
* @param {string} version
|
|
55
|
+
* @returns {string}
|
|
56
56
|
*/
|
|
57
57
|
function getVersionTag( version ) {
|
|
58
58
|
const [ versionTag ] = semver.prerelease( version ) || [ 'latest' ];
|
|
@@ -64,9 +64,9 @@ function getVersionTag( version ) {
|
|
|
64
64
|
* Resolves a promise containing a flag if the GitHub contains the release page for given version.
|
|
65
65
|
*
|
|
66
66
|
* @param {Octokit} github
|
|
67
|
-
* @param {
|
|
68
|
-
* @param {
|
|
69
|
-
* @param {
|
|
67
|
+
* @param {string} repositoryOwner
|
|
68
|
+
* @param {string} repositoryName
|
|
69
|
+
* @param {string} version
|
|
70
70
|
* @returns {Promise.<boolean>}
|
|
71
71
|
*/
|
|
72
72
|
async function shouldCreateRelease( github, repositoryOwner, repositoryName, version ) {
|
|
@@ -35,37 +35,37 @@ const noteInfo = `[ℹ️](${ VERSIONING_POLICY_URL }#major-and-minor-breaking-c
|
|
|
35
35
|
*
|
|
36
36
|
* The typed version will be the same for all packages. See: https://github.com/ckeditor/ckeditor5/issues/7323.
|
|
37
37
|
*
|
|
38
|
-
* @param {
|
|
38
|
+
* @param {object} options
|
|
39
39
|
*
|
|
40
|
-
* @param {
|
|
40
|
+
* @param {string} options.cwd Current working directory (packages) from which all paths will be resolved.
|
|
41
41
|
*
|
|
42
|
-
* @param {
|
|
42
|
+
* @param {string} options.packages Where to look for packages.
|
|
43
43
|
*
|
|
44
|
-
* @param {
|
|
44
|
+
* @param {function} options.transformScope A function that returns a URL to a package from a scope of a commit.
|
|
45
45
|
*
|
|
46
|
-
* @param {
|
|
46
|
+
* @param {string} [options.scope] Package names have to match to specified glob pattern in order to be processed.
|
|
47
47
|
*
|
|
48
|
-
* @param {Array.<
|
|
48
|
+
* @param {Array.<string>} [options.skipPackages=[]] Name of packages which won't be touched.
|
|
49
49
|
*
|
|
50
|
-
* @param {
|
|
50
|
+
* @param {boolean} [options.skipLinks=false] If set on true, links to release or commits will be omitted.
|
|
51
51
|
*
|
|
52
|
-
* @param {
|
|
52
|
+
* @param {string} [options.from] A commit or tag name that will be the first param of the range of commits to collect.
|
|
53
53
|
*
|
|
54
|
-
* @param {
|
|
54
|
+
* @param {string} [options.releaseBranch='master'] A name of the branch that should be used for releasing packages.
|
|
55
55
|
*
|
|
56
|
-
* @param {
|
|
56
|
+
* @param {string} [options.mainBranch='master'] A name of the main branch in the repository.
|
|
57
57
|
*
|
|
58
58
|
* @param {Array.<ExternalRepository>} [options.externalRepositories=[]] An array of object with additional repositories
|
|
59
59
|
* that the function takes into consideration while gathering commits. It assumes that those directories are also mono repositories.
|
|
60
60
|
*
|
|
61
|
-
* @param {
|
|
61
|
+
* @param {boolean} [options.skipFileSave=false] Whether to resolve the changes instead of saving it to a file.
|
|
62
62
|
*
|
|
63
|
-
* @param {
|
|
63
|
+
* @param {string|null} [options.nextVersion=null] Next version to use. If not provided, a user needs to provide via CLI.
|
|
64
64
|
*
|
|
65
65
|
* @param {FormatDateCallback} [options.formatDate] A callback allowing defining a custom format of the date inserted into the changelog.
|
|
66
66
|
* If not specified, the default date matches the `YYYY-MM-DD` pattern.
|
|
67
67
|
*
|
|
68
|
-
* @returns {Promise.<undefined|
|
|
68
|
+
* @returns {Promise.<undefined|string>}
|
|
69
69
|
*/
|
|
70
70
|
export default async function generateChangelogForMonoRepository( options ) {
|
|
71
71
|
const log = logger();
|
|
@@ -161,11 +161,11 @@ export default async function generateChangelogForMonoRepository( options ) {
|
|
|
161
161
|
/**
|
|
162
162
|
* Returns collections with packages found in the `options.cwd` directory and the external repositories.
|
|
163
163
|
*
|
|
164
|
-
* @param {
|
|
165
|
-
* @param {
|
|
166
|
-
* @param {
|
|
167
|
-
* @param {
|
|
168
|
-
* @param {Array.<
|
|
164
|
+
* @param {object} options
|
|
165
|
+
* @param {string} options.cwd Current working directory (packages) from which all paths will be resolved.
|
|
166
|
+
* @param {string} options.packages Where to look for packages.
|
|
167
|
+
* @param {string} options.scope Package names have to match to specified glob pattern in order to be processed.
|
|
168
|
+
* @param {Array.<string>} options.skipPackages Name of packages which won't be touched.
|
|
169
169
|
* @param {Array.<ExternalRepository>} options.externalRepositories An array of object with additional repositories
|
|
170
170
|
* that the function takes into consideration while gathering packages.
|
|
171
171
|
* @returns {PathsCollection}
|
|
@@ -210,10 +210,10 @@ export default async function generateChangelogForMonoRepository( options ) {
|
|
|
210
210
|
/**
|
|
211
211
|
* Returns a promise that resolves an array of commits since the last tag specified as `options.from`.
|
|
212
212
|
*
|
|
213
|
-
* @param {
|
|
214
|
-
* @param {
|
|
215
|
-
* @param {
|
|
216
|
-
* @param {
|
|
213
|
+
* @param {object} options
|
|
214
|
+
* @param {string} options.cwd Current working directory (packages) from which all paths will be resolved.
|
|
215
|
+
* @param {string} options.from A commit or tag name that will be the first param of the range of commits to collect.
|
|
216
|
+
* @param {string} options.releaseBranch A name of the branch that should be used for releasing packages.
|
|
217
217
|
* @param {Array.<ExternalRepository>} options.externalRepositories An array of object with additional repositories
|
|
218
218
|
* that the function takes into consideration while gathering commits.
|
|
219
219
|
* @returns {Promise.<Array.<Commit>>}
|
|
@@ -378,7 +378,7 @@ export default async function generateChangelogForMonoRepository( options ) {
|
|
|
378
378
|
* Finds commits that touched the package under `packagePath` directory.
|
|
379
379
|
*
|
|
380
380
|
* @param {Array.<Commit>} commits
|
|
381
|
-
* @param {
|
|
381
|
+
* @param {string} packagePath
|
|
382
382
|
* @returns {Array.<Commit>}
|
|
383
383
|
*/
|
|
384
384
|
function filterCommitsByPath( commits, packagePath ) {
|
|
@@ -400,7 +400,7 @@ export default async function generateChangelogForMonoRepository( options ) {
|
|
|
400
400
|
/**
|
|
401
401
|
* Generates a list of changes based on the commits in the main repository.
|
|
402
402
|
*
|
|
403
|
-
* @returns {Promise.<
|
|
403
|
+
* @returns {Promise.<string>}
|
|
404
404
|
*/
|
|
405
405
|
function generateChangelogFromCommits() {
|
|
406
406
|
logProcess( 'Generating the changelog...' );
|
|
@@ -516,7 +516,7 @@ export default async function generateChangelogForMonoRepository( options ) {
|
|
|
516
516
|
/**
|
|
517
517
|
* Prepares a summary that describes what has changed in all dependencies.
|
|
518
518
|
*
|
|
519
|
-
* @returns {
|
|
519
|
+
* @returns {string}
|
|
520
520
|
*/
|
|
521
521
|
function generateSummaryOfChangesInPackages() {
|
|
522
522
|
const dependencies = new Map();
|
|
@@ -597,8 +597,8 @@ export default async function generateChangelogForMonoRepository( options ) {
|
|
|
597
597
|
}
|
|
598
598
|
|
|
599
599
|
/**
|
|
600
|
-
* @param {Map.<
|
|
601
|
-
* @returns {Map.<
|
|
600
|
+
* @param {Map.<string, Version>} dependencies
|
|
601
|
+
* @returns {Map.<string, Version>}
|
|
602
602
|
*/
|
|
603
603
|
function getNewPackages( dependencies ) {
|
|
604
604
|
const packages = new Map();
|
|
@@ -616,9 +616,9 @@ export default async function generateChangelogForMonoRepository( options ) {
|
|
|
616
616
|
/**
|
|
617
617
|
* Returns packages where scope of changes described in the commits' notes match to packages' names.
|
|
618
618
|
*
|
|
619
|
-
* @param {Map.<
|
|
620
|
-
* @param {
|
|
621
|
-
* @returns {Map.<
|
|
619
|
+
* @param {Map.<string, Version>} dependencies
|
|
620
|
+
* @param {string} noteTitle
|
|
621
|
+
* @returns {Map.<string, Version>}
|
|
622
622
|
*/
|
|
623
623
|
function getPackagesMatchedToScopesFromNotes( dependencies, noteTitle ) {
|
|
624
624
|
const packages = new Map();
|
|
@@ -649,8 +649,8 @@ export default async function generateChangelogForMonoRepository( options ) {
|
|
|
649
649
|
/**
|
|
650
650
|
* Returns packages that contain new features.
|
|
651
651
|
*
|
|
652
|
-
* @param {Map.<
|
|
653
|
-
* @returns {Map.<
|
|
652
|
+
* @param {Map.<string, Version>} dependencies
|
|
653
|
+
* @returns {Map.<string, Version>}
|
|
654
654
|
*/
|
|
655
655
|
function getPackagesWithNewFeatures( dependencies ) {
|
|
656
656
|
const packages = new Map();
|
|
@@ -672,10 +672,10 @@ export default async function generateChangelogForMonoRepository( options ) {
|
|
|
672
672
|
/**
|
|
673
673
|
* Returns a formatted entry (string) for the changelog.
|
|
674
674
|
*
|
|
675
|
-
* @param {
|
|
676
|
-
* @param {
|
|
677
|
-
* @param {
|
|
678
|
-
* @returns {
|
|
675
|
+
* @param {string} packageName
|
|
676
|
+
* @param {string} nextVersion
|
|
677
|
+
* @param {string} currentVersion
|
|
678
|
+
* @returns {string}
|
|
679
679
|
*/
|
|
680
680
|
function formatChangelogEntry( packageName, nextVersion, currentVersion = null ) {
|
|
681
681
|
const npmUrl = `https://www.npmjs.com/package/${ packageName }/v/${ nextVersion }`;
|
|
@@ -690,7 +690,7 @@ export default async function generateChangelogForMonoRepository( options ) {
|
|
|
690
690
|
/**
|
|
691
691
|
* Returns a function that is being used when sorting commits.
|
|
692
692
|
*
|
|
693
|
-
* @param {
|
|
693
|
+
* @param {string} scopeField A name of the field that saves the commit's scope.
|
|
694
694
|
* @returns {Function}
|
|
695
695
|
*/
|
|
696
696
|
function sortFunctionFactory( scopeField ) {
|
|
@@ -714,11 +714,11 @@ export default async function generateChangelogForMonoRepository( options ) {
|
|
|
714
714
|
}
|
|
715
715
|
|
|
716
716
|
/**
|
|
717
|
-
* @param {
|
|
718
|
-
* @param {
|
|
719
|
-
* @param {
|
|
720
|
-
* @param {
|
|
721
|
-
* @param {
|
|
717
|
+
* @param {string} message
|
|
718
|
+
* @param {object} [options={}]
|
|
719
|
+
* @param {number} [options.indentLevel=0]
|
|
720
|
+
* @param {boolean} [options.startWithNewLine=false] Whether to append a new line before the message.
|
|
721
|
+
* @param {boolean} [options.isWarning=false] Whether to use `warning` method instead of `log`.
|
|
722
722
|
*/
|
|
723
723
|
function logInfo( message, options = {} ) {
|
|
724
724
|
const indentLevel = options.indentLevel || 0;
|
|
@@ -730,30 +730,30 @@ export default async function generateChangelogForMonoRepository( options ) {
|
|
|
730
730
|
}
|
|
731
731
|
|
|
732
732
|
/**
|
|
733
|
-
* @typedef {
|
|
733
|
+
* @typedef {object} Version
|
|
734
734
|
*
|
|
735
|
-
* @param {
|
|
735
|
+
* @param {boolean} current The current version defined in the `package.json` file.
|
|
736
736
|
*
|
|
737
|
-
* @param {
|
|
737
|
+
* @param {boolean} next The next version defined during generating the changelog file.
|
|
738
738
|
*/
|
|
739
739
|
|
|
740
740
|
/**
|
|
741
|
-
* @typedef {
|
|
741
|
+
* @typedef {object} ExternalRepository
|
|
742
742
|
*
|
|
743
|
-
* @param {
|
|
743
|
+
* @param {string} cwd An absolute path to the repository.
|
|
744
744
|
*
|
|
745
|
-
* @param {
|
|
745
|
+
* @param {string} packages Subdirectory in a given `cwd` that should searched for packages. E.g. `'packages'`.
|
|
746
746
|
*
|
|
747
|
-
* @param {
|
|
747
|
+
* @param {string} [scope] Glob pattern for package names to be processed.
|
|
748
748
|
*
|
|
749
|
-
* @param {Array.<
|
|
749
|
+
* @param {Array.<string>} [skipPackages] Name of packages which won't be touched.
|
|
750
750
|
*
|
|
751
|
-
* @param {
|
|
751
|
+
* @param {boolean} [skipLinks] If set on `true`, a URL to commit (hash) will be omitted.
|
|
752
752
|
*
|
|
753
|
-
* @param {
|
|
753
|
+
* @param {string} [from] A commit or tag name that will be the first param of the range of commits to collect. If not specified,
|
|
754
754
|
* the option will inherit its value from the function's `options` object.
|
|
755
755
|
*
|
|
756
|
-
* @param {
|
|
756
|
+
* @param {string} [releaseBranch] A name of the branch that should be used for releasing packages. If not specified, the branch
|
|
757
757
|
* used for the main repository will be used.
|
|
758
758
|
*/
|
|
759
759
|
|
|
@@ -762,5 +762,5 @@ export default async function generateChangelogForMonoRepository( options ) {
|
|
|
762
762
|
*
|
|
763
763
|
* @param {Date} now The current date.
|
|
764
764
|
*
|
|
765
|
-
* @returns {
|
|
765
|
+
* @returns {string} The formatted date inserted into the changelog.
|
|
766
766
|
*/
|
|
@@ -28,15 +28,15 @@ const SKIP_GENERATE_CHANGELOG = 'Typed "skip" as a new version. Aborting.';
|
|
|
28
28
|
*
|
|
29
29
|
* If the package does not have any commit, the user has to confirm whether the changelog should be generated.
|
|
30
30
|
*
|
|
31
|
-
* @param {
|
|
31
|
+
* @param {object} [options={}] Additional options.
|
|
32
32
|
*
|
|
33
|
-
* @param {
|
|
33
|
+
* @param {boolean} [options.skipLinks=false] If set on true, links to release or commits will be omitted.
|
|
34
34
|
*
|
|
35
|
-
* @param {
|
|
35
|
+
* @param {string} [options.from] A commit or tag name that will be the first param of the range of commits to collect.
|
|
36
36
|
*
|
|
37
|
-
* @param {
|
|
37
|
+
* @param {string} [options.releaseBranch='master'] A name of the branch that should be used for releasing packages.
|
|
38
38
|
*
|
|
39
|
-
* @param {
|
|
39
|
+
* @param {string} [options.mainBranch='master'] A name of the main branch in the repository.
|
|
40
40
|
*
|
|
41
41
|
* @param {FormatDateCallback} [options.formatDate] A callback allowing defining a custom format of the date inserted into the changelog.
|
|
42
42
|
* If not specified, the default date matches the `YYYY-MM-DD` pattern.
|
|
@@ -186,11 +186,11 @@ export default async function generateChangelogForSinglePackage( options = {} )
|
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
/**
|
|
189
|
-
* @param {
|
|
190
|
-
* @param {
|
|
191
|
-
* @param {
|
|
192
|
-
* @param {
|
|
193
|
-
* @param {
|
|
189
|
+
* @param {string} message
|
|
190
|
+
* @param {object} [options={}]
|
|
191
|
+
* @param {number} [options.indentLevel=0]
|
|
192
|
+
* @param {boolean} [options.startWithNewLine=false] Whether to append a new line before the message.
|
|
193
|
+
* @param {boolean} [options.isWarning=false] Whether to use `warning` method instead of `log`.
|
|
194
194
|
*/
|
|
195
195
|
function logInfo( message, options = {} ) {
|
|
196
196
|
const indentLevel = options.indentLevel || 0;
|
|
@@ -206,5 +206,5 @@ export default async function generateChangelogForSinglePackage( options = {} )
|
|
|
206
206
|
*
|
|
207
207
|
* @param {Date} now The current date.
|
|
208
208
|
*
|
|
209
|
-
* @returns {
|
|
209
|
+
* @returns {string} The formatted date inserted into the changelog.
|
|
210
210
|
*/
|
|
@@ -10,12 +10,12 @@ import upath from 'upath';
|
|
|
10
10
|
/**
|
|
11
11
|
* The goal is to prepare the release directory containing the packages we want to publish.
|
|
12
12
|
*
|
|
13
|
-
* @param {
|
|
14
|
-
* @param {
|
|
15
|
-
* @param {
|
|
16
|
-
* @param {
|
|
13
|
+
* @param {object} options
|
|
14
|
+
* @param {string} options.outputDirectory Relative path to the destination directory where packages will be stored.
|
|
15
|
+
* @param {string} [options.cwd] Root of the repository to prepare. `process.cwd()` by default.
|
|
16
|
+
* @param {string} [options.packagesDirectory] Relative path to a location of packages.
|
|
17
17
|
* If specified, all of the found packages will be copied.
|
|
18
|
-
* @param {Array.<
|
|
18
|
+
* @param {Array.<string>} [options.packagesToCopy] List of packages that should be processed.
|
|
19
19
|
* If not specified, all packages found in `packagesDirectory` are considered.
|
|
20
20
|
* @param {RootPackageJson} [options.rootPackageJson] Object containing values to use in the created the `package.json` file.
|
|
21
21
|
* If not specified, the root package will not be created.
|
|
@@ -71,9 +71,9 @@ export default async function prepareRepository( options ) {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
/**
|
|
74
|
-
* @param {
|
|
75
|
-
* @param {
|
|
76
|
-
* @param {Array.<
|
|
74
|
+
* @param {object} packageJson
|
|
75
|
+
* @param {string} [packageJson.name]
|
|
76
|
+
* @param {Array.<string>} [packageJson.files]
|
|
77
77
|
*/
|
|
78
78
|
function validateRootPackage( packageJson ) {
|
|
79
79
|
if ( !packageJson.name ) {
|
|
@@ -86,10 +86,10 @@ function validateRootPackage( packageJson ) {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
/**
|
|
89
|
-
* @param {
|
|
90
|
-
* @param {
|
|
89
|
+
* @param {object} options
|
|
90
|
+
* @param {string} options.cwd
|
|
91
91
|
* @param {RootPackageJson} options.rootPackageJson
|
|
92
|
-
* @param {
|
|
92
|
+
* @param {string} options.outputDirectoryPath
|
|
93
93
|
* @returns {Promise}
|
|
94
94
|
*/
|
|
95
95
|
async function processRootPackage( { cwd, rootPackageJson, outputDirectoryPath } ) {
|
|
@@ -110,11 +110,11 @@ async function processRootPackage( { cwd, rootPackageJson, outputDirectoryPath }
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
/**
|
|
113
|
-
* @param {
|
|
114
|
-
* @param {
|
|
115
|
-
* @param {
|
|
116
|
-
* @param {
|
|
117
|
-
* @param {Array.<
|
|
113
|
+
* @param {object} options
|
|
114
|
+
* @param {string} options.cwd
|
|
115
|
+
* @param {string} options.packagesDirectory
|
|
116
|
+
* @param {string} options.outputDirectoryPath
|
|
117
|
+
* @param {Array.<string>} [options.packagesToCopy]
|
|
118
118
|
* @returns {Promise}
|
|
119
119
|
*/
|
|
120
120
|
async function processMonorepoPackages( { cwd, packagesDirectory, packagesToCopy, outputDirectoryPath } ) {
|
|
@@ -141,9 +141,9 @@ async function processMonorepoPackages( { cwd, packagesDirectory, packagesToCopy
|
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
/**
|
|
144
|
-
* @typedef {
|
|
144
|
+
* @typedef {object} RootPackageJson
|
|
145
145
|
*
|
|
146
|
-
* @param {
|
|
146
|
+
* @param {string} options.rootPackageJson.name Name of the package. Required value.
|
|
147
147
|
*
|
|
148
|
-
* @param {Array.<
|
|
148
|
+
* @param {Array.<string>} options.rootPackageJson.files Array containing a list of files or directories to copy. Required value.
|
|
149
149
|
*/
|
|
@@ -24,24 +24,24 @@ import publishPackageOnNpmCallback from '../utils/publishpackageonnpmcallback.js
|
|
|
24
24
|
* When the validation for each package passes, packages are published on npm. Optional callback is called for confirmation whether to
|
|
25
25
|
* continue.
|
|
26
26
|
*
|
|
27
|
-
* @param {
|
|
28
|
-
* @param {
|
|
29
|
-
* @param {
|
|
27
|
+
* @param {object} options
|
|
28
|
+
* @param {string} options.packagesDirectory Relative path to a location of packages to release.
|
|
29
|
+
* @param {string} options.npmOwner The account name on npm, which should be used to publish the packages.
|
|
30
30
|
* @param {ListrTaskObject} options.listrTask An instance of `ListrTask`.
|
|
31
31
|
* @param {AbortSignal|null} [options.signal=null] Signal to abort the asynchronous process.
|
|
32
|
-
* @param {
|
|
33
|
-
* @param {Object.<
|
|
32
|
+
* @param {string} [options.npmTag='staging'] The npm distribution tag.
|
|
33
|
+
* @param {Object.<string, Array.<string>>|null} [options.optionalEntries=null] Specifies which entries from the `files` field in the
|
|
34
34
|
* `package.json` are optional. The key is a package name, and its value is an array of optional entries from the `files` field, for which
|
|
35
35
|
* it is allowed not to match any file. The `options.optionalEntries` object may also contain the `default` key, which is used for all
|
|
36
36
|
* packages that do not have own definition.
|
|
37
|
-
* @param {
|
|
37
|
+
* @param {string} [options.confirmationCallback=null] An callback whose response decides to continue the publishing packages. Synchronous
|
|
38
38
|
* and asynchronous callbacks are supported.
|
|
39
|
-
* @param {
|
|
39
|
+
* @param {boolean} [options.requireEntryPoint=false] Whether to verify if packages to publish define an entry point. In other words,
|
|
40
40
|
* whether their `package.json` define the `main` field.
|
|
41
|
-
* @param {Array.<
|
|
41
|
+
* @param {Array.<string>} [options.optionalEntryPointPackages=[]] If the entry point validator is enabled (`requireEntryPoint=true`),
|
|
42
42
|
* this array contains a list of packages that will not be checked. In other words, they do not have to define the entry point.
|
|
43
|
-
* @param {
|
|
44
|
-
* @param {
|
|
43
|
+
* @param {string} [options.cwd=process.cwd()] Current working directory from which all paths will be resolved.
|
|
44
|
+
* @param {number} [options.concurrency=4] Number of CPUs that will execute the task.
|
|
45
45
|
* @returns {Promise}
|
|
46
46
|
*/
|
|
47
47
|
export default async function publishPackages( options ) {
|
package/lib/tasks/push.js
CHANGED
|
@@ -9,10 +9,10 @@ import shellEscape from 'shell-escape';
|
|
|
9
9
|
/**
|
|
10
10
|
* Push the local changes to a remote server.
|
|
11
11
|
*
|
|
12
|
-
* @param {
|
|
13
|
-
* @param {
|
|
14
|
-
* @param {
|
|
15
|
-
* @param {
|
|
12
|
+
* @param {object} options
|
|
13
|
+
* @param {string} options.releaseBranch A name of the branch that should be used for releasing packages.
|
|
14
|
+
* @param {string} options.version Name of tag connected with the release.
|
|
15
|
+
* @param {string} [options.cwd] Root of the repository to prepare. `process.cwd()` by default.
|
|
16
16
|
* @returns {Promise}
|
|
17
17
|
*/
|
|
18
18
|
export default async function push( options ) {
|
|
@@ -19,10 +19,10 @@ const execPromise = util.promisify( exec );
|
|
|
19
19
|
* Used to switch the tags from `staging` to `latest` for specified array of packages.
|
|
20
20
|
* Each operation will be retried up to 3 times in case of failure.
|
|
21
21
|
*
|
|
22
|
-
* @param {
|
|
23
|
-
* @param {
|
|
24
|
-
* @param {
|
|
25
|
-
* @param {Array.<
|
|
22
|
+
* @param {object} options
|
|
23
|
+
* @param {string} options.npmOwner User that is authorized to release packages.
|
|
24
|
+
* @param {string} options.version Specifies the version of packages to reassign the tags for.
|
|
25
|
+
* @param {Array.<string>} options.packages Array of packages' names to reassign tags for.
|
|
26
26
|
* @returns {Promise}
|
|
27
27
|
*/
|
|
28
28
|
export default async function reassignNpmTags( { npmOwner, version, packages } ) {
|
|
@@ -79,16 +79,16 @@ export default async function reassignNpmTags( { npmOwner, version, packages } )
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
/**
|
|
82
|
-
* @param {
|
|
83
|
-
* @returns {
|
|
82
|
+
* @param {string} message
|
|
83
|
+
* @returns {string}
|
|
84
84
|
*/
|
|
85
85
|
function trimErrorMessage( message ) {
|
|
86
86
|
return message.replace( /npm ERR!.*\n/g, '' ).trim();
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
/**
|
|
90
|
-
* @param {
|
|
91
|
-
* @param {
|
|
90
|
+
* @param {function} callback
|
|
91
|
+
* @param {number} times
|
|
92
92
|
* @returns {RetryCallback}
|
|
93
93
|
*/
|
|
94
94
|
function retry( callback, times = 3 ) {
|