Skip to content

Revert "chore: swap out node-fetch-commonjs with node-fetch" #334

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 13 additions & 28 deletions client/package-lock.json

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

2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"dependencies": {
"lodash": "^4.17.21",
"node-fetch": "^3.3.2",
"node-fetch-commonjs": "^3.2.4",
"vscode-languageclient": "^8.0.1"
},
"devDependencies": {
Expand Down
10 changes: 5 additions & 5 deletions client/src/services/releases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// https://github.com/rust-analyzer/rust-analyzer/blob/master/editors/code/src/net.ts
// The code in rust-analyzer is released under the same licence as this project.

// Replace with `import fetch from "node-fetch"` once this is fixed in rollup:
// https://github.com/rollup/plugins/issues/491
import * as vscode from 'vscode'
import * as stream from 'stream'
import * as crypto from 'crypto'
Expand All @@ -11,9 +13,7 @@ import * as util from 'util'
import * as path from 'path'
import { strict as nativeAssert } from 'assert'
import * as _ from 'lodash'

// Remove when support for Node.js 20 is dropped
import fetch from 'node-fetch'
const fetch = require('node-fetch-commonjs')

const pipeline = util.promisify(stream.pipeline)

Expand Down Expand Up @@ -61,8 +61,8 @@ export async function fetchRelease(
throw new Error(`Got response ${response.status} when trying to fetch ` + `release info for ${releaseTag} release`)
}

// We skip runtime type checks for simplicity (here we cast from `unknown` to `GithubRelease`)
const release = (await response.json()) as GithubRelease
// We skip runtime type checks for simplicity (here we cast from `any` to `GithubRelease`)
const release: GithubRelease = await response.json()
const flixRelease: FlixRelease = {
url: _.get(release, 'url'),
id: _.get(release, 'id'),
Expand Down