@ckeditor/ckeditor5-dev-release-tools 40.2.2 → 40.3.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
CHANGED
|
@@ -29,6 +29,7 @@ const { getChangesForVersion, getChangelog, saveChangelog } = require( './utils/
|
|
|
29
29
|
const executeInParallel = require( './utils/executeinparallel' );
|
|
30
30
|
const validateRepositoryToRelease = require( './utils/validaterepositorytorelease' );
|
|
31
31
|
const checkVersionAvailability = require( './utils/checkversionavailability' );
|
|
32
|
+
const verifyPackagesPublishedCorrectly = require( './tasks/verifypackagespublishedcorrectly' );
|
|
32
33
|
|
|
33
34
|
module.exports = {
|
|
34
35
|
generateChangelogForSinglePackage,
|
|
@@ -54,5 +55,6 @@ module.exports = {
|
|
|
54
55
|
getChangelog,
|
|
55
56
|
saveChangelog,
|
|
56
57
|
validateRepositoryToRelease,
|
|
58
|
+
verifyPackagesPublishedCorrectly,
|
|
57
59
|
checkVersionAvailability
|
|
58
60
|
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
const upath = require( 'upath' );
|
|
9
|
+
const { glob } = require( 'glob' );
|
|
10
|
+
const fs = require( 'fs-extra' );
|
|
11
|
+
const { checkVersionAvailability } = require( '../utils/checkversionavailability' );
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Npm sometimes throws incorrect error 409 while publishing, while the package uploads correctly.
|
|
15
|
+
* The purpose of the script is to validate if packages that threw 409 are uploaded correctly to npm.
|
|
16
|
+
*
|
|
17
|
+
* @param {Object} options
|
|
18
|
+
* @param {String} options.packagesDirectory Relative path to a location of packages to release.
|
|
19
|
+
* @param {String} options.version Version of the current release.
|
|
20
|
+
* @param {Function} options.onSuccess Callback fired when function is successful.
|
|
21
|
+
* @returns {Promise}
|
|
22
|
+
*/
|
|
23
|
+
module.exports = async function verifyPackagesPublishedCorrectly( options ) {
|
|
24
|
+
const { packagesDirectory, version, onSuccess } = options;
|
|
25
|
+
const packagesToVerify = await glob( upath.join( packagesDirectory, '*' ), { absolute: true } );
|
|
26
|
+
const errors = [];
|
|
27
|
+
|
|
28
|
+
if ( !packagesToVerify.length ) {
|
|
29
|
+
onSuccess( '✅ No packages found to check for upload error 409.' );
|
|
30
|
+
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
for ( const packageToVerify of packagesToVerify ) {
|
|
35
|
+
const packageJson = await fs.readJson( upath.join( packageToVerify, 'package.json' ) );
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
const packageWasUploadedCorrectly = !await checkVersionAvailability( version, packageJson.name );
|
|
39
|
+
|
|
40
|
+
if ( packageWasUploadedCorrectly ) {
|
|
41
|
+
await fs.remove( packageToVerify );
|
|
42
|
+
} else {
|
|
43
|
+
errors.push( packageJson.name );
|
|
44
|
+
}
|
|
45
|
+
} catch {
|
|
46
|
+
errors.push( packageJson.name );
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if ( errors.length ) {
|
|
51
|
+
throw new Error( 'Packages that were uploaded incorrectly, and need manual verification:\n' + errors.join( '\n' ) );
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
onSuccess( '✅ All packages that returned 409 were uploaded correctly.' );
|
|
55
|
+
};
|
|
@@ -31,7 +31,7 @@ module.exports = async function checkVersionAvailability( version, packageName )
|
|
|
31
31
|
} )
|
|
32
32
|
.catch( error => {
|
|
33
33
|
// All errors except the "E404" are re-thrown.
|
|
34
|
-
if ( !error.toString().includes( '
|
|
34
|
+
if ( !error.toString().includes( 'code E404' ) ) {
|
|
35
35
|
throw error;
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -20,12 +20,22 @@ module.exports = async function publishPackageOnNpmCallback( packagePath, taskOp
|
|
|
20
20
|
const upath = require( 'upath' );
|
|
21
21
|
const fs = require( 'fs-extra' );
|
|
22
22
|
|
|
23
|
-
await tools.shExec( `npm publish --access=public --tag ${ taskOptions.npmTag }`, {
|
|
24
|
-
|
|
23
|
+
const result = await tools.shExec( `npm publish --access=public --tag ${ taskOptions.npmTag }`, {
|
|
24
|
+
cwd: packagePath,
|
|
25
|
+
async: true,
|
|
26
|
+
verbosity: 'error'
|
|
27
|
+
} )
|
|
28
|
+
.catch( e => {
|
|
25
29
|
const packageName = upath.basename( packagePath );
|
|
26
30
|
|
|
31
|
+
if ( e.toString().includes( 'code E409' ) ) {
|
|
32
|
+
return { shouldKeepDirectory: true };
|
|
33
|
+
}
|
|
34
|
+
|
|
27
35
|
throw new Error( `Unable to publish "${ packageName }" package.` );
|
|
28
36
|
} );
|
|
29
37
|
|
|
30
|
-
|
|
38
|
+
if ( !result || !result.shouldKeepDirectory ) {
|
|
39
|
+
await fs.remove( packagePath );
|
|
40
|
+
}
|
|
31
41
|
};
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-dev-release-tools",
|
|
3
|
-
"version": "40.
|
|
3
|
+
"version": "40.3.0",
|
|
4
4
|
"description": "Tools used for releasing CKEditor 5 and related packages.",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@ckeditor/ckeditor5-dev-utils": "^40.
|
|
8
|
+
"@ckeditor/ckeditor5-dev-utils": "^40.3.0",
|
|
9
9
|
"@octokit/rest": "^19.0.0",
|
|
10
10
|
"chalk": "^4.0.0",
|
|
11
11
|
"cli-table": "^0.3.1",
|