@ckeditor/ckeditor5-dev-release-tools 39.1.0 → 39.2.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.
@@ -38,6 +38,10 @@ const publishPackageOnNpmCallback = require( '../utils/publishpackageonnpmcallba
38
38
  * packages that do not have own definition.
39
39
  * @param {String} [options.confirmationCallback=null] An callback whose response decides to continue the publishing packages. Synchronous
40
40
  * and asynchronous callbacks are supported.
41
+ * @param {Boolean} [options.requireEntryPoint=false] Whether to verify if packages to publish define an entry point. In other words,
42
+ * whether their `package.json` define the `main` field.
43
+ * @param {Array.<String>} [options.optionalEntryPointPackages=[]] If the entry point validator is enabled (`requireEntryPoint=true`),
44
+ * this array contains a list of packages that will not be checked. In other words, they do not have to define the entry point.
41
45
  * @param {String} [options.cwd=process.cwd()] Current working directory from which all paths will be resolved.
42
46
  * @param {Number} [options.concurrency=4] Number of CPUs that will execute the task.
43
47
  * @returns {Promise}
@@ -51,6 +55,8 @@ module.exports = async function publishPackages( options ) {
51
55
  npmTag = 'staging',
52
56
  optionalEntries = null,
53
57
  confirmationCallback = null,
58
+ requireEntryPoint = false,
59
+ optionalEntryPointPackages = [],
54
60
  cwd = process.cwd(),
55
61
  concurrency = 4
56
62
  } = options;
@@ -62,7 +68,7 @@ module.exports = async function publishPackages( options ) {
62
68
  absolute: true
63
69
  } );
64
70
 
65
- await assertPackages( packagePaths );
71
+ await assertPackages( packagePaths, { requireEntryPoint, optionalEntryPointPackages } );
66
72
  await assertFilesToPublish( packagePaths, optionalEntries );
67
73
  await assertNpmTag( packagePaths, npmTag );
68
74
 
@@ -12,20 +12,38 @@ const upath = require( 'upath' );
12
12
  * Checks if all packages in the provided directories contain the `package.json` file.
13
13
  *
14
14
  * @param {Array.<String>} packagePaths
15
+ * @param {Object} options
16
+ * @param {Boolean} options.requireEntryPoint Whether to verify if packages to publish define an entry point. In other words,
17
+ * whether their `package.json` define the `main` field.
18
+ * @param {Array.<String>} options.optionalEntryPointPackages If the entry point validator is enabled (`requireEntryPoint=true`),
19
+ * this array contains a list of packages that will not be checked. In other words, they do not have to define the entry point.
15
20
  * @returns {Promise}
16
21
  */
17
- module.exports = async function assertPackages( packagePaths ) {
22
+ module.exports = async function assertPackages( packagePaths, options ) {
18
23
  const errors = [];
24
+ const { requireEntryPoint, optionalEntryPointPackages } = options;
19
25
 
20
26
  for ( const packagePath of packagePaths ) {
21
27
  const packageName = upath.basename( packagePath );
22
28
  const packageJsonPath = upath.join( packagePath, 'package.json' );
23
29
 
24
30
  if ( await fs.pathExists( packageJsonPath ) ) {
25
- continue;
26
- }
31
+ if ( !requireEntryPoint ) {
32
+ continue;
33
+ }
34
+
35
+ const { name: packageName, main: entryPoint } = await fs.readJson( packageJsonPath );
27
36
 
28
- errors.push( `The "package.json" file is missing in the "${ packageName }" package.` );
37
+ if ( optionalEntryPointPackages.includes( packageName ) ) {
38
+ continue;
39
+ }
40
+
41
+ if ( !entryPoint ) {
42
+ errors.push( `The "${ packageName }" package misses the entry point ("main") definition in its "package.json".` );
43
+ }
44
+ } else {
45
+ errors.push( `The "package.json" file is missing in the "${ packageName }" package.` );
46
+ }
29
47
  }
30
48
 
31
49
  if ( errors.length ) {
@@ -79,7 +79,7 @@ const transformCommitUtils = {
79
79
  * @returns {String}
80
80
  */
81
81
  linkToGithubIssue( comment ) {
82
- return comment.replace( /(\/?[\w-]+\/[\w-]+)?#([\d]+)/ig, ( matchedText, maybeRepository, issueId ) => {
82
+ return comment.replace( /(\/?[\w-]+\/[\w-]+)?#([\d]+)(?=$|[\s,.)\]])/igm, ( matchedText, maybeRepository, issueId ) => {
83
83
  if ( maybeRepository ) {
84
84
  if ( maybeRepository.startsWith( '/' ) ) {
85
85
  return matchedText;
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-dev-release-tools",
3
- "version": "39.1.0",
3
+ "version": "39.2.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": "^39.1.0",
8
+ "@ckeditor/ckeditor5-dev-utils": "^39.2.0",
9
9
  "@octokit/rest": "^19.0.0",
10
10
  "chalk": "^4.0.0",
11
11
  "cli-table": "^0.3.1",