Skip to content

Commit 57c4cdf

Browse files
authored
Replace node-fetch and axios with native fetch (#3123)
1 parent 5bcbb1b commit 57c4cdf

File tree

15 files changed

+106
-145
lines changed

15 files changed

+106
-145
lines changed

.changeset/moody-wombats-glow.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

packages/community-meta/scripts/generateRichMeetupData.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ const { join } = require("path")
77
const { writeFileSync } = require("fs")
88
const { meetups } = require("./meetups")
99
// const xml2js = require("xml2js")
10-
// const nodeFetch = require("node-fetch").default
1110
// const icalToolkit = require("ical-utils")
1211
const { format } = require("prettier")
1312
// const moment = require("moment")
@@ -31,7 +30,7 @@ const go = async () => {
3130
// const meetupID = meetupURL.split('/').pop()
3231
// process.stdout.write(meetupID)
3332

34-
// const icalResponse = await nodeFetch(`https://www.meetup.com/${meetupID}/events/ical/`)
33+
// const icalResponse = await fetch(`https://www.meetup.com/${meetupID}/events/ical/`)
3534
// const icalText = await icalResponse.text()
3635
// const ical = await icalToolkit.parseToJSON(icalText)
3736

@@ -53,7 +52,7 @@ const go = async () => {
5352
// let richDescription = '<p>' + upcomingEvent.description + '</p>'
5453

5554
// // Best to not assume meetup.com's long term health, and it's rss
56-
// const rssResponse = await nodeFetch(`https://www.meetup.com/${meetupID}/events/rss/`)
55+
// const rssResponse = await fetch(`https://www.meetup.com/${meetupID}/events/rss/`)
5756
// const rssText = await rssResponse.text()
5857
// const rss = await xml2js.parseStringPromise(rssText)
5958

packages/playground/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
"jest": "^29.5.0",
2626
"monaco-editor": "^0.32.1",
2727
"monaco-typescript": "^3.7.0",
28-
"node-fetch": "^2.7.0",
2928
"typescript": "*"
3029
}
3130
}

packages/playground/scripts/getListOfPluginsFromNPM.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@ if (!process.env.CI) {
1010
process.exit(0)
1111
}
1212

13-
const nodeFetch = require("node-fetch").default
1413
const { writeFileSync } = require("fs")
1514
const { join } = require("path")
1615
const { format } = require("prettier")
1716

1817
const get = async url => {
19-
const packageJSON = await nodeFetch(url)
18+
const packageJSON = await fetch(url)
2019
const contents = await packageJSON.json()
2120
return contents
2221
}

packages/sandbox/package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,10 @@
5050
"devDependencies": {
5151
"@rollup/plugin-commonjs": "^25.0.7",
5252
"@types/jest": "^29.5.12",
53-
"axios": "^0.21.4",
5453
"dts-cli": "^2.0.5",
5554
"jest": "^29.5.0",
5655
"monaco-editor": "^0.32.1",
5756
"monaco-typescript": "^3.7.0",
58-
"node-fetch": "^2.7.0",
5957
"ts-jest": "^29.0.5",
6058
"typescript": "*"
6159
}

packages/sandbox/script/downloadReleases.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33
// Run via: pnpm run --filter=typescript-sandbox bootstrap
44

55
// Ensure the versions dropdown is up to date
6-
const axios = require("axios").default
76
const { writeFileSync } = require("fs")
87
const { join } = require("path")
98
const { format } = require("prettier")
10-
const fetch = require("node-fetch").default
119

1210
const go = async () => {
1311
const response = await fetch("https://typescript.azureedge.net/indexes/releases.json")

packages/tsconfig-reference/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
},
2626
"devDependencies": {
2727
"@types/json-schema": "^7.0.15",
28-
"node-fetch": "^2.7.0",
2928
"ts-node": "*",
3029
"typescript": "*",
3130
"xml-js": "^1.6.11"

packages/tsconfig-reference/scripts/schema/downloadSchemaBase.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22

33
// https://json.schemastore.org/tsconfig.json
44

5-
import nodeFetch from "node-fetch";
65
import { writeFileSync, existsSync, mkdirSync } from "fs";
76
import { join } from "path";
87

98
const getFileAndStoreLocally = async (url, path, editFunc) => {
109
const editingFunc = editFunc ? editFunc : (text) => text;
11-
const packageJSON = await nodeFetch(url);
10+
const packageJSON = await fetch(url);
1211
const contents = await packageJSON.text();
1312
writeFileSync(new URL(path, import.meta.url), editingFunc(contents), "utf8");
1413
};

packages/typescriptlang-org/package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
"dependencies": {
2121
"@babel/core": "^7.24.5",
2222
"@formatjs/intl-relativetimeformat": "^4.5.15",
23-
"@types/node-fetch": "^2.5.3",
2423
"@types/react-helmet": "^5.0.15",
2524
"@typescript/playground": "workspace:*",
2625
"@typescript/sandbox": "workspace:*",
@@ -66,12 +65,10 @@
6665
"@types/jest": "^29.5.12",
6766
"@types/react": "^18.3.2",
6867
"@types/react-dom": "^18.3.0",
69-
"axios": "^0.21.4",
7068
"gatsby-plugin-typegen": "^3.1.0",
7169
"gatsby-plugin-typescript": "^5.6.0",
7270
"jest": "^29.5.0",
7371
"monaco-editor": "^0.32.1",
74-
"node-fetch": "^2.7.0",
7572
"node-polyfill-webpack-plugin": "^3.0.0",
7673
"semver": "^7.6.2",
7774
"ts-jest": "^29.0.5",

packages/typescriptlang-org/scripts/createLighthouseJSON.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
const nodeFetch = require("node-fetch").default
21
const { writeFileSync } = require("fs")
32
const { join } = require("path")
43
const parser = require("xml-js")
@@ -9,7 +8,7 @@ const prRoot =
98
const go = async () => {
109
const sitemap = `${prRoot}/sitemap.xml`
1110
try {
12-
const packageJSON = await nodeFetch(sitemap)
11+
const packageJSON = await fetch(sitemap)
1312

1413
const contents = await packageJSON.text()
1514
const sitemapJSON = JSON.parse(

0 commit comments

Comments
 (0)