Skip to content
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

chore!: upgrade got to 11.8.5 #225

Merged
merged 5 commits into from
Aug 10, 2022
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
16 changes: 8 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ version: 2.1
orbs:
win: circleci/[email protected]
jobs:
test-linux-8:
test-linux-12:
docker:
- image: circleci/node:8
- image: circleci/node:12
<<: *steps-test
test-linux-10:
test-linux-14:
docker:
- image: circleci/node:10
- image: circleci/node:14
<<: *steps-test
test-mac:
macos:
Expand All @@ -52,14 +52,14 @@ workflows:
test_and_release:
# Run the test jobs first, then the release only when all the test jobs are successful
jobs:
- test-linux-8
- test-linux-10
- test-linux-12
- test-linux-14
- test-mac
- test-windows
- release:
requires:
- test-linux-8
- test-linux-10
- test-linux-12
- test-linux-14
- test-mac
- test-windows
filters:
Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
"README.md"
],
"engines": {
"node": ">=8.6"
"node": ">=12"
},
"dependencies": {
"debug": "^4.1.1",
"env-paths": "^2.2.0",
"fs-extra": "^8.1.0",
"got": "^9.6.0",
"got": "^11.8.5",
"progress": "^2.0.3",
"semver": "^6.2.0",
"sumchecker": "^3.0.1"
Expand All @@ -38,9 +38,8 @@
"@continuous-auth/semantic-release-npm": "^2.0.0",
"@types/debug": "^4.1.4",
"@types/fs-extra": "^8.0.0",
"@types/got": "^9.4.4",
"@types/jest": "^24.0.13",
"@types/node": "^12.0.2",
"@types/node": "^12.20.55",
"@types/progress": "^2.0.3",
"@types/semver": "^6.2.0",
"@typescript-eslint/eslint-plugin": "^2.34.0",
Expand Down
12 changes: 6 additions & 6 deletions src/GotDownloader.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as fs from 'fs-extra';
import * as got from 'got';
import got, { HTTPError, Progress as GotProgress, Options as GotOptions } from 'got';
import * as path from 'path';
import * as ProgressBar from 'progress';

Expand All @@ -10,11 +10,11 @@ const PROGRESS_BAR_DELAY_IN_SECONDS = 30;
/**
* See [`got#options`](https://github.com/sindresorhus/got#options) for possible keys/values.
*/
export type GotDownloaderOptions = got.GotOptions<string | null> & {
export type GotDownloaderOptions = (GotOptions & { isStream?: true }) & {
/**
* if defined, triggers every time `got`'s `downloadProgress` event callback is triggered.
*/
getProgressCallback?: (progress: got.Progress) => Promise<void>;
getProgressCallback?: (progress: GotProgress) => Promise<void>;
/**
* if `true`, disables the console progress bar (setting the `ELECTRON_GET_NO_PROGRESS`
* environment variable to a non-empty value also does this).
Expand Down Expand Up @@ -56,7 +56,7 @@ export class GotDownloader implements Downloader<GotDownloaderOptions> {
}
}, PROGRESS_BAR_DELAY_IN_SECONDS * 1000);
}
await new Promise((resolve, reject) => {
await new Promise<void>((resolve, reject) => {
const downloadStream = got.stream(url, gotOptions);
downloadStream.on('downloadProgress', async progress => {
progressPercent = progress.percent;
Expand All @@ -68,8 +68,8 @@ export class GotDownloader implements Downloader<GotDownloaderOptions> {
}
});
downloadStream.on('error', error => {
if (error.name === 'HTTPError' && error.statusCode === 404) {
error.message += ` for ${error.url}`;
if (error instanceof HTTPError && error.response.statusCode === 404) {
error.message += ` for ${error.response.url}`;
}
if (writeStream.destroy) {
writeStream.destroy(error);
Expand Down
Loading