Skip to content

Commit

Permalink
chore(deps): move from node-fetch to undici
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasrockhu-codecov committed Oct 25, 2023
1 parent aceeca9 commit b632c3c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 145 deletions.
143 changes: 8 additions & 135 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@
"@actions/core": "^1.10.1",
"@actions/exec": "^1.1.1",
"@actions/github": "^6.0.0",
"node-fetch": "^3.3.2",
"openpgp": "5.10"
"openpgp": "5.10",
"undici": "^5.26.5"
},
"devDependencies": {
"@types/jest": "^29.5.6",
"@types/node": "^20.8.8",
"@typescript-eslint/eslint-plugin": "^6.9.0",
"@typescript-eslint/parser": "^6.9.0",
"@vercel/ncc": "^0.38.1",
Expand Down
10 changes: 5 additions & 5 deletions src/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as path from 'path';

import * as core from '@actions/core';
import * as openpgp from 'openpgp';
import * as fetch from 'node-fetch';
import { request } from 'undici';

import {
getBaseUrl,
Expand All @@ -30,18 +30,18 @@ const verify = async (

// Get SHASUM and SHASUM signature files
console.log(`${getBaseUrl(platform, version)}.SHA256SUM`);
const shasumRes = await fetch.default(
const shasumRes = await request(
`${getBaseUrl(platform, version)}.SHA256SUM`,
);
const shasum = await shasumRes.text();
const shasum = await shasumRes.body.text();
if (verbose) {
console.log(`Received SHA256SUM ${shasum}`);
}

const shaSigRes = await fetch.default(
const shaSigRes = await request(
`${getBaseUrl(platform, version)}.SHA256SUM.sig`,
);
const shaSig = await shaSigRes.text();
const shaSig = await shaSigRes.body.text();
if (verbose) {
console.log(`Received SHA256SUM signature ${shaSig}`);
}
Expand Down
4 changes: 2 additions & 2 deletions src/version.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as core from '@actions/core';
import * as fetch from 'node-fetch';
import { request } from 'undici';

const versionInfo = async (
platform: string,
Expand All @@ -10,7 +10,7 @@ const versionInfo = async (
}

try {
const metadataRes = await fetch.default( `https://uploader.codecov.io/${platform}/latest`, {
const metadataRes = await request(`https://uploader.codecov.io/${platform}/latest`, {
headers: {'Accept': 'application/json'},
});
const metadata = await metadataRes.json();
Expand Down

0 comments on commit b632c3c

Please sign in to comment.