@oclif/plugin-update 4.2.11 → 4.2.12

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 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.2.11/src/commands/update.ts)_
58
+ _See code: [src/commands/update.ts](https://github.com/oclif/plugin-update/blob/v4.2.12/src/commands/update.ts)_
59
59
  <!-- commandsstop -->
60
60
 
61
61
  # Contributing
package/dist/tar.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import makeDebug from 'debug';
2
2
  import { existsSync } from 'node:fs';
3
- import { cp, rename, rm } from 'node:fs/promises';
3
+ import { rename, rm } from 'node:fs/promises';
4
4
  import { join } from 'node:path';
5
5
  import { touch } from './util.js';
6
6
  const debug = makeDebug('oclif-update');
@@ -63,9 +63,7 @@ async function extract(stream, basename, output, sha) {
63
63
  });
64
64
  if (existsSync(output)) {
65
65
  try {
66
- const tmp = getTmp();
67
- await cp(output, tmp);
68
- await rm(tmp, { force: true, recursive: true }).catch(debug);
66
+ await rm(output, { force: true, recursive: true }).catch(debug);
69
67
  }
70
68
  catch (error) {
71
69
  debug(error);
package/dist/update.js CHANGED
@@ -1,8 +1,7 @@
1
1
  import { Config, ux } from '@oclif/core';
2
2
  import chalk from 'chalk';
3
3
  import fileSize from 'filesize';
4
- import { HTTP } from 'http-call';
5
- import throttle from 'lodash.throttle';
4
+ import { got } from 'got';
6
5
  import { existsSync } from 'node:fs';
7
6
  import { mkdir, readFile, readdir, rm, stat, symlink, utimes, writeFile } from 'node:fs/promises';
8
7
  import { basename, dirname, join } from 'node:path';
@@ -25,7 +24,7 @@ export class Updater {
25
24
  ux.action.status = 'fetching version index';
26
25
  const newIndexUrl = this.config.s3Url(s3VersionIndexKey(this.config));
27
26
  try {
28
- const { body } = await HTTP.get(newIndexUrl);
27
+ const { body } = await got.get(newIndexUrl);
29
28
  return typeof body === 'string' ? JSON.parse(body) : body;
30
29
  }
31
30
  catch {
@@ -219,7 +218,6 @@ const ensureClientDir = async (clientRoot) => {
219
218
  }
220
219
  }
221
220
  };
222
- // eslint-disable-next-line unicorn/no-await-expression-member
223
221
  const mtime = async (f) => (await stat(f)).mtime;
224
222
  const notUpdatable = (config) => {
225
223
  if (!config.binPath) {
@@ -243,7 +241,7 @@ const composeS3SubDir = (config) => {
243
241
  const fetchManifest = async (s3Key, config) => {
244
242
  ux.action.status = 'fetching manifest';
245
243
  const url = config.s3Url(s3Key);
246
- const { body } = await HTTP.get(url);
244
+ const { body } = await got.get(url);
247
245
  if (typeof body === 'string') {
248
246
  return JSON.parse(body);
249
247
  }
@@ -309,7 +307,7 @@ const downloadAndExtract = async (output, manifest, channel, config) => {
309
307
  platform: determinePlatform(config),
310
308
  version,
311
309
  }));
312
- const { response: stream } = await HTTP.stream(gzUrl);
310
+ const stream = got.stream(gzUrl);
313
311
  stream.pause();
314
312
  const baseDir = manifest.baseDir ??
315
313
  config.s3Key('baseDir', {
@@ -321,14 +319,11 @@ const downloadAndExtract = async (output, manifest, channel, config) => {
321
319
  });
322
320
  const extraction = Extractor.extract(stream, baseDir, output, sha256gz);
323
321
  if (ux.action.type === 'spinner') {
324
- const total = Number.parseInt(stream.headers['content-length'], 10);
325
- let current = 0;
326
- const updateStatus = throttle((newStatus) => {
327
- ux.action.status = newStatus;
328
- }, 250, { leading: true, trailing: false });
329
- stream.on('data', (data) => {
330
- current += data.length;
331
- updateStatus(`${filesize(current)}/${filesize(total)}`);
322
+ stream.on('downloadProgress', (progress) => {
323
+ ux.action.status =
324
+ progress.percent === 1
325
+ ? `${filesize(progress.transferred)}/${filesize(progress.total)} - Extracting`
326
+ : `${filesize(progress.transferred)}/${filesize(progress.total)}`;
332
327
  });
333
328
  }
334
329
  stream.resume();
@@ -336,13 +331,12 @@ const downloadAndExtract = async (output, manifest, channel, config) => {
336
331
  };
337
332
  const determineChannel = async ({ config, version }) => {
338
333
  const channelPath = join(config.dataDir, 'channel');
339
- // eslint-disable-next-line unicorn/no-await-expression-member
340
334
  const channel = existsSync(channelPath) ? (await readFile(channelPath, 'utf8')).trim() : 'stable';
341
335
  if (config.pjson.oclif.update?.disableNpmLookup ?? false) {
342
336
  return channel;
343
337
  }
344
338
  try {
345
- const { body } = await HTTP.get(`${config.npmRegistry ?? 'https://registry.npmjs.org'}/${config.pjson.name}`);
339
+ const { body } = await got.get(`${config.npmRegistry ?? 'https://registry.npmjs.org'}/${config.pjson.name}`);
346
340
  const tags = body['dist-tags'];
347
341
  const tag = Object.keys(tags).find((v) => tags[v] === version) ?? channel;
348
342
  // convert from npm style tag defaults to OCLIF style
@@ -88,5 +88,5 @@
88
88
  ]
89
89
  }
90
90
  },
91
- "version": "4.2.11"
91
+ "version": "4.2.12"
92
92
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oclif/plugin-update",
3
- "version": "4.2.11",
3
+ "version": "4.2.12",
4
4
  "author": "Salesforce",
5
5
  "bugs": "https://github.com/oclif/plugin-update/issues",
6
6
  "dependencies": {
@@ -9,8 +9,7 @@
9
9
  "chalk": "^5",
10
10
  "debug": "^4.3.1",
11
11
  "filesize": "^6.1.0",
12
- "http-call": "^5.3.0",
13
- "lodash.throttle": "^4.1.1",
12
+ "got": "^13",
14
13
  "semver": "^7.6.0",
15
14
  "tar-fs": "^2.1.1"
16
15
  },
@@ -22,7 +21,6 @@
22
21
  "@types/chai": "^4.3.11",
23
22
  "@types/debug": "^4.1.12",
24
23
  "@types/execa": "^0.9.0",
25
- "@types/lodash.throttle": "^4.1.9",
26
24
  "@types/mocha": "^10",
27
25
  "@types/node": "^18",
28
26
  "@types/semver": "^7.5.8",
@@ -33,7 +31,6 @@
33
31
  "eslint-config-oclif": "^5.2.0",
34
32
  "eslint-config-oclif-typescript": "^3.1.7",
35
33
  "eslint-config-prettier": "^9.1.0",
36
- "got": "^13.0.0",
37
34
  "husky": "^9",
38
35
  "lint-staged": "^15",
39
36
  "mocha": "^10.4.0",
@@ -51,8 +48,7 @@
51
48
  },
52
49
  "files": [
53
50
  "oclif.manifest.json",
54
- "/dist",
55
- "npm-shrinkwrap.json"
51
+ "/dist"
56
52
  ],
57
53
  "homepage": "https://github.com/oclif/plugin-update",
58
54
  "keywords": [
@@ -74,12 +70,12 @@
74
70
  "repository": "oclif/plugin-update",
75
71
  "scripts": {
76
72
  "build": "shx rm -rf lib && tsc",
77
- "clean": "shx rm -f oclif.manifest.json npm-shrinkwrap.json",
73
+ "clean": "shx rm -f oclif.manifest.json",
78
74
  "compile": "tsc",
79
75
  "lint": "eslint . --ext .ts",
80
76
  "postpack": "yarn run clean",
81
77
  "posttest": "yarn lint",
82
- "prepack": "yarn build && oclif manifest && oclif readme && npm shrinkwrap",
78
+ "prepack": "yarn build && oclif manifest && oclif readme",
83
79
  "prepare": "husky && yarn build",
84
80
  "pretest": "yarn build --noEmit && tsc -p test --noEmit",
85
81
  "test:integration:sf": "mocha --forbid-only \"test/integration/sf.integration.ts\" --timeout 900000",