@ckeditor/ckeditor5-dev-ci 43.0.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.
@@ -5,9 +5,7 @@
5
5
  * For licensing, see LICENSE.md.
6
6
  */
7
7
 
8
- 'use strict';
9
-
10
- const circleUpdateAutoCancelBuilds = require( '../lib/circle-update-auto-cancel-builds' );
8
+ import circleUpdateAutoCancelBuilds from '../lib/circle-update-auto-cancel-builds.js';
11
9
 
12
10
  /**
13
11
  * This script updates CircleCI settings to disable the "Auto-cancel redundant workflows" option.
@@ -5,9 +5,7 @@
5
5
  * For licensing, see LICENSE.md.
6
6
  */
7
7
 
8
- 'use strict';
9
-
10
- const circleUpdateAutoCancelBuilds = require( '../lib/circle-update-auto-cancel-builds' );
8
+ import circleUpdateAutoCancelBuilds from '../lib/circle-update-auto-cancel-builds.js';
11
9
 
12
10
  /**
13
11
  * This script updates CircleCI settings to enable the "Auto-cancel redundant workflows" option.
@@ -7,12 +7,9 @@
7
7
 
8
8
  /* eslint-env node */
9
9
 
10
- 'use strict';
11
-
12
- const { execSync } = require( 'child_process' );
13
- const fetch = require( 'node-fetch' );
14
- const minimist = require( 'minimist' );
15
- const processJobStatuses = require( '../lib/process-job-statuses' );
10
+ import { execSync } from 'child_process';
11
+ import minimist from 'minimist';
12
+ import processJobStatuses from '../lib/process-job-statuses.js';
16
13
 
17
14
  // This script allows the creation of a new job within a workflow that will be executed
18
15
  // in the end, when all other jobs will be finished or errored.
@@ -107,7 +104,12 @@ async function waitForOtherJobsAndSendNotification() {
107
104
  */
108
105
  async function getOtherJobsData() {
109
106
  const url = `https://circleci.com/api/v2/workflow/${ CIRCLE_WORKFLOW_ID }/job`;
110
- const options = { headers: { 'Circle-Token': CKE5_CIRCLE_TOKEN } };
107
+ const options = {
108
+ method: 'GET',
109
+ headers: {
110
+ 'Circle-Token': CKE5_CIRCLE_TOKEN
111
+ }
112
+ };
111
113
 
112
114
  const response = await fetch( url, options );
113
115
  const data = await response.json();
@@ -5,9 +5,7 @@
5
5
  * For licensing, see LICENSE.md.
6
6
  */
7
7
 
8
- 'use strict';
9
-
10
- const isJobTriggeredByMember = require( '../lib/is-job-triggered-by-member' );
8
+ import isJobTriggeredByMember from '../lib/is-job-triggered-by-member.js';
11
9
 
12
10
  /**
13
11
  * This script checks if a user that approved an approval job could do that.
@@ -7,9 +7,8 @@
7
7
 
8
8
  /* eslint-env node */
9
9
 
10
- const fetch = require( 'node-fetch' );
11
- const slackNotify = require( 'slack-notify' );
12
- const formatMessage = require( '../lib/format-message' );
10
+ import slackNotify from 'slack-notify';
11
+ import formatMessage from '../lib/format-message.js';
13
12
 
14
13
  // This script assumes that is being executed on Circle CI.
15
14
  // Step it is used on should have set value: `when: on_fail`, since it does not
@@ -7,8 +7,8 @@
7
7
 
8
8
  /* eslint-env node */
9
9
 
10
- const formatMessage = require( '../lib/format-message' );
11
- const slackNotify = require( 'slack-notify' );
10
+ import formatMessage from '../lib/format-message.js';
11
+ import slackNotify from 'slack-notify';
12
12
 
13
13
  const ALLOWED_BRANCHES = [
14
14
  'stable',
@@ -5,9 +5,7 @@
5
5
  * For licensing, see LICENSE.md.
6
6
  */
7
7
 
8
- 'use strict';
9
-
10
- const triggerCircleBuild = require( '../lib/trigger-circle-build' );
8
+ import triggerCircleBuild from '../lib/trigger-circle-build.js';
11
9
 
12
10
  /**
13
11
  * This script triggers a new CircleCI build.
@@ -3,10 +3,6 @@
3
3
  * For licensing, see LICENSE.md.
4
4
  */
5
5
 
6
- 'use strict';
7
-
8
- const fetch = require( 'node-fetch' );
9
-
10
6
  /**
11
7
  * @param options
12
8
  * @param {String} options.circleToken
@@ -15,7 +11,7 @@ const fetch = require( 'node-fetch' );
15
11
  * @param {Boolean} options.newValue
16
12
  * @return {Promise.<Boolean>}
17
13
  */
18
- module.exports = async function circleUpdateAutoCancelBuilds( options ) {
14
+ export default async function circleUpdateAutoCancelBuilds( options ) {
19
15
  const {
20
16
  circleToken,
21
17
  githubOrganization,
@@ -24,7 +20,7 @@ module.exports = async function circleUpdateAutoCancelBuilds( options ) {
24
20
  } = options;
25
21
 
26
22
  const circleRequestOptions = {
27
- method: 'patch',
23
+ method: 'PATCH',
28
24
  headers: {
29
25
  'Content-Type': 'application/json',
30
26
  'Circle-Token': circleToken
@@ -40,4 +36,4 @@ module.exports = async function circleUpdateAutoCancelBuilds( options ) {
40
36
 
41
37
  return fetch( settingsUpdateUrl, circleRequestOptions )
42
38
  .then( r => r.json() );
43
- };
39
+ }
@@ -0,0 +1,10 @@
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
+ import { default as _members } from './members.json' with { type: 'json' };
7
+ import { default as _bots } from './bots.json' with { type: 'json' };
8
+
9
+ export const members = _members;
10
+ export const bots = _bots;
@@ -5,11 +5,7 @@
5
5
 
6
6
  /* eslint-env node */
7
7
 
8
- 'use strict';
9
-
10
- const fetch = require( 'node-fetch' );
11
- const bots = require( './data/bots.json' );
12
- const members = require( './data/members.json' );
8
+ import { bots, members } from './data/index.js';
13
9
 
14
10
  const REPOSITORY_REGEXP = /github\.com\/([^/]+)\/([^/]+)/;
15
11
 
@@ -29,7 +25,7 @@ const REPOSITORY_REGEXP = /github\.com\/([^/]+)\/([^/]+)/;
29
25
  * @param {Number} options.endTime
30
26
  * @param {Boolean} options.shouldHideAuthor
31
27
  */
32
- module.exports = async function formatMessage( options ) {
28
+ export default async function formatMessage( options ) {
33
29
  const commitDetails = await getCommitDetails( options.triggeringCommitUrl, options.githubToken );
34
30
  const repoUrl = `https://github.com/${ options.repositoryOwner }/${ options.repositoryName }`;
35
31
 
@@ -63,7 +59,7 @@ module.exports = async function formatMessage( options ) {
63
59
  } ]
64
60
  } ]
65
61
  };
66
- };
62
+ }
67
63
 
68
64
  /**
69
65
  * Returns the additional message that will be added to the notifier post.
package/lib/index.js CHANGED
@@ -3,9 +3,5 @@
3
3
  * For licensing, see LICENSE.md.
4
4
  */
5
5
 
6
- 'use strict';
7
-
8
- module.exports = {
9
- getJobApprover: require( './utils/get-job-approver' ),
10
- members: require( './data/members.json' )
11
- };
6
+ export { default as getJobApprover } from './utils/get-job-approver.js';
7
+ export { members } from './data/index.js';
@@ -3,10 +3,8 @@
3
3
  * For licensing, see LICENSE.md.
4
4
  */
5
5
 
6
- 'use strict';
7
-
8
- const { Octokit } = require( '@octokit/rest' );
9
- const getJobApprover = require( './utils/get-job-approver' );
6
+ import { Octokit } from '@octokit/rest';
7
+ import getJobApprover from './utils/get-job-approver.js';
10
8
 
11
9
  /**
12
10
  * @param options
@@ -18,7 +16,7 @@ const getJobApprover = require( './utils/get-job-approver' );
18
16
  * @param {String} options.githubToken
19
17
  * @return {Promise.<Boolean>}
20
18
  */
21
- module.exports = async function isJobTriggeredByMember( options ) {
19
+ export default async function isJobTriggeredByMember( options ) {
22
20
  const {
23
21
  circleToken,
24
22
  circleWorkflowId,
@@ -41,4 +39,4 @@ module.exports = async function isJobTriggeredByMember( options ) {
41
39
  return data
42
40
  .map( ( { login } ) => login )
43
41
  .includes( login );
44
- };
42
+ }
@@ -3,8 +3,6 @@
3
3
  * For licensing, see LICENSE.md.
4
4
  */
5
5
 
6
- 'use strict';
7
-
8
6
  /**
9
7
  * The function aims to determine a proper build status for children's jobs based on their parent's statuses.
10
8
  *
@@ -19,7 +17,7 @@
19
17
  * @param {Array.<WorkflowJob>} jobs
20
18
  * @returns {Array.<WorkflowJob>}
21
19
  */
22
- module.exports = function processJobStatuses( jobs ) {
20
+ export default function processJobStatuses( jobs ) {
23
21
  // To avoid modifying the original object, let's clone.
24
22
  const jobsClone = clone( jobs );
25
23
 
@@ -55,7 +53,7 @@ module.exports = function processJobStatuses( jobs ) {
55
53
  }
56
54
 
57
55
  return jobsClone;
58
- };
56
+ }
59
57
 
60
58
  /**
61
59
  * @param {WorkflowJob} job
@@ -5,8 +5,6 @@
5
5
 
6
6
  /* eslint-env node */
7
7
 
8
- const fetch = require( 'node-fetch' );
9
-
10
8
  /**
11
9
  * @param options
12
10
  * @param {String} options.circleToken
@@ -17,7 +15,7 @@ const fetch = require( 'node-fetch' );
17
15
  * @param {String|null} [options.triggerRepositorySlug=null] A repository slug (org/name) that triggers a new build.
18
16
  * @return {Promise}
19
17
  */
20
- module.exports = async function triggerCircleBuild( options ) {
18
+ export default async function triggerCircleBuild( options ) {
21
19
  const {
22
20
  circleToken,
23
21
  commit,
@@ -42,7 +40,7 @@ module.exports = async function triggerCircleBuild( options ) {
42
40
  }
43
41
 
44
42
  const requestOptions = {
45
- method: 'post',
43
+ method: 'POST',
46
44
  headers: {
47
45
  'Content-Type': 'application/json',
48
46
  'Accept': 'application/json',
@@ -62,4 +60,4 @@ module.exports = async function triggerCircleBuild( options ) {
62
60
  throw new Error( `CI trigger failed: "${ response.message }".` );
63
61
  }
64
62
  } );
65
- };
63
+ }
@@ -3,10 +3,6 @@
3
3
  * For licensing, see LICENSE.md.
4
4
  */
5
5
 
6
- 'use strict';
7
-
8
- const fetch = require( 'node-fetch' );
9
-
10
6
  /**
11
7
  * Returns a promise that resolves to GitHub name of a developer who approved the `jobName` job.
12
8
  *
@@ -15,9 +11,9 @@ const fetch = require( 'node-fetch' );
15
11
  * @param {String} jobName
16
12
  * @returns {Promise.<String>}
17
13
  */
18
- module.exports = async function getJobApprover( circleCiToken, workflowId, jobName ) {
14
+ export default async function getJobApprover( circleCiToken, workflowId, jobName ) {
19
15
  const circleRequestOptions = {
20
- method: 'get',
16
+ method: 'GET',
21
17
  headers: {
22
18
  'Content-Type': 'application/json',
23
19
  'Accept': 'application/json',
@@ -35,4 +31,4 @@ module.exports = async function getJobApprover( circleCiToken, workflowId, jobNa
35
31
  const { login } = await fetch( userDetailsUrl, circleRequestOptions ).then( r => r.json() );
36
32
 
37
33
  return login;
38
- };
34
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-dev-ci",
3
- "version": "43.0.0",
3
+ "version": "44.0.0-alpha.0",
4
4
  "description": "Utils used on various Continuous Integration services.",
5
5
  "keywords": [],
6
6
  "author": "CKSource (http://cksource.com/)",
@@ -16,6 +16,7 @@
16
16
  "node": ">=18.0.0",
17
17
  "npm": ">=5.7.1"
18
18
  },
19
+ "type": "module",
19
20
  "main": "lib/index.js",
20
21
  "files": [
21
22
  "bin",
@@ -35,7 +36,6 @@
35
36
  "dependencies": {
36
37
  "@octokit/rest": "^19.0.0",
37
38
  "minimist": "^1.2.8",
38
- "node-fetch": "^2.6.7",
39
39
  "slack-notify": "^2.0.6"
40
40
  }
41
41
  }