Skip to content

Commit

Permalink
chore: swap out node-fetch-commonjs with node-fetch (#329)
Browse files Browse the repository at this point in the history
  • Loading branch information
sockmaster27 authored Jan 31, 2024
1 parent cbc0dea commit 6cb0c75
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 19 deletions.
41 changes: 28 additions & 13 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-commonjs": "^3.2.4",
"node-fetch": "^3.3.2",
"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,8 +2,6 @@
// 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 @@ -13,7 +11,9 @@ import * as util from 'util'
import * as path from 'path'
import { strict as nativeAssert } from 'assert'
import * as _ from 'lodash'
const fetch = require('node-fetch-commonjs')

// Remove when support for Node.js 20 is dropped
import fetch from 'node-fetch'

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

0 comments on commit 6cb0c75

Please sign in to comment.