@oclif/plugin-update 2.1.0 → 2.1.1
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/CHANGELOG.md +7 -0
- package/README.md +1 -1
- package/lib/tar.js +13 -13
- package/lib/update.js +8 -8
- package/oclif.manifest.json +1 -1
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,13 @@
|
|
2
2
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
4
4
|
|
5
|
+
### [2.1.1](https://github.com/oclif/plugin-update/compare/v2.1.0...v2.1.1) (2021-12-02)
|
6
|
+
|
7
|
+
|
8
|
+
### Bug Fixes
|
9
|
+
|
10
|
+
* apply v2 deps ([#342](https://github.com/oclif/plugin-update/issues/342)) ([ea1abfa](https://github.com/oclif/plugin-update/commit/ea1abfab9840523636dbf55f183cbf8b6e46d501))
|
11
|
+
|
5
12
|
## [2.1.0](https://github.com/oclif/plugin-update/compare/v2.0.0...v2.1.0) (2021-11-23)
|
6
13
|
|
7
14
|
|
package/README.md
CHANGED
@@ -33,5 +33,5 @@ DESCRIPTION
|
|
33
33
|
update the oclif-example CLI
|
34
34
|
```
|
35
35
|
|
36
|
-
_See code: [src/commands/update.ts](https://github.com/oclif/plugin-update/blob/v2.
|
36
|
+
_See code: [src/commands/update.ts](https://github.com/oclif/plugin-update/blob/v2.1.0/src/commands/update.ts)_
|
37
37
|
<!-- commandsstop -->
|
package/lib/tar.js
CHANGED
@@ -5,6 +5,19 @@ const fs = require("fs-extra");
|
|
5
5
|
const path = require("path");
|
6
6
|
const util_1 = require("./util");
|
7
7
|
const debug = require('debug')('oclif-update');
|
8
|
+
const ignore = (_, header) => {
|
9
|
+
switch (header.type) {
|
10
|
+
case 'directory':
|
11
|
+
case 'file':
|
12
|
+
if (process.env.OCLIF_DEBUG_UPDATE_FILES)
|
13
|
+
debug(header.name);
|
14
|
+
return false;
|
15
|
+
case 'symlink':
|
16
|
+
return true;
|
17
|
+
default:
|
18
|
+
throw new Error(header.type);
|
19
|
+
}
|
20
|
+
};
|
8
21
|
async function extract(stream, basename, output, sha) {
|
9
22
|
const getTmp = () => `${output}.partial.${Math.random().toString().split('.')[1].slice(0, 5)}`;
|
10
23
|
let tmp = getTmp();
|
@@ -36,19 +49,6 @@ async function extract(stream, basename, output, sha) {
|
|
36
49
|
}
|
37
50
|
else
|
38
51
|
shaValidated = true;
|
39
|
-
const ignore = (_, header) => {
|
40
|
-
switch (header.type) {
|
41
|
-
case 'directory':
|
42
|
-
case 'file':
|
43
|
-
if (process.env.OCLIF_DEBUG_UPDATE_FILES)
|
44
|
-
debug(header.name);
|
45
|
-
return false;
|
46
|
-
case 'symlink':
|
47
|
-
return true;
|
48
|
-
default:
|
49
|
-
throw new Error(header.type);
|
50
|
-
}
|
51
|
-
};
|
52
52
|
const extract = tar.extract(tmp, { ignore });
|
53
53
|
extract.on('error', reject);
|
54
54
|
extract.on('finish', () => {
|
package/lib/update.js
CHANGED
@@ -80,13 +80,13 @@ class UpdateCli {
|
|
80
80
|
}
|
81
81
|
}
|
82
82
|
async downloadAndExtract(output, manifest, channel) {
|
83
|
-
const { version } = manifest;
|
83
|
+
const { version, gz, sha256gz } = manifest;
|
84
84
|
const filesize = (n) => {
|
85
85
|
const [num, suffix] = require('filesize')(n, { output: 'array' });
|
86
86
|
return num.toFixed(1) + ` ${suffix}`;
|
87
87
|
};
|
88
88
|
const http = require('http-call').HTTP;
|
89
|
-
const gzUrl =
|
89
|
+
const gzUrl = gz || this.options.config.s3Url(this.options.config.s3Key('versioned', {
|
90
90
|
version,
|
91
91
|
channel,
|
92
92
|
bin: this.options.config.bin,
|
@@ -103,11 +103,11 @@ class UpdateCli {
|
|
103
103
|
platform: this.options.config.platform,
|
104
104
|
arch: this.options.config.arch,
|
105
105
|
});
|
106
|
-
const extraction = (0, tar_1.extract)(stream, baseDir, output,
|
106
|
+
const extraction = (0, tar_1.extract)(stream, baseDir, output, sha256gz);
|
107
107
|
// to-do: use cli.action.type
|
108
108
|
if (cli_ux_1.default.action.frames) {
|
109
109
|
// if spinner action
|
110
|
-
const total = parseInt(stream.headers['content-length'], 10);
|
110
|
+
const total = Number.parseInt(stream.headers['content-length'], 10);
|
111
111
|
let current = 0;
|
112
112
|
const updateStatus = _.throttle((newStatus) => {
|
113
113
|
cli_ux_1.default.action.status = newStatus;
|
@@ -161,7 +161,7 @@ class UpdateCli {
|
|
161
161
|
async determineCurrentVersion() {
|
162
162
|
try {
|
163
163
|
const currentVersion = await fs.readFile(this.clientBin, 'utf8');
|
164
|
-
const matches = currentVersion.match(/\.\.[
|
164
|
+
const matches = currentVersion.match(/\.\.[/\\|](.+)[/\\|]bin/);
|
165
165
|
return matches ? matches[1] : this.options.config.version;
|
166
166
|
}
|
167
167
|
catch (error) {
|
@@ -169,7 +169,7 @@ class UpdateCli {
|
|
169
169
|
}
|
170
170
|
return this.options.config.version;
|
171
171
|
}
|
172
|
-
s3ChannelManifestKey(bin, platform, arch, folder) {
|
172
|
+
s3ChannelManifestKey(bin, platform, arch, folder = '') {
|
173
173
|
let s3SubDir = folder || '';
|
174
174
|
if (s3SubDir !== '' && s3SubDir.slice(-1) !== '/')
|
175
175
|
s3SubDir = `${s3SubDir}/`;
|
@@ -272,10 +272,10 @@ class UpdateCli {
|
|
272
272
|
}
|
273
273
|
async createBin(version) {
|
274
274
|
const dst = this.clientBin;
|
275
|
-
const { bin } = this.options.config;
|
275
|
+
const { bin, windows } = this.options.config;
|
276
276
|
const binPathEnvVar = this.options.config.scopedEnvVarKey('BINPATH');
|
277
277
|
const redirectedEnvVar = this.options.config.scopedEnvVarKey('REDIRECTED');
|
278
|
-
if (
|
278
|
+
if (windows) {
|
279
279
|
const body = `@echo off
|
280
280
|
setlocal enableextensions
|
281
281
|
set ${redirectedEnvVar}=1
|
package/oclif.manifest.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":"2.1.
|
1
|
+
{"version":"2.1.1","commands":{"update":{"id":"update","description":"update the <%= config.bin %> CLI","strict":true,"pluginName":"@oclif/plugin-update","pluginAlias":"@oclif/plugin-update","pluginType":"core","aliases":[],"flags":{"autoupdate":{"name":"autoupdate","type":"boolean","hidden":true,"allowNo":false},"from-local":{"name":"from-local","type":"boolean","description":"interactively choose an already installed version","allowNo":false}},"args":[{"name":"channel"}]}}}
|
package/package.json
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
{
|
2
2
|
"name": "@oclif/plugin-update",
|
3
|
-
"version": "2.1.
|
3
|
+
"version": "2.1.1",
|
4
4
|
"author": "Jeff Dickey @jdxcode",
|
5
5
|
"bugs": "https://github.com/oclif/plugin-update/issues",
|
6
6
|
"dependencies": {
|
7
|
-
"@oclif/color": "^
|
8
|
-
"@oclif/core": "^1.0.
|
7
|
+
"@oclif/color": "^1.0.0",
|
8
|
+
"@oclif/core": "^1.0.7",
|
9
9
|
"@types/semver": "^7.3.4",
|
10
|
-
"cli-ux": "^
|
10
|
+
"cli-ux": "^6.0.3",
|
11
11
|
"cross-spawn": "^7.0.3",
|
12
12
|
"debug": "^4.3.1",
|
13
13
|
"filesize": "^6.1.0",
|
@@ -19,24 +19,24 @@
|
|
19
19
|
"tar-fs": "^2.1.1"
|
20
20
|
},
|
21
21
|
"devDependencies": {
|
22
|
-
"@oclif/plugin-help": "^5.1.
|
23
|
-
"@oclif/test": "^
|
22
|
+
"@oclif/plugin-help": "^5.1.7",
|
23
|
+
"@oclif/test": "^2.0.2",
|
24
24
|
"@types/chai": "^4.2.15",
|
25
25
|
"@types/cross-spawn": "^6.0.2",
|
26
26
|
"@types/execa": "^0.9.0",
|
27
27
|
"@types/fs-extra": "^8.0.1",
|
28
28
|
"@types/glob": "^7.1.3",
|
29
29
|
"@types/lodash": "^4.14.168",
|
30
|
-
"@types/mocha": "^
|
30
|
+
"@types/mocha": "^9",
|
31
31
|
"@types/node": "^14.14.31",
|
32
32
|
"@types/supports-color": "^7.2.0",
|
33
33
|
"@types/write-json-file": "^3.2.1",
|
34
34
|
"chai": "^4.3.4",
|
35
|
-
"eslint": "^7.
|
36
|
-
"eslint-config-oclif": "^
|
37
|
-
"eslint-config-oclif-typescript": "^0.2
|
35
|
+
"eslint": "^7.32.0",
|
36
|
+
"eslint-config-oclif": "^4",
|
37
|
+
"eslint-config-oclif-typescript": "^1.0.2",
|
38
38
|
"globby": "^11.0.2",
|
39
|
-
"mocha": "^
|
39
|
+
"mocha": "^9",
|
40
40
|
"nock": "^13.2.1",
|
41
41
|
"oclif": "^2.0.0-main.5",
|
42
42
|
"qqjs": "^0.3.11",
|