From 00941987e0bd6881074cbc828e68968f911baa00 Mon Sep 17 00:00:00 2001 From: Ivo Murrell Date: Tue, 15 Oct 2024 16:58:28 +0100 Subject: [PATCH 1/3] build: bump TypeScript config to Node 18 versions --- core/cli/package.json | 1 - lib/wait-for-ok/package.json | 1 - package-lock.json | 63 +++++++++++++++++------------------- package.json | 4 +-- 4 files changed, 31 insertions(+), 38 deletions(-) diff --git a/core/cli/package.json b/core/cli/package.json index 44952c687..5da03b174 100644 --- a/core/cli/package.json +++ b/core/cli/package.json @@ -22,7 +22,6 @@ "devDependencies": { "@jest/globals": "^27.4.6", "@types/lodash": "^4.14.185", - "@types/node": "^16.18.23", "chai": "^4.3.4", "globby": "^10.0.2", "ts-node": "^8.10.2", diff --git a/lib/wait-for-ok/package.json b/lib/wait-for-ok/package.json index c86c62173..5d6f44624 100644 --- a/lib/wait-for-ok/package.json +++ b/lib/wait-for-ok/package.json @@ -21,7 +21,6 @@ "bugs": "https://github.com/financial-times/dotcom-tool-kit/issues", "homepage": "https://github.com/financial-times/dotcom-tool-kit/tree/main/lib/wait-for-ok", "devDependencies": { - "@types/node": "^16.18.23", "@types/node-fetch": "^2.5.10", "winston": "^3.5.1" }, diff --git a/package-lock.json b/package-lock.json index 40e8609f8..d629d486e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,9 +23,9 @@ "@commitlint/config-conventional": "^16.0.0", "@dotcom-reliability-kit/eslint-config": "^2.0.0", "@financial-times/eslint-config-next": "^6.0.0", - "@tsconfig/node16": "^1.0.3", + "@tsconfig/node18": "^18.2.4", "@types/jest": "^27.4.0", - "@types/node": "^16.18.23", + "@types/node": "^18.19.55", "@typescript-eslint/eslint-plugin": "^5.57.0", "@typescript-eslint/parser": "^5.57.0", "check-engines": "^1.5.0", @@ -50,7 +50,7 @@ }, "core/cli": { "name": "dotcom-tool-kit", - "version": "4.0.2", + "version": "4.0.5", "license": "MIT", "dependencies": { "@dotcom-tool-kit/base": "^1.0.0", @@ -76,7 +76,6 @@ "devDependencies": { "@jest/globals": "^27.4.6", "@types/lodash": "^4.14.185", - "@types/node": "^16.18.23", "chai": "^4.3.4", "globby": "^10.0.2", "ts-node": "^8.10.2", @@ -88,12 +87,6 @@ "npm": "7.x || 8.x || 9.x || 10.x" } }, - "core/cli/node_modules/@types/node": { - "version": "17.0.45", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.45.tgz", - "integrity": "sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==", - "dev": true - }, "core/cli/node_modules/globby": { "version": "10.0.2", "dev": true, @@ -141,7 +134,7 @@ }, "core/create": { "name": "@dotcom-tool-kit/create", - "version": "4.0.2", + "version": "4.0.5", "license": "ISC", "dependencies": { "@aws-sdk/client-iam": "^3.282.0", @@ -177,7 +170,7 @@ "@types/node-fetch": "^2.6.2", "@types/pacote": "^11.1.3", "@types/prompts": "^2.0.14", - "dotcom-tool-kit": "^4.0.2", + "dotcom-tool-kit": "^4.0.5", "type-fest": "^3.13.1" }, "engines": { @@ -995,9 +988,9 @@ } }, "core/create/node_modules/@types/node": { - "version": "12.20.55", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", - "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==", + "version": "16.18.113", + "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.113.tgz", + "integrity": "sha512-4jHxcEzSXpF1cBNxogs5FVbVSFSKo50sFCn7Xg7vmjJTbWFWgeuHW3QnoINlfmfG++MFR/q97RZE5RQXKeT+jg==", "dev": true }, "core/create/node_modules/code-suggester": { @@ -1092,6 +1085,7 @@ }, "core/sandbox": { "version": "1.0.0", + "extraneous": true, "license": "ISC", "workspaces": [ "packages/*" @@ -1462,7 +1456,6 @@ "tslib": "^2.3.1" }, "devDependencies": { - "@types/node": "^16.18.23", "@types/node-fetch": "^2.5.10", "winston": "^3.5.1" }, @@ -1471,12 +1464,6 @@ "npm": "7.x || 8.x || 9.x || 10.x" } }, - "lib/wait-for-ok/node_modules/@types/node": { - "version": "12.20.55", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", - "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==", - "dev": true - }, "lib/wait-for-ok/node_modules/tslib": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", @@ -6542,10 +6529,6 @@ "resolved": "plugins/package-json-hook", "link": true }, - "node_modules/@dotcom-tool-kit/parallel": { - "resolved": "plugins/parallel", - "link": true - }, "node_modules/@dotcom-tool-kit/plugin": { "resolved": "lib/plugin", "link": true @@ -10153,6 +10136,12 @@ "integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==", "devOptional": true }, + "node_modules/@tsconfig/node18": { + "version": "18.2.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node18/-/node18-18.2.4.tgz", + "integrity": "sha512-5xxU8vVs9/FNcvm3gE07fPbn9tl6tqGGWA9tSlwsUEkBxtRnTsNmwrV8gasZ9F/EobaSv9+nu8AxUKccw77JpQ==", + "dev": true + }, "node_modules/@types/babel__core": { "version": "7.20.5", "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", @@ -10335,9 +10324,12 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "16.18.23", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.23.tgz", - "integrity": "sha512-XAMpaw1s1+6zM+jn2tmw8MyaRDIJfXxqmIQIS0HfoGYPuf7dUWeiUKopwq13KFX9lEp1+THGtlaaYx39Nxr58g==" + "version": "18.19.55", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.55.tgz", + "integrity": "sha512-zzw5Vw52205Zr/nmErSEkN5FLqXPuKX/k5d1D7RKHATGqU7y6YfX9QxZraUzUrFGqH6XzOzG196BC35ltJC4Cw==", + "dependencies": { + "undici-types": "~5.26.4" + } }, "node_modules/@types/node-fetch": { "version": "2.6.2", @@ -25756,10 +25748,6 @@ "version": "2.1.2", "license": "MIT" }, - "node_modules/sandbox": { - "resolved": "core/sandbox", - "link": true - }, "node_modules/sax": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.1.tgz", @@ -28804,6 +28792,11 @@ "dev": true, "license": "MIT" }, + "node_modules/undici-types": { + "version": "5.26.5", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", + "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" + }, "node_modules/uni-global": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/uni-global/-/uni-global-1.0.0.tgz", @@ -32554,7 +32547,9 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", "integrity": "sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==" }, - "plugins/parallel": {}, + "plugins/parallel": { + "extraneous": true + }, "plugins/prettier": { "name": "@dotcom-tool-kit/prettier", "version": "4.0.2", diff --git a/package.json b/package.json index 54bd3bf64..c1e16e4af 100644 --- a/package.json +++ b/package.json @@ -24,9 +24,9 @@ "@commitlint/config-conventional": "^16.0.0", "@dotcom-reliability-kit/eslint-config": "^2.0.0", "@financial-times/eslint-config-next": "^6.0.0", - "@tsconfig/node16": "^1.0.3", + "@tsconfig/node18": "^18.2.4", "@types/jest": "^27.4.0", - "@types/node": "^16.18.23", + "@types/node": "^18.19.55", "@typescript-eslint/eslint-plugin": "^5.57.0", "@typescript-eslint/parser": "^5.57.0", "check-engines": "^1.5.0", From e705608bdb4f92b1656352677a790ec138832ec0 Mon Sep 17 00:00:00 2001 From: Ivo Murrell Date: Tue, 15 Oct 2024 16:59:46 +0100 Subject: [PATCH 2/3] feat(wait-for-ok): use native fetch instead of node-fetch --- lib/wait-for-ok/package.json | 2 -- lib/wait-for-ok/src/index.ts | 5 ++--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/wait-for-ok/package.json b/lib/wait-for-ok/package.json index 5d6f44624..4d23b7d56 100644 --- a/lib/wait-for-ok/package.json +++ b/lib/wait-for-ok/package.json @@ -10,7 +10,6 @@ "author": "FT.com Platforms Team ", "license": "ISC", "dependencies": { - "node-fetch": "^2.6.8", "tslib": "^2.3.1" }, "repository": { @@ -21,7 +20,6 @@ "bugs": "https://github.com/financial-times/dotcom-tool-kit/issues", "homepage": "https://github.com/financial-times/dotcom-tool-kit/tree/main/lib/wait-for-ok", "devDependencies": { - "@types/node-fetch": "^2.5.10", "winston": "^3.5.1" }, "files": [ diff --git a/lib/wait-for-ok/src/index.ts b/lib/wait-for-ok/src/index.ts index 47e63fc9a..f49c2c68a 100644 --- a/lib/wait-for-ok/src/index.ts +++ b/lib/wait-for-ok/src/index.ts @@ -1,4 +1,3 @@ -import fetch, { FetchError } from 'node-fetch' import type { Logger } from 'winston' const TWO_MINUTES = 2 * 60 * 1000 @@ -9,7 +8,7 @@ function waitForOk(logger: Logger, url: string): Promise { logger.info(`⏳ polling: ${url}`) try { - const response = await fetch(url, { timeout: 2000, follow: 0 }) + const response = await fetch(url, { signal: AbortSignal.timeout(2000), redirect: 'error' }) if (response.ok) { logger.info(`✅ ${url} ok!`) @@ -21,7 +20,7 @@ function waitForOk(logger: Logger, url: string): Promise { `❌ ${url} not ok, it's responding with status of ${response.status}, response.ok: ${response.ok}` ) } catch (err) { - if (err instanceof FetchError && err.type && err.type === 'request-timeout') { + if (err instanceof DOMException && err.name === 'TimeoutError') { logger.warn(`👋 Hey, ${url} doesn't seem to be responding yet, so there's that.`) logger.warn("You're amazing, by the way. I don't say that often enough. But you really are.") } else { From 40e6dfd48b4ae456c66b47804948b17a5d9eb514 Mon Sep 17 00:00:00 2001 From: Ivo Murrell Date: Wed, 16 Oct 2024 16:44:45 +0100 Subject: [PATCH 3/3] fix(heroku): bump octokit dependencies These no longer rely on node-fetch and use the global fetch by default. --- package-lock.json | 99 ++++++++++++++++++++----------------- plugins/heroku/package.json | 4 +- 2 files changed, 56 insertions(+), 47 deletions(-) diff --git a/package-lock.json b/package-lock.json index d629d486e..36fbaccab 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1452,11 +1452,9 @@ "version": "4.0.0", "license": "ISC", "dependencies": { - "node-fetch": "^2.6.8", "tslib": "^2.3.1" }, "devDependencies": { - "@types/node-fetch": "^2.5.10", "winston": "^3.5.1" }, "engines": { @@ -9276,15 +9274,6 @@ "@octokit/openapi-types": "^14.0.0" } }, - "node_modules/@octokit/endpoint": { - "version": "6.0.12", - "license": "MIT", - "dependencies": { - "@octokit/types": "^6.0.3", - "is-plain-object": "^5.0.0", - "universal-user-agent": "^6.0.0" - } - }, "node_modules/@octokit/graphql": { "version": "5.0.4", "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-5.0.4.tgz", @@ -9353,10 +9342,6 @@ "@octokit/openapi-types": "^14.0.0" } }, - "node_modules/@octokit/openapi-types": { - "version": "11.2.0", - "license": "MIT" - }, "node_modules/@octokit/plugin-paginate-rest": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-5.0.1.tgz", @@ -9420,27 +9405,6 @@ "@octokit/openapi-types": "^14.0.0" } }, - "node_modules/@octokit/request": { - "version": "5.6.3", - "license": "MIT", - "dependencies": { - "@octokit/endpoint": "^6.0.1", - "@octokit/request-error": "^2.1.0", - "@octokit/types": "^6.16.1", - "is-plain-object": "^5.0.0", - "node-fetch": "^2.6.7", - "universal-user-agent": "^6.0.0" - } - }, - "node_modules/@octokit/request-error": { - "version": "2.1.0", - "license": "MIT", - "dependencies": { - "@octokit/types": "^6.0.3", - "deprecation": "^2.0.0", - "once": "^1.4.0" - } - }, "node_modules/@octokit/rest": { "version": "19.0.5", "resolved": "https://registry.npmjs.org/@octokit/rest/-/rest-19.0.5.tgz", @@ -9455,13 +9419,6 @@ "node": ">= 14" } }, - "node_modules/@octokit/types": { - "version": "6.34.0", - "license": "MIT", - "dependencies": { - "@octokit/openapi-types": "^11.2.0" - } - }, "node_modules/@quarterto/parse-makefile-rules": { "version": "1.1.0" }, @@ -31754,8 +31711,8 @@ "@dotcom-tool-kit/package-json-hook": "^5.0.2", "@dotcom-tool-kit/state": "^4.0.0", "@dotcom-tool-kit/wait-for-ok": "^4.0.0", - "@octokit/request": "^5.6.0", - "@octokit/request-error": "^2.1.0", + "@octokit/request": "^8.4.0", + "@octokit/request-error": "^5.1.0", "heroku-client": "^3.1.0", "p-retry": "^4.5.0", "superagent": "^6.1.0", @@ -31775,6 +31732,58 @@ "dotcom-tool-kit": "4.x" } }, + "plugins/heroku/node_modules/@octokit/endpoint": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-9.0.5.tgz", + "integrity": "sha512-ekqR4/+PCLkEBF6qgj8WqJfvDq65RH85OAgrtnVp1mSxaXF03u2xW/hUdweGS5654IlC0wkNYC18Z50tSYTAFw==", + "dependencies": { + "@octokit/types": "^13.1.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "plugins/heroku/node_modules/@octokit/openapi-types": { + "version": "22.2.0", + "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-22.2.0.tgz", + "integrity": "sha512-QBhVjcUa9W7Wwhm6DBFu6ZZ+1/t/oYxqc2tp81Pi41YNuJinbFRx8B133qVOrAaBbF7D/m0Et6f9/pZt9Rc+tg==" + }, + "plugins/heroku/node_modules/@octokit/request": { + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/@octokit/request/-/request-8.4.0.tgz", + "integrity": "sha512-9Bb014e+m2TgBeEJGEbdplMVWwPmL1FPtggHQRkV+WVsMggPtEkLKPlcVYm/o8xKLkpJ7B+6N8WfQMtDLX2Dpw==", + "dependencies": { + "@octokit/endpoint": "^9.0.1", + "@octokit/request-error": "^5.1.0", + "@octokit/types": "^13.1.0", + "universal-user-agent": "^6.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "plugins/heroku/node_modules/@octokit/request-error": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-5.1.0.tgz", + "integrity": "sha512-GETXfE05J0+7H2STzekpKObFe765O5dlAKUTLNGeH+x47z7JjXHfsHKo5z21D/o/IOZTUEI6nyWyR+bZVP/n5Q==", + "dependencies": { + "@octokit/types": "^13.1.0", + "deprecation": "^2.0.0", + "once": "^1.4.0" + }, + "engines": { + "node": ">= 18" + } + }, + "plugins/heroku/node_modules/@octokit/types": { + "version": "13.6.1", + "resolved": "https://registry.npmjs.org/@octokit/types/-/types-13.6.1.tgz", + "integrity": "sha512-PHZE9Z+kWXb23Ndik8MKPirBPziOc0D2/3KH1P+6jK5nGWe96kadZuE4jev2/Jq7FvIfTlT2Ltg8Fv2x1v0a5g==", + "dependencies": { + "@octokit/openapi-types": "^22.2.0" + } + }, "plugins/heroku/node_modules/tslib": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", diff --git a/plugins/heroku/package.json b/plugins/heroku/package.json index 68490ee62..f7ffb4344 100644 --- a/plugins/heroku/package.json +++ b/plugins/heroku/package.json @@ -19,8 +19,8 @@ "@dotcom-tool-kit/package-json-hook": "^5.0.2", "@dotcom-tool-kit/state": "^4.0.0", "@dotcom-tool-kit/wait-for-ok": "^4.0.0", - "@octokit/request": "^5.6.0", - "@octokit/request-error": "^2.1.0", + "@octokit/request": "^8.4.0", + "@octokit/request-error": "^5.1.0", "heroku-client": "^3.1.0", "p-retry": "^4.5.0", "superagent": "^6.1.0",