From f8dd3ea4ade8842a8644dff538a7f2e8b3aa0c00 Mon Sep 17 00:00:00 2001 From: Austin Kelleher Date: Sun, 19 Feb 2023 10:17:35 -0500 Subject: [PATCH 1/3] fix: switch to undici for requests to fix stream close errors When updating WPT resources, the `wpt` command would sometimes throw a `ERR_STREAM_PREMATURE_CLOSE` error. Switching to `undici` fixes this issue. The `undici` `fetch` function is only supported on Node 16+. After discussing with the team, we agreed that dropping support for Node 14 in this tool was acceptable. --- .github/workflows/nodejs.yml | 2 +- lib/request.js | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index d0fb4023..1e903ed4 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -26,7 +26,7 @@ jobs: strategy: fail-fast: false matrix: - node-version: [14.x, 16.x, 18.x] + node-version: [16.x, 18.x] os: [ubuntu-latest, macOS-latest, windows-latest] runs-on: ${{ matrix.os }} steps: diff --git a/lib/request.js b/lib/request.js index 6002da6f..e15d3904 100644 --- a/lib/request.js +++ b/lib/request.js @@ -1,6 +1,6 @@ import fs from 'node:fs'; -import fetch from 'node-fetch'; +import { fetch } from 'undici'; import { CI_DOMAIN } from './ci/ci_type_parser.js'; import proxy from './proxy.js'; diff --git a/package.json b/package.json index 63728c34..c2a69f0f 100644 --- a/package.json +++ b/package.json @@ -46,11 +46,11 @@ "listr2": "^4.0.5", "lodash": "^4.17.21", "log-symbols": "^5.1.0", - "node-fetch": "^3.2.4", "ora": "^6.1.0", "proxy-agent": "^5.0.0", "replace-in-file": "^6.3.2", "rimraf": "^3.0.2", + "undici": "^5.20.0", "which": "^2.0.2", "yargs": "^17.5.0" }, From 5b818939270610bbc524884ffeb8bfbf7bcdb0b5 Mon Sep 17 00:00:00 2001 From: Austin Kelleher Date: Sun, 19 Feb 2023 12:06:26 -0500 Subject: [PATCH 2/3] chore: include Node.js 19.x in test strategy Co-authored-by: Antoine du Hamel --- .github/workflows/nodejs.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index 1e903ed4..65959c9b 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -26,7 +26,7 @@ jobs: strategy: fail-fast: false matrix: - node-version: [16.x, 18.x] + node-version: [16.x, 18.x, 19.x] os: [ubuntu-latest, macOS-latest, windows-latest] runs-on: ${{ matrix.os }} steps: From a9c097495c09b56995fe0a0328102f72ee91cf54 Mon Sep 17 00:00:00 2001 From: Austin Kelleher Date: Mon, 20 Feb 2023 08:41:30 -0500 Subject: [PATCH 3/3] chore: update node engines to >=16.8.0 for undici fetch support --- package.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/package.json b/package.json index c2a69f0f..b419bd43 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,9 @@ "version": "2.1.3", "description": "Utilities for Node.js core collaborators", "type": "module", + "engines": { + "node": ">=16.8.0" + }, "bin": { "get-metadata": "./bin/get-metadata.js", "git-node": "./bin/git-node.js",