@oclif/plugin-update
Advanced tools
Comparing version 4.4.15 to 4.4.16
@@ -5,6 +5,7 @@ import { Config, ux } from '@oclif/core'; | ||
import fileSize from 'filesize'; | ||
import { got } from 'got'; | ||
import { HTTPError, got } from 'got'; | ||
import { existsSync } from 'node:fs'; | ||
import { mkdir, readFile, readdir, rm, stat, symlink, utimes, writeFile } from 'node:fs/promises'; | ||
import { basename, dirname, join } from 'node:path'; | ||
import { ProxyAgent } from 'proxy-agent'; | ||
import { Extractor } from './tar.js'; | ||
@@ -17,2 +18,19 @@ import { ls, wait } from './util.js'; | ||
}; | ||
async function httpGet(url) { | ||
debug(`[${url}] GET`); | ||
return got | ||
.get(url, { | ||
agent: { https: new ProxyAgent() }, | ||
}) | ||
.then((res) => { | ||
debug(`[${url}] ${res.statusCode}`); | ||
return res; | ||
}) | ||
.catch((error) => { | ||
debug(`[${url}] ${error.response?.statusCode ?? error.code}`); | ||
// constructing a new HTTPError here will produce a more actionable stack trace | ||
debug(new HTTPError(error.response)); | ||
throw error; | ||
}); | ||
} | ||
export class Updater { | ||
@@ -30,3 +48,3 @@ config; | ||
try { | ||
const { body } = await got.get(newIndexUrl); | ||
const { body } = await httpGet(newIndexUrl); | ||
return typeof body === 'string' ? JSON.parse(body) : body; | ||
@@ -249,3 +267,3 @@ } | ||
const url = config.s3Url(s3Key); | ||
const { body } = await got.get(url); | ||
const { body } = await httpGet(url); | ||
if (typeof body === 'string') { | ||
@@ -316,3 +334,6 @@ return JSON.parse(body); | ||
})); | ||
const stream = got.stream(gzUrl); | ||
debug(`Streaming ${gzUrl} to ${output}`); | ||
const stream = got.stream(gzUrl, { | ||
agent: { https: new ProxyAgent() }, | ||
}); | ||
stream.pause(); | ||
@@ -347,3 +368,3 @@ const baseDir = manifest.baseDir ?? | ||
try { | ||
const { body } = await got.get(`${config.npmRegistry ?? 'https://registry.npmjs.org'}/${config.pjson.name}`); | ||
const { body } = await httpGet(`${config.npmRegistry ?? 'https://registry.npmjs.org'}/${config.pjson.name}`); | ||
const tags = body['dist-tags']; | ||
@@ -350,0 +371,0 @@ const tag = Object.keys(tags).find((v) => tags[v] === version) ?? channel; |
@@ -99,3 +99,3 @@ { | ||
}, | ||
"version": "4.4.15" | ||
"version": "4.4.16" | ||
} |
{ | ||
"name": "@oclif/plugin-update", | ||
"version": "4.4.15", | ||
"version": "4.4.16", | ||
"author": "Salesforce", | ||
@@ -13,2 +13,3 @@ "bugs": "https://github.com/oclif/plugin-update/issues", | ||
"got": "^13", | ||
"proxy-agent": "^6.4.0", | ||
"semver": "^7.6.3", | ||
@@ -15,0 +16,0 @@ "tar-fs": "^2.1.1", |
@@ -58,3 +58,3 @@ # @oclif/plugin-update | ||
_See code: [src/commands/update.ts](https://github.com/oclif/plugin-update/blob/v4.4.15/src/commands/update.ts)_ | ||
_See code: [src/commands/update.ts](https://github.com/oclif/plugin-update/blob/v4.4.16/src/commands/update.ts)_ | ||
<!-- commandsstop --> | ||
@@ -61,0 +61,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36200
852
7
15
10
+ Addedproxy-agent@^6.4.0
+ Added@inquirer/figures@1.0.7(transitive)
+ Added@oclif/core@4.0.31(transitive)
+ Added@tootallnate/quickjs-emscripten@0.23.0(transitive)
+ Addedagent-base@7.1.1(transitive)
+ Addedast-types@0.13.4(transitive)
+ Addedbasic-ftp@5.0.5(transitive)
+ Addeddata-uri-to-buffer@6.0.2(transitive)
+ Addeddegenerator@5.0.1(transitive)
+ Addedes-abstract@1.23.3(transitive)
+ Addedescodegen@2.1.0(transitive)
+ Addedesprima@4.0.1(transitive)
+ Addedestraverse@5.3.0(transitive)
+ Addedesutils@2.0.3(transitive)
+ Addedfs-extra@11.2.0(transitive)
+ Addedget-uri@6.0.3(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedhttp-proxy-agent@7.0.2(transitive)
+ Addedhttps-proxy-agent@7.0.5(transitive)
+ Addedip-address@9.0.5(transitive)
+ Addedjsbn@1.1.0(transitive)
+ Addedjsonfile@6.1.0(transitive)
+ Addedlru-cache@7.18.3(transitive)
+ Addednetmask@2.0.2(transitive)
+ Addedpac-proxy-agent@7.0.2(transitive)
+ Addedpac-resolver@7.0.1(transitive)
+ Addedproxy-agent@6.4.0(transitive)
+ Addedproxy-from-env@1.1.0(transitive)
+ Addedsmart-buffer@4.2.0(transitive)
+ Addedsocks@2.8.3(transitive)
+ Addedsocks-proxy-agent@8.0.4(transitive)
+ Addedsource-map@0.6.1(transitive)
+ Addedsprintf-js@1.1.3(transitive)
+ Addedtslib@2.8.1(transitive)
+ Addeduniversalify@2.0.1(transitive)
- Removed@inquirer/figures@1.0.8(transitive)
- Removed@oclif/core@4.0.32(transitive)
- Removedes-abstract@1.23.4(transitive)