@oclif/plugin-update 4.4.13-dev.2 → 4.4.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/update.js +5 -26
- package/oclif.manifest.json +1 -1
- package/package.json +2 -3
package/README.md
CHANGED
@@ -55,7 +55,7 @@ EXAMPLES
|
|
55
55
|
$ oclif-example update --available
|
56
56
|
```
|
57
57
|
|
58
|
-
_See code: [src/commands/update.ts](https://github.com/oclif/plugin-update/blob/v4.4.13
|
58
|
+
_See code: [src/commands/update.ts](https://github.com/oclif/plugin-update/blob/v4.4.13/src/commands/update.ts)_
|
59
59
|
<!-- commandsstop -->
|
60
60
|
|
61
61
|
# Contributing
|
package/dist/update.js
CHANGED
@@ -2,11 +2,10 @@ import { Config, ux } from '@oclif/core';
|
|
2
2
|
import { green, yellow } from 'ansis';
|
3
3
|
import makeDebug from 'debug';
|
4
4
|
import fileSize from 'filesize';
|
5
|
-
import {
|
5
|
+
import { got } from 'got';
|
6
6
|
import { existsSync } from 'node:fs';
|
7
7
|
import { mkdir, readFile, readdir, rm, stat, symlink, utimes, writeFile } from 'node:fs/promises';
|
8
8
|
import { basename, dirname, join } from 'node:path';
|
9
|
-
import { ProxyAgent } from 'proxy-agent';
|
10
9
|
import { Extractor } from './tar.js';
|
11
10
|
import { ls, wait } from './util.js';
|
12
11
|
const debug = makeDebug('oclif:update');
|
@@ -14,23 +13,6 @@ const filesize = (n) => {
|
|
14
13
|
const [num, suffix] = fileSize(n, { output: 'array' });
|
15
14
|
return Number.parseFloat(num).toFixed(1) + ` ${suffix}`;
|
16
15
|
};
|
17
|
-
async function httpGet(url) {
|
18
|
-
debug(`[${url}] GET`);
|
19
|
-
return got
|
20
|
-
.get(url, {
|
21
|
-
agent: { https: new ProxyAgent() },
|
22
|
-
})
|
23
|
-
.then((res) => {
|
24
|
-
debug(`[${url}] ${res.statusCode}`);
|
25
|
-
return res;
|
26
|
-
})
|
27
|
-
.catch((error) => {
|
28
|
-
debug(`[${url}] ${error.response?.statusCode ?? error.code}`);
|
29
|
-
// constructing a new HTTPError here will produce a more actionable stack trace
|
30
|
-
debug(new HTTPError(error.response));
|
31
|
-
throw error;
|
32
|
-
});
|
33
|
-
}
|
34
16
|
export class Updater {
|
35
17
|
config;
|
36
18
|
clientBin;
|
@@ -43,7 +25,7 @@ export class Updater {
|
|
43
25
|
async fetchVersionIndex() {
|
44
26
|
const newIndexUrl = this.config.s3Url(s3VersionIndexKey(this.config));
|
45
27
|
try {
|
46
|
-
const { body } = await
|
28
|
+
const { body } = await got.get(newIndexUrl);
|
47
29
|
return typeof body === 'string' ? JSON.parse(body) : body;
|
48
30
|
}
|
49
31
|
catch {
|
@@ -261,7 +243,7 @@ const composeS3SubDir = (config) => {
|
|
261
243
|
const fetchManifest = async (s3Key, config) => {
|
262
244
|
ux.action.status = 'fetching manifest';
|
263
245
|
const url = config.s3Url(s3Key);
|
264
|
-
const { body } = await
|
246
|
+
const { body } = await got.get(url);
|
265
247
|
if (typeof body === 'string') {
|
266
248
|
return JSON.parse(body);
|
267
249
|
}
|
@@ -327,10 +309,7 @@ const downloadAndExtract = async (output, manifest, channel, config) => {
|
|
327
309
|
platform: determinePlatform(config),
|
328
310
|
version,
|
329
311
|
}));
|
330
|
-
|
331
|
-
const stream = got.stream(gzUrl, {
|
332
|
-
agent: { https: new ProxyAgent() },
|
333
|
-
});
|
312
|
+
const stream = got.stream(gzUrl);
|
334
313
|
stream.pause();
|
335
314
|
const baseDir = manifest.baseDir ??
|
336
315
|
config.s3Key('baseDir', {
|
@@ -360,7 +339,7 @@ const determineChannel = async ({ config, version }) => {
|
|
360
339
|
return channel;
|
361
340
|
}
|
362
341
|
try {
|
363
|
-
const { body } = await
|
342
|
+
const { body } = await got.get(`${config.npmRegistry ?? 'https://registry.npmjs.org'}/${config.pjson.name}`);
|
364
343
|
const tags = body['dist-tags'];
|
365
344
|
const tag = Object.keys(tags).find((v) => tags[v] === version) ?? channel;
|
366
345
|
// convert from npm style tag defaults to OCLIF style
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
@@ -1,16 +1,15 @@
|
|
1
1
|
{
|
2
2
|
"name": "@oclif/plugin-update",
|
3
|
-
"version": "4.4.13
|
3
|
+
"version": "4.4.13",
|
4
4
|
"author": "Salesforce",
|
5
5
|
"bugs": "https://github.com/oclif/plugin-update/issues",
|
6
6
|
"dependencies": {
|
7
7
|
"@inquirer/select": "^2.4.1",
|
8
8
|
"@oclif/core": "^4",
|
9
|
-
"ansis": "^3.2
|
9
|
+
"ansis": "^3.3.2",
|
10
10
|
"debug": "^4.3.5",
|
11
11
|
"filesize": "^6.1.0",
|
12
12
|
"got": "^13",
|
13
|
-
"proxy-agent": "^6.4.0",
|
14
13
|
"semver": "^7.6.3",
|
15
14
|
"tar-fs": "^2.1.1",
|
16
15
|
"tty-table": "^4.2.3"
|