@ckeditor/ckeditor5-dev-release-tools 32.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 (34) hide show
  1. package/LICENSE.md +16 -0
  2. package/README.md +89 -0
  3. package/lib/index.js +28 -0
  4. package/lib/tasks/bumpversions.js +354 -0
  5. package/lib/tasks/generatechangelogformonorepository.js +723 -0
  6. package/lib/tasks/generatechangelogforsinglepackage.js +202 -0
  7. package/lib/tasks/releasesubrepositories.js +929 -0
  8. package/lib/tasks/updateckeditor5dependencies.js +392 -0
  9. package/lib/templates/commit.hbs +29 -0
  10. package/lib/templates/footer.hbs +10 -0
  11. package/lib/templates/header.hbs +23 -0
  12. package/lib/templates/release-package.json +12 -0
  13. package/lib/templates/template.hbs +37 -0
  14. package/lib/utils/changelog.js +67 -0
  15. package/lib/utils/cli.js +324 -0
  16. package/lib/utils/creategithubrelease.js +35 -0
  17. package/lib/utils/displaycommits.js +105 -0
  18. package/lib/utils/displayskippedpackages.js +32 -0
  19. package/lib/utils/executeonpackages.js +26 -0
  20. package/lib/utils/generatechangelog.js +121 -0
  21. package/lib/utils/getchangedfilesforcommit.js +33 -0
  22. package/lib/utils/getcommits.js +104 -0
  23. package/lib/utils/getnewversiontype.js +53 -0
  24. package/lib/utils/getpackagejson.js +24 -0
  25. package/lib/utils/getpackagespaths.js +90 -0
  26. package/lib/utils/getpackagestorelease.js +152 -0
  27. package/lib/utils/getwriteroptions.js +33 -0
  28. package/lib/utils/parseroptions.js +26 -0
  29. package/lib/utils/transformcommitfactory.js +492 -0
  30. package/lib/utils/transformcommitutils.js +163 -0
  31. package/lib/utils/updatedependenciesversions.js +32 -0
  32. package/lib/utils/validatepackagetorelease.js +54 -0
  33. package/lib/utils/versions.js +59 -0
  34. package/package.json +52 -0
@@ -0,0 +1,54 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md.
4
+ */
5
+
6
+ 'use strict';
7
+
8
+ const { tools } = require( '@ckeditor/ckeditor5-dev-utils' );
9
+
10
+ /**
11
+ * @param {Object} options
12
+ * @param {String} options.version Version of the current release.
13
+ * @param {String} options.changes Changelog entries for the current release.
14
+ * @param {Boolean} [options.ignoreBranchCheck=false] If set on true, branch checking will be skipped.
15
+ * @param {String} [options.branch='master'] A name of the branch that should be used for releasing packages.
16
+ * @returns {Array.<String>}
17
+ */
18
+ module.exports = function validatePackageToRelease( options ) {
19
+ const errors = [];
20
+ const branch = options.branch || 'master';
21
+
22
+ // Check whether the repository is ready for the release.
23
+ const status = exec( 'git status -sb', { verbosity: 'error' } ).trim();
24
+
25
+ if ( !options.ignoreBranchCheck ) {
26
+ // Check whether current branch is "master".
27
+ if ( !status.startsWith( `## ${ branch }...origin/${ branch }` ) ) {
28
+ errors.push( `Not on ${ branch } branch.` );
29
+ }
30
+ }
31
+
32
+ // Check whether the local branch is sync with the remote.
33
+ if ( status.match( /behind \d+/ ) ) {
34
+ errors.push( 'The branch is behind with the remote.' );
35
+ }
36
+
37
+ // Check whether specified the version.
38
+ if ( !options.version ) {
39
+ errors.push( `Passed an invalid version ("${ options.version }").` );
40
+
41
+ return errors;
42
+ }
43
+
44
+ // Check whether the changelog entries are correct.
45
+ if ( !options.changes ) {
46
+ errors.push( `Cannot find changelog entries for version "${ options.version }".` );
47
+ }
48
+
49
+ return errors;
50
+
51
+ function exec( command ) {
52
+ return tools.shExec( command, { verbosity: 'error' } );
53
+ }
54
+ };
@@ -0,0 +1,59 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md.
4
+ */
5
+
6
+ 'use strict';
7
+
8
+ const { tools } = require( '@ckeditor/ckeditor5-dev-utils' );
9
+ const changelogUtils = require( './changelog' );
10
+ const getPackageJson = require( './getpackagejson' );
11
+
12
+ const versions = {
13
+ /**
14
+ * Returns a last created version in changelog file.
15
+ *
16
+ * @param {String} [cwd=process.cwd()] Where to look for the changelog file.
17
+ * @returns {String|null}
18
+ */
19
+ getLastFromChangelog( cwd = process.cwd() ) {
20
+ const changelog = changelogUtils.getChangelog( cwd );
21
+
22
+ if ( !changelog ) {
23
+ return null;
24
+ }
25
+
26
+ const regexp = /\n## \[?([\da-z.\-+]+)/i;
27
+ const matches = changelog.match( regexp );
28
+
29
+ return matches ? matches[ 1 ] : null;
30
+ },
31
+
32
+ /**
33
+ * Returns a name of the last created tag.
34
+ *
35
+ * @returns {String|null}
36
+ */
37
+ getLastTagFromGit() {
38
+ try {
39
+ const lastTag = tools.shExec( 'git describe --abbrev=0 --tags 2> /dev/null', { verbosity: 'error' } );
40
+
41
+ return lastTag.trim().replace( /^v/, '' ) || null;
42
+ } catch ( err ) {
43
+ /* istanbul ignore next */
44
+ return null;
45
+ }
46
+ },
47
+
48
+ /**
49
+ * Returns version of current package from `package.json`.
50
+ *
51
+ * @param {String} [cwd=process.cwd()] Current work directory.
52
+ * @returns {String}
53
+ */
54
+ getCurrent( cwd = process.cwd() ) {
55
+ return getPackageJson( cwd ).version;
56
+ }
57
+ };
58
+
59
+ module.exports = versions;
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@ckeditor/ckeditor5-dev-release-tools",
3
+ "version": "32.0.0",
4
+ "description": "Tools used for releasing CKEditor 5 and related packages.",
5
+ "keywords": [],
6
+ "main": "lib/index.js",
7
+ "dependencies": {
8
+ "@ckeditor/ckeditor5-dev-utils": "^32.0.0",
9
+ "@octokit/rest": "^17.9.2",
10
+ "chalk": "^4.0.0",
11
+ "cli-table": "^0.3.1",
12
+ "compare-func": "^2.0.0",
13
+ "concat-stream": "^2.0.0",
14
+ "conventional-changelog-writer": "^4.0.16",
15
+ "conventional-commits-filter": "^2.0.6",
16
+ "conventional-commits-parser": "^3.1.0",
17
+ "diff": "^5.0.0",
18
+ "git-raw-commits": "^2.0.7",
19
+ "glob": "^7.1.6",
20
+ "inquirer": "^7.1.0",
21
+ "lodash": "^4.17.15",
22
+ "minimatch": "^3.0.4",
23
+ "mkdirp": "^1.0.4",
24
+ "parse-github-url": "^1.0.2",
25
+ "semver": "^7.3.2"
26
+ },
27
+ "devDependencies": {
28
+ "chai": "^4.2.0",
29
+ "handlebars": "^4.7.6",
30
+ "mockery": "^2.1.0",
31
+ "mock-fs": "^5.1.2",
32
+ "proxyquire": "^2.1.3",
33
+ "sinon": "^9.2.4",
34
+ "strip-ansi": "^6.0.0"
35
+ },
36
+ "engines": {
37
+ "node": ">=14.0.0",
38
+ "npm": ">=5.7.1"
39
+ },
40
+ "files": [
41
+ "lib"
42
+ ],
43
+ "author": "CKSource (http://cksource.com/)",
44
+ "license": "GPL-2.0-or-later",
45
+ "homepage": "https://github.com/ckeditor/ckeditor5-dev/tree/master/packages/ckeditor5-dev-release-tools",
46
+ "bugs": "https://github.com/ckeditor/ckeditor5/issues",
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "https://github.com/ckeditor/ckeditor5-dev.git",
50
+ "directory": "packages/ckeditor5-dev-release-tools"
51
+ }
52
+ }