@ckeditor/ckeditor5-dev-ci 35.0.4 → 35.0.6

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.
@@ -37,19 +37,12 @@ module.exports = async function notifyTravisStatus( options ) {
37
37
  const commitDetails = await getCommitDetails( commitUrl, options.githubToken );
38
38
 
39
39
  const [ buildRepoOwner, buildRepoName ] = options.repositorySlug.split( '/' );
40
- const execTime = getExecutionTime( options.endTime, options.startTime );
41
40
 
42
41
  const slackAccount = members[ commitDetails.author ];
43
42
  const shortCommit = commitUrl.split( '/' ).pop().substring( 0, 7 );
44
43
  const repoMatch = commitUrl.match( REPOSITORY_REGEXP );
45
44
 
46
- const slack = slackNotify( options.slackWebhookUrl );
47
-
48
- slack.onError = err => {
49
- console.log( 'API error occurred:', err );
50
- };
51
-
52
- return slack.send( {
45
+ const messageData = {
53
46
  username: 'Travis CI',
54
47
  text: getNotifierMessage( {
55
48
  slackAccount,
@@ -82,7 +75,7 @@ module.exports = async function notifyTravisStatus( options ) {
82
75
  },
83
76
  {
84
77
  title: 'Build time',
85
- value: `${ execTime.mins } min ${ execTime.secs } sec`,
78
+ value: getExecutionTime( options.endTime, options.startTime ),
86
79
  short: true
87
80
  },
88
81
  {
@@ -93,27 +86,42 @@ module.exports = async function notifyTravisStatus( options ) {
93
86
  ]
94
87
  }
95
88
  ]
96
- } );
89
+ };
90
+
91
+ return slackNotify( options.slackWebhookUrl )
92
+ .send( messageData )
93
+ .catch( err => console.log( 'API error occurred:', err ) );
97
94
  };
98
95
 
99
96
  /**
100
- * Returns an object that compares two dates.
97
+ * Returns string representing amount of time passed between two timestamps.
101
98
  *
102
99
  * @param {Number} endTime
103
100
  * @param {Number} startTime
104
- * @returns {Object}
101
+ * @returns {String}
105
102
  */
106
103
  function getExecutionTime( endTime, startTime ) {
107
- const execTime = {
108
- ms: endTime - startTime
109
- };
104
+ const totalMs = ( endTime - startTime ) * 1000;
105
+ const date = new Date( totalMs );
106
+ const hours = date.getUTCHours();
107
+ const minutes = date.getUTCMinutes();
108
+ const seconds = date.getUTCSeconds();
109
+
110
+ const stringParts = [];
111
+
112
+ if ( hours ) {
113
+ stringParts.push( `${ hours } hr.` );
114
+ }
110
115
 
111
- execTime.days = Math.floor( execTime.ms / 86400 );
112
- execTime.hours = Math.floor( ( execTime.ms - 86400 * execTime.days ) / 3600 );
113
- execTime.mins = Math.floor( ( ( execTime.ms - 86400 * execTime.days ) - 3600 * execTime.hours ) / 60 );
114
- execTime.secs = ( ( execTime.ms - 86400 * execTime.days ) - 3600 * execTime.hours ) - 60 * execTime.mins;
116
+ if ( minutes ) {
117
+ stringParts.push( `${ minutes } min.` );
118
+ }
119
+
120
+ if ( seconds ) {
121
+ stringParts.push( `${ seconds } sec.` );
122
+ }
115
123
 
116
- return execTime;
124
+ return stringParts.join( ' ' );
117
125
  }
118
126
 
119
127
  /**
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-dev-ci",
3
- "version": "35.0.4",
3
+ "version": "35.0.6",
4
4
  "description": "Utils for CKEditor5 CI builds.",
5
5
  "keywords": [],
6
6
  "dependencies": {
7
7
  "node-fetch": "^2.6.7",
8
- "slack-notify": "^0.1.7"
8
+ "slack-notify": "^2.0.6"
9
9
  },
10
10
  "engines": {
11
11
  "node": ">=14.0.0",