@ckeditor/ckeditor5-dev-release-tools 43.0.0-alpha.0 → 44.0.0-alpha.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/index.js +23 -52
- package/lib/tasks/cleanuppackages.js +5 -7
- package/lib/tasks/commitandtag.js +7 -7
- package/lib/tasks/creategithubrelease.js +6 -6
- package/lib/tasks/generatechangelogformonorepository.js +37 -37
- package/lib/tasks/generatechangelogforsinglepackage.js +29 -28
- package/lib/tasks/preparerepository.js +11 -12
- package/lib/tasks/publishpackages.js +10 -12
- package/lib/tasks/push.js +4 -6
- package/lib/tasks/reassignnpmtags.js +11 -13
- package/lib/tasks/updatedependencies.js +5 -7
- package/lib/tasks/updateversions.js +8 -8
- package/lib/tasks/verifypackagespublishedcorrectly.js +6 -8
- package/lib/utils/abortcontroller.js +2 -11
- package/lib/utils/assertfilestopublish.js +5 -7
- package/lib/utils/assertnpmauthorization.js +3 -5
- package/lib/utils/assertnpmtag.js +5 -7
- package/lib/utils/assertpackages.js +4 -6
- package/lib/utils/checkversionavailability.js +4 -6
- package/lib/utils/configurereleaseoptions.js +43 -0
- package/lib/utils/confirmincludingpackage.js +24 -0
- package/lib/utils/confirmnpmtag.js +32 -0
- package/lib/utils/constants.js +26 -0
- package/lib/utils/displaycommits.js +9 -11
- package/lib/utils/displayskippedpackages.js +7 -9
- package/lib/utils/executeinparallel.js +13 -14
- package/lib/utils/generatechangelog.js +5 -7
- package/lib/utils/getchangedfilesforcommit.js +3 -5
- package/lib/utils/getchangelog.js +22 -0
- package/lib/utils/getchangesforversion.js +28 -0
- package/lib/utils/getcommits.js +8 -10
- package/lib/utils/getformatteddate.js +13 -0
- package/lib/utils/getnewversiontype.js +2 -4
- package/lib/utils/getnpmtagfromversion.js +3 -5
- package/lib/utils/getpackagejson.js +4 -6
- package/lib/utils/getpackagespaths.js +7 -9
- package/lib/utils/getwriteroptions.js +9 -6
- package/lib/utils/isversionpublishablefortag.js +5 -5
- package/lib/utils/{parallelworker.cjs → parallelworker.js} +3 -4
- package/lib/utils/parseroptions.js +1 -3
- package/lib/utils/providenewversionformonorepository.js +51 -0
- package/lib/utils/providetoken.js +26 -0
- package/lib/utils/provideversion.js +98 -0
- package/lib/utils/publishpackageonnpmcallback.js +10 -12
- package/lib/utils/savechangelog.js +18 -0
- package/lib/utils/transformcommitfactory.js +6 -6
- package/lib/utils/transformcommitutils.js +142 -147
- package/lib/utils/truncatechangelog.js +42 -0
- package/lib/utils/validaterepositorytorelease.js +3 -5
- package/lib/utils/versions.js +122 -128
- package/package.json +3 -2
- package/lib/utils/changelog.js +0 -109
- package/lib/utils/cli.js +0 -349
package/lib/index.js
CHANGED
|
@@ -3,20 +3,18 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const cleanUpPackages = require( './tasks/cleanuppackages' );
|
|
19
|
-
const {
|
|
6
|
+
export { default as generateChangelogForSinglePackage } from './tasks/generatechangelogforsinglepackage.js';
|
|
7
|
+
export { default as generateChangelogForMonoRepository } from './tasks/generatechangelogformonorepository.js';
|
|
8
|
+
export { default as updateDependencies } from './tasks/updatedependencies.js';
|
|
9
|
+
export { default as commitAndTag } from './tasks/commitandtag.js';
|
|
10
|
+
export { default as createGithubRelease } from './tasks/creategithubrelease.js';
|
|
11
|
+
export { default as reassignNpmTags } from './tasks/reassignnpmtags.js';
|
|
12
|
+
export { default as prepareRepository } from './tasks/preparerepository.js';
|
|
13
|
+
export { default as push } from './tasks/push.js';
|
|
14
|
+
export { default as publishPackages } from './tasks/publishpackages.js';
|
|
15
|
+
export { default as updateVersions } from './tasks/updateversions.js';
|
|
16
|
+
export { default as cleanUpPackages } from './tasks/cleanuppackages.js';
|
|
17
|
+
export {
|
|
20
18
|
getLastFromChangelog,
|
|
21
19
|
getLastPreRelease,
|
|
22
20
|
getNextPreRelease,
|
|
@@ -24,41 +22,14 @@ const {
|
|
|
24
22
|
getNextNightly,
|
|
25
23
|
getCurrent,
|
|
26
24
|
getLastTagFromGit
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
generateChangelogForMonoRepository,
|
|
39
|
-
updateDependencies,
|
|
40
|
-
updateVersions,
|
|
41
|
-
prepareRepository,
|
|
42
|
-
commitAndTag,
|
|
43
|
-
createGithubRelease,
|
|
44
|
-
push,
|
|
45
|
-
cleanUpPackages,
|
|
46
|
-
publishPackages,
|
|
47
|
-
reassignNpmTags,
|
|
48
|
-
executeInParallel,
|
|
49
|
-
getLastFromChangelog,
|
|
50
|
-
getLastPreRelease,
|
|
51
|
-
getNextPreRelease,
|
|
52
|
-
getLastNightly,
|
|
53
|
-
getNextNightly,
|
|
54
|
-
getCurrent,
|
|
55
|
-
getLastTagFromGit,
|
|
56
|
-
getNpmTagFromVersion,
|
|
57
|
-
getChangesForVersion,
|
|
58
|
-
getChangelog,
|
|
59
|
-
saveChangelog,
|
|
60
|
-
validateRepositoryToRelease,
|
|
61
|
-
verifyPackagesPublishedCorrectly,
|
|
62
|
-
checkVersionAvailability,
|
|
63
|
-
isVersionPublishableForTag
|
|
64
|
-
};
|
|
25
|
+
} from './utils/versions.js';
|
|
26
|
+
export { default as getChangesForVersion } from './utils/getchangesforversion.js';
|
|
27
|
+
export { default as getChangelog } from './utils/getchangelog.js';
|
|
28
|
+
export { default as saveChangelog } from './utils/savechangelog.js';
|
|
29
|
+
export { default as executeInParallel } from './utils/executeinparallel.js';
|
|
30
|
+
export { default as validateRepositoryToRelease } from './utils/validaterepositorytorelease.js';
|
|
31
|
+
export { default as checkVersionAvailability } from './utils/checkversionavailability.js';
|
|
32
|
+
export { default as verifyPackagesPublishedCorrectly } from './tasks/verifypackagespublishedcorrectly.js';
|
|
33
|
+
export { default as getNpmTagFromVersion } from './utils/getnpmtagfromversion.js';
|
|
34
|
+
export { default as isVersionPublishableForTag } from './utils/isversionpublishablefortag.js';
|
|
35
|
+
export { default as provideToken } from './utils/providetoken.js';
|
|
@@ -3,11 +3,9 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const upath = require( 'upath' );
|
|
10
|
-
const { glob } = require( 'glob' );
|
|
6
|
+
import fs from 'fs-extra';
|
|
7
|
+
import upath from 'upath';
|
|
8
|
+
import { glob } from 'glob';
|
|
11
9
|
|
|
12
10
|
/**
|
|
13
11
|
* The purpose of the script is to clean all packages prepared for the release. The cleaning consists of two stages:
|
|
@@ -29,7 +27,7 @@ const { glob } = require( 'glob' );
|
|
|
29
27
|
* @param {String} [options.cwd] Current working directory from which all paths will be resolved.
|
|
30
28
|
* @returns {Promise}
|
|
31
29
|
*/
|
|
32
|
-
|
|
30
|
+
export default async function cleanUpPackages( options ) {
|
|
33
31
|
const { packagesDirectory, packageJsonFieldsToRemove, preservePostInstallHook, cwd } = parseOptions( options );
|
|
34
32
|
|
|
35
33
|
const packageJsonPaths = await glob( '*/package.json', {
|
|
@@ -47,7 +45,7 @@ module.exports = async function cleanUpPackages( options ) {
|
|
|
47
45
|
|
|
48
46
|
await fs.writeJson( packageJsonPath, packageJson, { spaces: 2 } );
|
|
49
47
|
}
|
|
50
|
-
}
|
|
48
|
+
}
|
|
51
49
|
|
|
52
50
|
/**
|
|
53
51
|
* Prepares the configuration options for the script.
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
import upath from 'upath';
|
|
7
|
+
import { tools } from '@ckeditor/ckeditor5-dev-utils';
|
|
8
|
+
import { glob } from 'glob';
|
|
9
|
+
import shellEscape from 'shell-escape';
|
|
7
10
|
|
|
8
|
-
const {
|
|
9
|
-
const { toUnix } = require( 'upath' );
|
|
10
|
-
const { glob } = require( 'glob' );
|
|
11
|
-
const shellEscape = require( 'shell-escape' );
|
|
11
|
+
const { toUnix } = upath;
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Creates a commit and a tag for specified version.
|
|
@@ -19,7 +19,7 @@ const shellEscape = require( 'shell-escape' );
|
|
|
19
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() } ) {
|
|
23
23
|
const normalizedCwd = toUnix( cwd );
|
|
24
24
|
const filePathsToAdd = await glob( files, { cwd: normalizedCwd, absolute: true, nodir: true } );
|
|
25
25
|
|
|
@@ -41,4 +41,4 @@ module.exports = async function commitAndTag( { version, files, cwd = process.cw
|
|
|
41
41
|
const escapedVersion = shellEscape( [ version ] );
|
|
42
42
|
await tools.shExec( `git commit --message "Release: v${ escapedVersion }." --no-verify`, shExecOptions );
|
|
43
43
|
await tools.shExec( `git tag v${ escapedVersion }`, shExecOptions );
|
|
44
|
-
}
|
|
44
|
+
}
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
import { Octokit } from '@octokit/rest';
|
|
7
|
+
import semver from 'semver';
|
|
8
|
+
import * as transformCommitUtils from '../utils/transformcommitutils.js';
|
|
7
9
|
|
|
8
|
-
const {
|
|
9
|
-
const semver = require( 'semver' );
|
|
10
|
-
const { getRepositoryUrl } = require( '../utils/transformcommitutils' );
|
|
10
|
+
const { getRepositoryUrl } = transformCommitUtils;
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Create a GitHub release.
|
|
@@ -19,7 +19,7 @@ const { getRepositoryUrl } = require( '../utils/transformcommitutils' );
|
|
|
19
19
|
* @param {String} [options.cwd=process.cwd()] Current working directory from which all paths will be resolved.
|
|
20
20
|
* @returns {Promise.<String>}
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
export default async function createGithubRelease( options ) {
|
|
23
23
|
const {
|
|
24
24
|
token,
|
|
25
25
|
version,
|
|
@@ -46,7 +46,7 @@ module.exports = async function createGithubRelease( options ) {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
return `https://github.com/${ repositoryOwner }/${ repositoryName }/releases/tag/v${ version }`;
|
|
49
|
-
}
|
|
49
|
+
}
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
52
|
* Returns an npm tag based on the specified release version.
|
|
@@ -3,26 +3,28 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
6
|
+
import fs from 'fs';
|
|
7
|
+
import path from 'path';
|
|
8
|
+
import { tools, logger } from '@ckeditor/ckeditor5-dev-utils';
|
|
9
|
+
import compareFunc from 'compare-func';
|
|
10
|
+
import chalk from 'chalk';
|
|
11
|
+
import semver from 'semver';
|
|
12
|
+
import displayCommits from '../utils/displaycommits.js';
|
|
13
|
+
import displaySkippedPackages from '../utils/displayskippedpackages.js';
|
|
14
|
+
import generateChangelog from '../utils/generatechangelog.js';
|
|
15
|
+
import getPackageJson from '../utils/getpackagejson.js';
|
|
16
|
+
import getPackagesPaths from '../utils/getpackagespaths.js';
|
|
17
|
+
import getCommits from '../utils/getcommits.js';
|
|
18
|
+
import getNewVersionType from '../utils/getnewversiontype.js';
|
|
19
|
+
import getWriterOptions from '../utils/getwriteroptions.js';
|
|
20
|
+
import getFormattedDate from '../utils/getformatteddate.js';
|
|
21
|
+
import getChangelog from '../utils/getchangelog.js';
|
|
22
|
+
import saveChangelog from '../utils/savechangelog.js';
|
|
23
|
+
import truncateChangelog from '../utils/truncatechangelog.js';
|
|
24
|
+
import transformCommitFactory from '../utils/transformcommitfactory.js';
|
|
25
|
+
import { getRepositoryUrl } from '../utils/transformcommitutils.js';
|
|
26
|
+
import provideNewVersionForMonoRepository from '../utils/providenewversionformonorepository.js';
|
|
27
|
+
import { CHANGELOG_FILE, CHANGELOG_HEADER, CLI_INDENT_SIZE } from '../utils/constants.js';
|
|
26
28
|
|
|
27
29
|
const VERSIONING_POLICY_URL = 'https://ckeditor.com/docs/ckeditor5/latest/framework/guides/support/versioning-policy.html';
|
|
28
30
|
const noteInfo = `[ℹ️](${ VERSIONING_POLICY_URL }#major-and-minor-breaking-changes)`;
|
|
@@ -63,7 +65,7 @@ const noteInfo = `[ℹ️](${ VERSIONING_POLICY_URL }#major-and-minor-breaking-c
|
|
|
63
65
|
*
|
|
64
66
|
* @returns {Promise.<undefined|String>}
|
|
65
67
|
*/
|
|
66
|
-
|
|
68
|
+
export default async function generateChangelogForMonoRepository( options ) {
|
|
67
69
|
const log = logger();
|
|
68
70
|
const cwd = process.cwd();
|
|
69
71
|
const rootPkgJson = getPackageJson( options.cwd );
|
|
@@ -125,11 +127,11 @@ module.exports = async function generateChangelogForMonoRepository( options ) {
|
|
|
125
127
|
}
|
|
126
128
|
|
|
127
129
|
if ( !skipFileSave ) {
|
|
128
|
-
await
|
|
130
|
+
await saveChangelogToFile();
|
|
129
131
|
|
|
130
132
|
// Make a commit from the repository where we started.
|
|
131
133
|
process.chdir( options.cwd );
|
|
132
|
-
tools.shExec( `git add ${
|
|
134
|
+
tools.shExec( `git add ${ CHANGELOG_FILE }`, { verbosity: 'error' } );
|
|
133
135
|
tools.shExec( 'git commit -m "Docs: Changelog. [skip ci]"', { verbosity: 'error' } );
|
|
134
136
|
logInfo( 'Committed.', { indentLevel: 1 } );
|
|
135
137
|
}
|
|
@@ -295,7 +297,7 @@ module.exports = async function generateChangelogForMonoRepository( options ) {
|
|
|
295
297
|
bumpType = 'patch';
|
|
296
298
|
}
|
|
297
299
|
|
|
298
|
-
return
|
|
300
|
+
return provideNewVersionForMonoRepository( highestVersion, packageHighestVersion, bumpType, { indentLevel: 1 } )
|
|
299
301
|
.then( version => {
|
|
300
302
|
nextVersion = version;
|
|
301
303
|
|
|
@@ -410,7 +412,7 @@ module.exports = async function generateChangelogForMonoRepository( options ) {
|
|
|
410
412
|
isPatch: semver.diff( version, rootPkgJson.version ) === 'patch',
|
|
411
413
|
skipCommitsLink: Boolean( options.skipLinks ),
|
|
412
414
|
skipCompareLink: Boolean( options.skipLinks ),
|
|
413
|
-
date: options.formatDate ? options.formatDate( new Date() ) :
|
|
415
|
+
date: options.formatDate ? options.formatDate( new Date() ) : getFormattedDate()
|
|
414
416
|
};
|
|
415
417
|
|
|
416
418
|
const writerOptions = getWriterOptions( {
|
|
@@ -464,7 +466,7 @@ module.exports = async function generateChangelogForMonoRepository( options ) {
|
|
|
464
466
|
const dependenciesSummary = generateSummaryOfChangesInPackages();
|
|
465
467
|
|
|
466
468
|
return [
|
|
467
|
-
|
|
469
|
+
CHANGELOG_HEADER,
|
|
468
470
|
changesFromCommits.trim(),
|
|
469
471
|
'\n\n',
|
|
470
472
|
dependenciesSummary
|
|
@@ -474,26 +476,24 @@ module.exports = async function generateChangelogForMonoRepository( options ) {
|
|
|
474
476
|
/**
|
|
475
477
|
* Combines the generated changes based on commits and summary of version changes in packages.
|
|
476
478
|
* Appends those changes at the beginning of the changelog file.
|
|
477
|
-
*
|
|
478
|
-
* @param {String} changesFromCommits Generated entries based on commits.
|
|
479
479
|
*/
|
|
480
|
-
async function
|
|
480
|
+
async function saveChangelogToFile() {
|
|
481
481
|
logProcess( 'Saving changelog...' );
|
|
482
482
|
|
|
483
|
-
if ( !fs.existsSync(
|
|
483
|
+
if ( !fs.existsSync( CHANGELOG_FILE ) ) {
|
|
484
484
|
logInfo( 'Changelog file does not exist. Creating...', { isWarning: true, indentLevel: 1 } );
|
|
485
485
|
|
|
486
|
-
|
|
486
|
+
saveChangelog( CHANGELOG_FILE );
|
|
487
487
|
}
|
|
488
488
|
|
|
489
489
|
logInfo( 'Preparing a summary of version changes in packages.', { indentLevel: 1 } );
|
|
490
490
|
|
|
491
|
-
let currentChangelog =
|
|
491
|
+
let currentChangelog = getChangelog();
|
|
492
492
|
|
|
493
493
|
const nextVersionChangelog = await getChangelogForNextVersion();
|
|
494
494
|
|
|
495
495
|
// Remove header from current changelog.
|
|
496
|
-
currentChangelog = currentChangelog.replace(
|
|
496
|
+
currentChangelog = currentChangelog.replace( CHANGELOG_HEADER, '' ).trim();
|
|
497
497
|
|
|
498
498
|
// Concat header, new entries and old changelog to single string.
|
|
499
499
|
let newChangelog = nextVersionChangelog + '\n\n\n' + currentChangelog;
|
|
@@ -501,10 +501,10 @@ module.exports = async function generateChangelogForMonoRepository( options ) {
|
|
|
501
501
|
newChangelog = newChangelog.trim() + '\n';
|
|
502
502
|
|
|
503
503
|
// Save the changelog.
|
|
504
|
-
|
|
504
|
+
saveChangelog( newChangelog );
|
|
505
505
|
|
|
506
506
|
// Truncate the changelog to keep the latest five release entries.
|
|
507
|
-
|
|
507
|
+
truncateChangelog( 5 );
|
|
508
508
|
|
|
509
509
|
logInfo( 'Saved.', { indentLevel: 1 } );
|
|
510
510
|
}
|
|
@@ -721,9 +721,9 @@ module.exports = async function generateChangelogForMonoRepository( options ) {
|
|
|
721
721
|
const startWithNewLine = options.startWithNewLine || false;
|
|
722
722
|
const method = options.isWarning ? 'warning' : 'info';
|
|
723
723
|
|
|
724
|
-
log[ method ]( `${ startWithNewLine ? '\n' : '' }${ ' '.repeat( indentLevel *
|
|
724
|
+
log[ method ]( `${ startWithNewLine ? '\n' : '' }${ ' '.repeat( indentLevel * CLI_INDENT_SIZE ) }` + message );
|
|
725
725
|
}
|
|
726
|
-
}
|
|
726
|
+
}
|
|
727
727
|
|
|
728
728
|
/**
|
|
729
729
|
* @typedef {Object} Version
|
|
@@ -3,22 +3,23 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
6
|
+
import fs from 'fs';
|
|
7
|
+
import { tools, logger } from '@ckeditor/ckeditor5-dev-utils';
|
|
8
|
+
import chalk from 'chalk';
|
|
9
|
+
import semver from 'semver';
|
|
10
|
+
import displayCommits from '../utils/displaycommits.js';
|
|
11
|
+
import generateChangelog from '../utils/generatechangelog.js';
|
|
12
|
+
import getPackageJson from '../utils/getpackagejson.js';
|
|
13
|
+
import getNewVersionType from '../utils/getnewversiontype.js';
|
|
14
|
+
import getCommits from '../utils/getcommits.js';
|
|
15
|
+
import getWriterOptions from '../utils/getwriteroptions.js';
|
|
16
|
+
import { getRepositoryUrl } from '../utils/transformcommitutils.js';
|
|
17
|
+
import transformCommitFactory from '../utils/transformcommitfactory.js';
|
|
18
|
+
import getFormattedDate from '../utils/getformatteddate.js';
|
|
19
|
+
import saveChangelog from '../utils/savechangelog.js';
|
|
20
|
+
import getChangelog from '../utils/getchangelog.js';
|
|
21
|
+
import provideVersion from '../utils/provideversion.js';
|
|
22
|
+
import { CHANGELOG_FILE, CHANGELOG_HEADER, CLI_INDENT_SIZE } from '../utils/constants.js';
|
|
22
23
|
|
|
23
24
|
const SKIP_GENERATE_CHANGELOG = 'Typed "skip" as a new version. Aborting.';
|
|
24
25
|
|
|
@@ -40,7 +41,7 @@ const SKIP_GENERATE_CHANGELOG = 'Typed "skip" as a new version. Aborting.';
|
|
|
40
41
|
*
|
|
41
42
|
* @returns {Promise}
|
|
42
43
|
*/
|
|
43
|
-
|
|
44
|
+
export default async function generateChangelogForSinglePackage( options = {} ) {
|
|
44
45
|
const log = logger();
|
|
45
46
|
const pkgJson = getPackageJson();
|
|
46
47
|
|
|
@@ -79,7 +80,7 @@ module.exports = async function generateChangelogForSinglePackage( options = {}
|
|
|
79
80
|
|
|
80
81
|
displayCommits( allCommits, { indentLevel: 1 } );
|
|
81
82
|
|
|
82
|
-
return
|
|
83
|
+
return provideVersion( pkgJson.version, releaseType, { indentLevel: 1 } );
|
|
83
84
|
} )
|
|
84
85
|
.then( version => {
|
|
85
86
|
if ( version === 'skip' ) {
|
|
@@ -106,7 +107,7 @@ module.exports = async function generateChangelogForSinglePackage( options = {}
|
|
|
106
107
|
isInternalRelease,
|
|
107
108
|
skipCommitsLink: Boolean( options.skipLinks ),
|
|
108
109
|
skipCompareLink: Boolean( options.skipLinks ),
|
|
109
|
-
date: options.formatDate ? options.formatDate( new Date() ) :
|
|
110
|
+
date: options.formatDate ? options.formatDate( new Date() ) : getFormattedDate()
|
|
110
111
|
};
|
|
111
112
|
|
|
112
113
|
const writerOptions = getWriterOptions( {
|
|
@@ -137,25 +138,25 @@ module.exports = async function generateChangelogForSinglePackage( options = {}
|
|
|
137
138
|
.then( changesFromCommits => {
|
|
138
139
|
logProcess( 'Saving changelog...' );
|
|
139
140
|
|
|
140
|
-
if ( !fs.existsSync(
|
|
141
|
+
if ( !fs.existsSync( CHANGELOG_FILE ) ) {
|
|
141
142
|
logInfo( 'Changelog file does not exist. Creating...', { isWarning: true, indentLevel: 1 } );
|
|
142
143
|
|
|
143
|
-
|
|
144
|
+
saveChangelog( CHANGELOG_HEADER );
|
|
144
145
|
}
|
|
145
146
|
|
|
146
|
-
let currentChangelog =
|
|
147
|
+
let currentChangelog = getChangelog();
|
|
147
148
|
|
|
148
149
|
// Remove header from current changelog.
|
|
149
|
-
currentChangelog = currentChangelog.replace(
|
|
150
|
+
currentChangelog = currentChangelog.replace( CHANGELOG_HEADER, '' );
|
|
150
151
|
|
|
151
152
|
// Concat header, new and current changelog.
|
|
152
|
-
let newChangelog =
|
|
153
|
+
let newChangelog = CHANGELOG_HEADER + changesFromCommits + currentChangelog.trim();
|
|
153
154
|
newChangelog = newChangelog.trim() + '\n';
|
|
154
155
|
|
|
155
156
|
// Save the changelog.
|
|
156
|
-
|
|
157
|
+
saveChangelog( newChangelog );
|
|
157
158
|
|
|
158
|
-
tools.shExec( `git add ${
|
|
159
|
+
tools.shExec( `git add ${ CHANGELOG_FILE }`, { verbosity: 'error' } );
|
|
159
160
|
tools.shExec( 'git commit -m "Docs: Changelog. [skip ci]"', { verbosity: 'error' } );
|
|
160
161
|
|
|
161
162
|
logInfo( 'Saved.', { indentLevel: 1 } );
|
|
@@ -193,9 +194,9 @@ module.exports = async function generateChangelogForSinglePackage( options = {}
|
|
|
193
194
|
const startWithNewLine = options.startWithNewLine || false;
|
|
194
195
|
const method = options.isWarning ? 'warning' : 'info';
|
|
195
196
|
|
|
196
|
-
log[ method ]( `${ startWithNewLine ? '\n' : '' }${ ' '.repeat( indentLevel *
|
|
197
|
+
log[ method ]( `${ startWithNewLine ? '\n' : '' }${ ' '.repeat( indentLevel * CLI_INDENT_SIZE ) }` + message );
|
|
197
198
|
}
|
|
198
|
-
}
|
|
199
|
+
}
|
|
199
200
|
|
|
200
201
|
/**
|
|
201
202
|
* @callback FormatDateCallback
|
|
@@ -3,11 +3,9 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const glob = require( 'glob' );
|
|
10
|
-
const upath = require( 'upath' );
|
|
6
|
+
import fs from 'fs-extra';
|
|
7
|
+
import { glob } from 'glob';
|
|
8
|
+
import upath from 'upath';
|
|
11
9
|
|
|
12
10
|
/**
|
|
13
11
|
* The goal is to prepare the release directory containing the packages we want to publish.
|
|
@@ -23,7 +21,7 @@ const upath = require( 'upath' );
|
|
|
23
21
|
* If not specified, the root package will not be created.
|
|
24
22
|
* @returns {Promise}
|
|
25
23
|
*/
|
|
26
|
-
|
|
24
|
+
export default async function prepareRepository( options ) {
|
|
27
25
|
const {
|
|
28
26
|
outputDirectory,
|
|
29
27
|
packagesDirectory,
|
|
@@ -70,7 +68,7 @@ module.exports = async function prepareRepository( options ) {
|
|
|
70
68
|
}
|
|
71
69
|
|
|
72
70
|
return Promise.all( copyPromises );
|
|
73
|
-
}
|
|
71
|
+
}
|
|
74
72
|
|
|
75
73
|
/**
|
|
76
74
|
* @param {Object} packageJson
|
|
@@ -102,12 +100,13 @@ async function processRootPackage( { cwd, rootPackageJson, outputDirectoryPath }
|
|
|
102
100
|
await fs.ensureDir( rootPackageOutputPath );
|
|
103
101
|
await fs.writeJson( pkgJsonOutputPath, rootPackageJson, { spaces: 2, EOL: '\n' } );
|
|
104
102
|
|
|
105
|
-
return glob
|
|
106
|
-
|
|
107
|
-
|
|
103
|
+
return ( await glob( rootPackageJson.files ) )
|
|
104
|
+
.map( absoluteFilePath => {
|
|
105
|
+
const relativeFilePath = upath.relative( cwd, absoluteFilePath );
|
|
106
|
+
const absoluteFileOutputPath = upath.join( rootPackageOutputPath, relativeFilePath );
|
|
108
107
|
|
|
109
|
-
|
|
110
|
-
|
|
108
|
+
return fs.copy( absoluteFilePath, absoluteFileOutputPath );
|
|
109
|
+
} );
|
|
111
110
|
}
|
|
112
111
|
|
|
113
112
|
/**
|
|
@@ -3,16 +3,14 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const executeInParallel = require( '../utils/executeinparallel' );
|
|
15
|
-
const publishPackageOnNpmCallback = require( '../utils/publishpackageonnpmcallback' );
|
|
6
|
+
import upath from 'upath';
|
|
7
|
+
import { glob } from 'glob';
|
|
8
|
+
import assertNpmAuthorization from '../utils/assertnpmauthorization.js';
|
|
9
|
+
import assertPackages from '../utils/assertpackages.js';
|
|
10
|
+
import assertNpmTag from '../utils/assertnpmtag.js';
|
|
11
|
+
import assertFilesToPublish from '../utils/assertfilestopublish.js';
|
|
12
|
+
import executeInParallel from '../utils/executeinparallel.js';
|
|
13
|
+
import publishPackageOnNpmCallback from '../utils/publishpackageonnpmcallback.js';
|
|
16
14
|
|
|
17
15
|
/**
|
|
18
16
|
* The purpose of the script is to validate the packages prepared for the release and then release them on npm.
|
|
@@ -46,7 +44,7 @@ const publishPackageOnNpmCallback = require( '../utils/publishpackageonnpmcallba
|
|
|
46
44
|
* @param {Number} [options.concurrency=4] Number of CPUs that will execute the task.
|
|
47
45
|
* @returns {Promise}
|
|
48
46
|
*/
|
|
49
|
-
|
|
47
|
+
export default async function publishPackages( options ) {
|
|
50
48
|
const {
|
|
51
49
|
packagesDirectory,
|
|
52
50
|
npmOwner,
|
|
@@ -87,4 +85,4 @@ module.exports = async function publishPackages( options ) {
|
|
|
87
85
|
concurrency
|
|
88
86
|
} );
|
|
89
87
|
}
|
|
90
|
-
}
|
|
88
|
+
}
|
package/lib/tasks/push.js
CHANGED
|
@@ -3,10 +3,8 @@
|
|
|
3
3
|
* For licensing, see LICENSE.md.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const { tools } = require( '@ckeditor/ckeditor5-dev-utils' );
|
|
9
|
-
const shellEscape = require( 'shell-escape' );
|
|
6
|
+
import { tools } from '@ckeditor/ckeditor5-dev-utils';
|
|
7
|
+
import shellEscape from 'shell-escape';
|
|
10
8
|
|
|
11
9
|
/**
|
|
12
10
|
* Push the local changes to a remote server.
|
|
@@ -17,7 +15,7 @@ const shellEscape = require( 'shell-escape' );
|
|
|
17
15
|
* @param {String} [options.cwd] Root of the repository to prepare. `process.cwd()` by default.
|
|
18
16
|
* @returns {Promise}
|
|
19
17
|
*/
|
|
20
|
-
|
|
18
|
+
export default async function push( options ) {
|
|
21
19
|
const {
|
|
22
20
|
releaseBranch,
|
|
23
21
|
version,
|
|
@@ -27,4 +25,4 @@ module.exports = async function push( options ) {
|
|
|
27
25
|
const command = `git push origin ${ shellEscape( [ releaseBranch ] ) } v${ shellEscape( [ version ] ) }`;
|
|
28
26
|
|
|
29
27
|
return tools.shExec( command, { cwd, verbosity: 'error', async: true } );
|
|
30
|
-
}
|
|
28
|
+
}
|
|
@@ -5,17 +5,15 @@
|
|
|
5
5
|
* For licensing, see LICENSE.md.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
import chalk from 'chalk';
|
|
9
|
+
import columns from 'cli-columns';
|
|
10
|
+
import { tools } from '@ckeditor/ckeditor5-dev-utils';
|
|
11
|
+
import util from 'util';
|
|
12
|
+
import shellEscape from 'shell-escape';
|
|
13
|
+
import assertNpmAuthorization from '../utils/assertnpmauthorization.js';
|
|
14
|
+
import { exec } from 'child_process';
|
|
9
15
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const chalk = require( 'chalk' );
|
|
13
|
-
const columns = require( 'cli-columns' );
|
|
14
|
-
const { tools } = require( '@ckeditor/ckeditor5-dev-utils' );
|
|
15
|
-
const util = require( 'util' );
|
|
16
|
-
const shellEscape = require( 'shell-escape' );
|
|
17
|
-
const exec = util.promisify( require( 'child_process' ).exec );
|
|
18
|
-
const assertNpmAuthorization = require( '../utils/assertnpmauthorization' );
|
|
16
|
+
const execPromise = util.promisify( exec );
|
|
19
17
|
|
|
20
18
|
/**
|
|
21
19
|
* Used to switch the tags from `staging` to `latest` for specified array of packages.
|
|
@@ -27,7 +25,7 @@ const assertNpmAuthorization = require( '../utils/assertnpmauthorization' );
|
|
|
27
25
|
* @param {Array.<String>} options.packages Array of packages' names to reassign tags for.
|
|
28
26
|
* @returns {Promise}
|
|
29
27
|
*/
|
|
30
|
-
|
|
28
|
+
export default async function reassignNpmTags( { npmOwner, version, packages } ) {
|
|
31
29
|
const errors = [];
|
|
32
30
|
const packagesSkipped = [];
|
|
33
31
|
const packagesUpdated = [];
|
|
@@ -39,7 +37,7 @@ module.exports = async function reassignNpmTags( { npmOwner, version, packages }
|
|
|
39
37
|
|
|
40
38
|
const updateTagPromises = packages.map( async packageName => {
|
|
41
39
|
const command = `npm dist-tag add ${ shellEscape( [ packageName ] ) }@${ shellEscape( [ version ] ) } latest`;
|
|
42
|
-
const updateLatestTagRetryable = retry( () =>
|
|
40
|
+
const updateLatestTagRetryable = retry( () => execPromise( command ) );
|
|
43
41
|
await updateLatestTagRetryable()
|
|
44
42
|
.then( response => {
|
|
45
43
|
if ( response.stdout ) {
|
|
@@ -78,7 +76,7 @@ module.exports = async function reassignNpmTags( { npmOwner, version, packages }
|
|
|
78
76
|
console.log( chalk.bold.red( '🐛 Errors found:' ) );
|
|
79
77
|
errors.forEach( msg => console.log( `* ${ msg }` ) );
|
|
80
78
|
}
|
|
81
|
-
}
|
|
79
|
+
}
|
|
82
80
|
|
|
83
81
|
/**
|
|
84
82
|
* @param {String} message
|