From 463c6d5ca0280e10c2f47976a91e3b167f1e45d2 Mon Sep 17 00:00:00 2001 From: Przemyslaw Zan Date: Wed, 13 Sep 2023 16:34:51 +0200 Subject: [PATCH 1/2] Bumped required nodejs version to 18. --- package.json | 2 +- packages/ckeditor5-dev-bump-year/package.json | 2 +- .../bin/circle-workflow-notifier.js | 1 - .../ckeditor5-dev-ci/bin/notify-circle-status.js | 1 - packages/ckeditor5-dev-ci/lib/format-message.js | 1 - packages/ckeditor5-dev-ci/package.json | 3 +-- packages/ckeditor5-dev-ci/tests/format-message.js | 15 +++++++++------ .../ckeditor5-dev-dependency-checker/package.json | 2 +- packages/ckeditor5-dev-docs/package.json | 2 +- packages/ckeditor5-dev-release-tools/package.json | 2 +- packages/ckeditor5-dev-tests/package.json | 2 +- .../lib/transifexservice.js | 3 +-- packages/ckeditor5-dev-transifex/package.json | 3 +-- .../tests/transifexservice.js | 3 +-- packages/ckeditor5-dev-translations/package.json | 2 +- packages/ckeditor5-dev-utils/package.json | 2 +- packages/ckeditor5-dev-web-crawler/package.json | 2 +- packages/jsdoc-plugins/package.json | 2 +- packages/typedoc-plugins/package.json | 2 +- 19 files changed, 24 insertions(+), 28 deletions(-) diff --git a/package.json b/package.json index 5c7a8319b..83593eaf7 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "nyc": "^15.1.0" }, "engines": { - "node": ">=16.0.0" + "node": ">=18.0.0" }, "author": "CKSource (http://cksource.com/)", "license": "GPL-2.0-or-later", diff --git a/packages/ckeditor5-dev-bump-year/package.json b/packages/ckeditor5-dev-bump-year/package.json index 81d8f4ff6..aad0f07fd 100644 --- a/packages/ckeditor5-dev-bump-year/package.json +++ b/packages/ckeditor5-dev-bump-year/package.json @@ -9,7 +9,7 @@ "glob": "^10.2.5" }, "engines": { - "node": ">=16.0.0", + "node": ">=18.0.0", "npm": ">=5.7.1" }, "files": [ diff --git a/packages/ckeditor5-dev-ci/bin/circle-workflow-notifier.js b/packages/ckeditor5-dev-ci/bin/circle-workflow-notifier.js index 094c0ecb4..5e097fe9c 100755 --- a/packages/ckeditor5-dev-ci/bin/circle-workflow-notifier.js +++ b/packages/ckeditor5-dev-ci/bin/circle-workflow-notifier.js @@ -10,7 +10,6 @@ 'use strict'; const { execSync } = require( 'child_process' ); -const fetch = require( 'node-fetch' ); const minimist = require( 'minimist' ); const processJobStatuses = require( '../lib/process-job-statuses' ); diff --git a/packages/ckeditor5-dev-ci/bin/notify-circle-status.js b/packages/ckeditor5-dev-ci/bin/notify-circle-status.js index 062d746e3..ab7364e8b 100755 --- a/packages/ckeditor5-dev-ci/bin/notify-circle-status.js +++ b/packages/ckeditor5-dev-ci/bin/notify-circle-status.js @@ -7,7 +7,6 @@ /* eslint-env node */ -const fetch = require( 'node-fetch' ); const slackNotify = require( 'slack-notify' ); const formatMessage = require( '../lib/format-message' ); diff --git a/packages/ckeditor5-dev-ci/lib/format-message.js b/packages/ckeditor5-dev-ci/lib/format-message.js index ffdff6b70..268a798fd 100644 --- a/packages/ckeditor5-dev-ci/lib/format-message.js +++ b/packages/ckeditor5-dev-ci/lib/format-message.js @@ -7,7 +7,6 @@ 'use strict'; -const fetch = require( 'node-fetch' ); const bots = require( './data/bots.json' ); const members = require( './data/members.json' ); diff --git a/packages/ckeditor5-dev-ci/package.json b/packages/ckeditor5-dev-ci/package.json index 8eaa1bad7..f105b100f 100644 --- a/packages/ckeditor5-dev-ci/package.json +++ b/packages/ckeditor5-dev-ci/package.json @@ -5,7 +5,6 @@ "keywords": [], "dependencies": { "minimist": "^1.2.5", - "node-fetch": "^2.6.7", "slack-notify": "^2.0.6" }, "devDependencies": { @@ -14,7 +13,7 @@ "sinon": "^9.2.4" }, "engines": { - "node": ">=16.0.0", + "node": ">=18.0.0", "npm": ">=5.7.1" }, "files": [ diff --git a/packages/ckeditor5-dev-ci/tests/format-message.js b/packages/ckeditor5-dev-ci/tests/format-message.js index a4f48c954..0c5af26f6 100644 --- a/packages/ckeditor5-dev-ci/tests/format-message.js +++ b/packages/ckeditor5-dev-ci/tests/format-message.js @@ -16,24 +16,27 @@ describe( 'lib/format-message', () => { beforeEach( () => { stubs = { - nodeFetch: sinon.stub() + fetch: sinon.stub( global, 'fetch' ) }; formatMessage = proxyquire( '../lib/format-message', { - 'node-fetch': stubs.nodeFetch, './data/members.json': { ExampleNick: 'slackId' } } ); } ); + afterEach( () => { + sinon.restore(); + } ); + describe( 'formatMessage()', () => { it( 'should be a function', () => { expect( formatMessage ).to.be.a( 'function' ); } ); it( 'should display a message for bot if a login is included in the "bots" array', async () => { - stubs.nodeFetch.resolves( { + stubs.fetch.resolves( { json() { return Promise.resolve( { author: { @@ -72,7 +75,7 @@ describe( 'lib/format-message', () => { } ); it( 'should display a message for bot if a login is unavailable but author name is included in the "bots" array', async () => { - stubs.nodeFetch.resolves( { + stubs.fetch.resolves( { json() { return Promise.resolve( { author: null, @@ -109,7 +112,7 @@ describe( 'lib/format-message', () => { } ); it( 'should mention the channel if a login is unavailable and author name is not included in the "bots" array', async () => { - stubs.nodeFetch.resolves( { + stubs.fetch.resolves( { json() { return Promise.resolve( { author: null, @@ -146,7 +149,7 @@ describe( 'lib/format-message', () => { } ); it( 'should find a Slack account based on a GitHub account case-insensitive', async () => { - stubs.nodeFetch.resolves( { + stubs.fetch.resolves( { json() { return Promise.resolve( { author: { diff --git a/packages/ckeditor5-dev-dependency-checker/package.json b/packages/ckeditor5-dev-dependency-checker/package.json index 559d2331e..c5c7ae75f 100644 --- a/packages/ckeditor5-dev-dependency-checker/package.json +++ b/packages/ckeditor5-dev-dependency-checker/package.json @@ -12,7 +12,7 @@ "upath": "^2.0.1" }, "engines": { - "node": ">=16.0.0", + "node": ">=18.0.0", "npm": ">=5.7.1" }, "files": [ diff --git a/packages/ckeditor5-dev-docs/package.json b/packages/ckeditor5-dev-docs/package.json index 710e8be88..871d45627 100644 --- a/packages/ckeditor5-dev-docs/package.json +++ b/packages/ckeditor5-dev-docs/package.json @@ -21,7 +21,7 @@ "sinon": "^9.2.4" }, "engines": { - "node": ">=16.0.0", + "node": ">=18.0.0", "npm": ">=5.7.1" }, "files": [ diff --git a/packages/ckeditor5-dev-release-tools/package.json b/packages/ckeditor5-dev-release-tools/package.json index 46007f46e..e84254356 100644 --- a/packages/ckeditor5-dev-release-tools/package.json +++ b/packages/ckeditor5-dev-release-tools/package.json @@ -37,7 +37,7 @@ "strip-ansi": "^6.0.0" }, "engines": { - "node": ">=16.0.0", + "node": ">=18.0.0", "npm": ">=5.7.1" }, "files": [ diff --git a/packages/ckeditor5-dev-tests/package.json b/packages/ckeditor5-dev-tests/package.json index d0a660091..4abd60288 100644 --- a/packages/ckeditor5-dev-tests/package.json +++ b/packages/ckeditor5-dev-tests/package.json @@ -57,7 +57,7 @@ "proxyquire": "^2.1.3" }, "engines": { - "node": ">=16.0.0", + "node": ">=18.0.0", "npm": ">=5.7.1" }, "files": [ diff --git a/packages/ckeditor5-dev-transifex/lib/transifexservice.js b/packages/ckeditor5-dev-transifex/lib/transifexservice.js index 65c00cd5c..3370585ac 100644 --- a/packages/ckeditor5-dev-transifex/lib/transifexservice.js +++ b/packages/ckeditor5-dev-transifex/lib/transifexservice.js @@ -4,7 +4,6 @@ */ const { transifexApi } = require( '@transifex/api' ); -const fetch = require( 'node-fetch' ); const MAX_REQUEST_ATTEMPTS = 10; const REQUEST_RETRY_TIMEOUT = 3000; // In milliseconds. @@ -321,7 +320,7 @@ function createDownloadRequest( resource, language, numberOfAttempts = 1 ) { * attempt. There are three possible cases that are handled during downloading a file: * * (1) According to the Transifex API v3.0, when the requested file is ready for download, the Transifex service returns HTTP code 303, - * which is the redirection to the new location, where the file is available. By default, `node-fetch` follows redirections so the requested + * which is the redirection to the new location, where the file is available. By default, `fetch` follows redirections so the requested * file is downloaded automatically. * (2) If the requested file is not ready yet, but the response status from the Transifex service was successful and the number of retries * has not reached the limit yet, the request is queued and retried after the REQUEST_RETRY_TIMEOUT timeout. diff --git a/packages/ckeditor5-dev-transifex/package.json b/packages/ckeditor5-dev-transifex/package.json index 8888ef33e..6888f247e 100644 --- a/packages/ckeditor5-dev-transifex/package.json +++ b/packages/ckeditor5-dev-transifex/package.json @@ -12,7 +12,6 @@ "chalk": "^4.0.0", "inquirer": "^7.1.0", "@transifex/api": "^4.2.1", - "node-fetch": "^2.6.7", "cli-table": "^0.3.1" }, "devDependencies": { @@ -22,7 +21,7 @@ "sinon": "^9.2.4" }, "engines": { - "node": ">=16.0.0", + "node": ">=18.0.0", "npm": ">=5.7.1" }, "files": [ diff --git a/packages/ckeditor5-dev-transifex/tests/transifexservice.js b/packages/ckeditor5-dev-transifex/tests/transifexservice.js index 39cc7e6ff..fc32a81ea 100644 --- a/packages/ckeditor5-dev-transifex/tests/transifexservice.js +++ b/packages/ckeditor5-dev-transifex/tests/transifexservice.js @@ -113,11 +113,10 @@ describe( 'dev-transifex/transifex-service', () => { } }, - fetch: sinon.stub() + fetch: sinon.stub( global, 'fetch' ) }; mockery.registerMock( '@transifex/api', { transifexApi: stubs.transifexApi } ); - mockery.registerMock( 'node-fetch', stubs.fetch ); transifexService = require( '../lib/transifexservice' ); } ); diff --git a/packages/ckeditor5-dev-translations/package.json b/packages/ckeditor5-dev-translations/package.json index e6e52d2cb..48cdbc933 100644 --- a/packages/ckeditor5-dev-translations/package.json +++ b/packages/ckeditor5-dev-translations/package.json @@ -18,7 +18,7 @@ "sinon": "^9.2.4" }, "engines": { - "node": ">=16.0.0", + "node": ">=18.0.0", "npm": ">=5.7.1" }, "files": [ diff --git a/packages/ckeditor5-dev-utils/package.json b/packages/ckeditor5-dev-utils/package.json index 8adda67ed..fa8968b90 100644 --- a/packages/ckeditor5-dev-utils/package.json +++ b/packages/ckeditor5-dev-utils/package.json @@ -35,7 +35,7 @@ "vinyl": "^2.1.0" }, "engines": { - "node": ">=16.0.0", + "node": ">=18.0.0", "npm": ">=5.7.1" }, "files": [ diff --git a/packages/ckeditor5-dev-web-crawler/package.json b/packages/ckeditor5-dev-web-crawler/package.json index 69d4b73f3..b8661e754 100644 --- a/packages/ckeditor5-dev-web-crawler/package.json +++ b/packages/ckeditor5-dev-web-crawler/package.json @@ -11,7 +11,7 @@ "strip-ansi": "^6.0.0" }, "engines": { - "node": ">=16.0.0", + "node": ">=18.0.0", "npm": ">=5.7.1" }, "files": [ diff --git a/packages/jsdoc-plugins/package.json b/packages/jsdoc-plugins/package.json index 614d472fa..cde8545d2 100644 --- a/packages/jsdoc-plugins/package.json +++ b/packages/jsdoc-plugins/package.json @@ -24,7 +24,7 @@ "tmp": "^0.2.1" }, "engines": { - "node": ">=16.0.0", + "node": ">=18.0.0", "npm": ">=5.7.1" }, "files": [ diff --git a/packages/typedoc-plugins/package.json b/packages/typedoc-plugins/package.json index 9bcd85a53..76823761a 100644 --- a/packages/typedoc-plugins/package.json +++ b/packages/typedoc-plugins/package.json @@ -12,7 +12,7 @@ "typedoc": "^0.23.15" }, "engines": { - "node": ">=16.0.0", + "node": ">=18.0.0", "npm": ">=5.7.1" }, "files": [ From 808ad5e1f8e61262e1b824727cef850c741fc45a Mon Sep 17 00:00:00 2001 From: Przemyslaw Zan Date: Thu, 14 Sep 2023 10:37:34 +0200 Subject: [PATCH 2/2] Reverted node-fetch removal. --- .../bin/circle-workflow-notifier.js | 1 + .../ckeditor5-dev-ci/bin/notify-circle-status.js | 1 + packages/ckeditor5-dev-ci/lib/format-message.js | 1 + packages/ckeditor5-dev-ci/package.json | 1 + packages/ckeditor5-dev-ci/tests/format-message.js | 15 ++++++--------- .../lib/transifexservice.js | 3 ++- packages/ckeditor5-dev-transifex/package.json | 1 + .../tests/transifexservice.js | 3 ++- 8 files changed, 15 insertions(+), 11 deletions(-) diff --git a/packages/ckeditor5-dev-ci/bin/circle-workflow-notifier.js b/packages/ckeditor5-dev-ci/bin/circle-workflow-notifier.js index 5e097fe9c..094c0ecb4 100755 --- a/packages/ckeditor5-dev-ci/bin/circle-workflow-notifier.js +++ b/packages/ckeditor5-dev-ci/bin/circle-workflow-notifier.js @@ -10,6 +10,7 @@ 'use strict'; const { execSync } = require( 'child_process' ); +const fetch = require( 'node-fetch' ); const minimist = require( 'minimist' ); const processJobStatuses = require( '../lib/process-job-statuses' ); diff --git a/packages/ckeditor5-dev-ci/bin/notify-circle-status.js b/packages/ckeditor5-dev-ci/bin/notify-circle-status.js index ab7364e8b..062d746e3 100755 --- a/packages/ckeditor5-dev-ci/bin/notify-circle-status.js +++ b/packages/ckeditor5-dev-ci/bin/notify-circle-status.js @@ -7,6 +7,7 @@ /* eslint-env node */ +const fetch = require( 'node-fetch' ); const slackNotify = require( 'slack-notify' ); const formatMessage = require( '../lib/format-message' ); diff --git a/packages/ckeditor5-dev-ci/lib/format-message.js b/packages/ckeditor5-dev-ci/lib/format-message.js index 268a798fd..ffdff6b70 100644 --- a/packages/ckeditor5-dev-ci/lib/format-message.js +++ b/packages/ckeditor5-dev-ci/lib/format-message.js @@ -7,6 +7,7 @@ 'use strict'; +const fetch = require( 'node-fetch' ); const bots = require( './data/bots.json' ); const members = require( './data/members.json' ); diff --git a/packages/ckeditor5-dev-ci/package.json b/packages/ckeditor5-dev-ci/package.json index f105b100f..c05df2e99 100644 --- a/packages/ckeditor5-dev-ci/package.json +++ b/packages/ckeditor5-dev-ci/package.json @@ -5,6 +5,7 @@ "keywords": [], "dependencies": { "minimist": "^1.2.5", + "node-fetch": "^2.6.7", "slack-notify": "^2.0.6" }, "devDependencies": { diff --git a/packages/ckeditor5-dev-ci/tests/format-message.js b/packages/ckeditor5-dev-ci/tests/format-message.js index 0c5af26f6..a4f48c954 100644 --- a/packages/ckeditor5-dev-ci/tests/format-message.js +++ b/packages/ckeditor5-dev-ci/tests/format-message.js @@ -16,27 +16,24 @@ describe( 'lib/format-message', () => { beforeEach( () => { stubs = { - fetch: sinon.stub( global, 'fetch' ) + nodeFetch: sinon.stub() }; formatMessage = proxyquire( '../lib/format-message', { + 'node-fetch': stubs.nodeFetch, './data/members.json': { ExampleNick: 'slackId' } } ); } ); - afterEach( () => { - sinon.restore(); - } ); - describe( 'formatMessage()', () => { it( 'should be a function', () => { expect( formatMessage ).to.be.a( 'function' ); } ); it( 'should display a message for bot if a login is included in the "bots" array', async () => { - stubs.fetch.resolves( { + stubs.nodeFetch.resolves( { json() { return Promise.resolve( { author: { @@ -75,7 +72,7 @@ describe( 'lib/format-message', () => { } ); it( 'should display a message for bot if a login is unavailable but author name is included in the "bots" array', async () => { - stubs.fetch.resolves( { + stubs.nodeFetch.resolves( { json() { return Promise.resolve( { author: null, @@ -112,7 +109,7 @@ describe( 'lib/format-message', () => { } ); it( 'should mention the channel if a login is unavailable and author name is not included in the "bots" array', async () => { - stubs.fetch.resolves( { + stubs.nodeFetch.resolves( { json() { return Promise.resolve( { author: null, @@ -149,7 +146,7 @@ describe( 'lib/format-message', () => { } ); it( 'should find a Slack account based on a GitHub account case-insensitive', async () => { - stubs.fetch.resolves( { + stubs.nodeFetch.resolves( { json() { return Promise.resolve( { author: { diff --git a/packages/ckeditor5-dev-transifex/lib/transifexservice.js b/packages/ckeditor5-dev-transifex/lib/transifexservice.js index 3370585ac..65c00cd5c 100644 --- a/packages/ckeditor5-dev-transifex/lib/transifexservice.js +++ b/packages/ckeditor5-dev-transifex/lib/transifexservice.js @@ -4,6 +4,7 @@ */ const { transifexApi } = require( '@transifex/api' ); +const fetch = require( 'node-fetch' ); const MAX_REQUEST_ATTEMPTS = 10; const REQUEST_RETRY_TIMEOUT = 3000; // In milliseconds. @@ -320,7 +321,7 @@ function createDownloadRequest( resource, language, numberOfAttempts = 1 ) { * attempt. There are three possible cases that are handled during downloading a file: * * (1) According to the Transifex API v3.0, when the requested file is ready for download, the Transifex service returns HTTP code 303, - * which is the redirection to the new location, where the file is available. By default, `fetch` follows redirections so the requested + * which is the redirection to the new location, where the file is available. By default, `node-fetch` follows redirections so the requested * file is downloaded automatically. * (2) If the requested file is not ready yet, but the response status from the Transifex service was successful and the number of retries * has not reached the limit yet, the request is queued and retried after the REQUEST_RETRY_TIMEOUT timeout. diff --git a/packages/ckeditor5-dev-transifex/package.json b/packages/ckeditor5-dev-transifex/package.json index 6888f247e..02ee3da27 100644 --- a/packages/ckeditor5-dev-transifex/package.json +++ b/packages/ckeditor5-dev-transifex/package.json @@ -12,6 +12,7 @@ "chalk": "^4.0.0", "inquirer": "^7.1.0", "@transifex/api": "^4.2.1", + "node-fetch": "^2.6.7", "cli-table": "^0.3.1" }, "devDependencies": { diff --git a/packages/ckeditor5-dev-transifex/tests/transifexservice.js b/packages/ckeditor5-dev-transifex/tests/transifexservice.js index fc32a81ea..39cc7e6ff 100644 --- a/packages/ckeditor5-dev-transifex/tests/transifexservice.js +++ b/packages/ckeditor5-dev-transifex/tests/transifexservice.js @@ -113,10 +113,11 @@ describe( 'dev-transifex/transifex-service', () => { } }, - fetch: sinon.stub( global, 'fetch' ) + fetch: sinon.stub() }; mockery.registerMock( '@transifex/api', { transifexApi: stubs.transifexApi } ); + mockery.registerMock( 'node-fetch', stubs.fetch ); transifexService = require( '../lib/transifexservice' ); } );