@oclif/plugin-update 4.5.10 → 4.6.0

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
@@ -26,10 +26,11 @@ update the oclif-example CLI
26
26
 
27
27
  ```
28
28
  USAGE
29
- $ oclif-example update [CHANNEL] [--force | | [-a | -v <value> | -i]]
29
+ $ oclif-example update [CHANNEL] [--force | | [-a | -v <value> | -i]] [-b ]
30
30
 
31
31
  FLAGS
32
32
  -a, --available See available versions.
33
+ -b, --verbose Show more details about the available versions.
33
34
  -i, --interactive Interactively select version to install. This is ignored if a channel is provided.
34
35
  -v, --version=<value> Install a specific version.
35
36
  --force Force a re-download of the requested version.
@@ -55,7 +56,7 @@ EXAMPLES
55
56
  $ oclif-example update --available
56
57
  ```
57
58
 
58
- _See code: [src/commands/update.ts](https://github.com/oclif/plugin-update/blob/v4.5.10/src/commands/update.ts)_
59
+ _See code: [src/commands/update.ts](https://github.com/oclif/plugin-update/blob/v4.6.0/src/commands/update.ts)_
59
60
  <!-- commandsstop -->
60
61
 
61
62
  # Contributing
@@ -13,6 +13,7 @@ export default class UpdateCommand extends Command {
13
13
  available: Interfaces.BooleanFlag<boolean>;
14
14
  force: Interfaces.BooleanFlag<boolean>;
15
15
  interactive: Interfaces.BooleanFlag<boolean>;
16
+ verbose: Interfaces.BooleanFlag<boolean>;
16
17
  version: Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
17
18
  };
18
19
  run(): Promise<void>;
@@ -1,9 +1,9 @@
1
1
  import select from '@inquirer/select';
2
2
  import { Args, Command, Flags, ux } from '@oclif/core';
3
+ import { printTable } from '@oclif/table';
3
4
  import { got } from 'got';
4
5
  import { basename } from 'node:path';
5
6
  import { sort } from 'semver';
6
- import TtyTable from 'tty-table';
7
7
  import { Updater } from '../update.js';
8
8
  export default class UpdateCommand extends Command {
9
9
  static args = {
@@ -44,6 +44,11 @@ export default class UpdateCommand extends Command {
44
44
  description: 'Interactively select version to install. This is ignored if a channel is provided.',
45
45
  exclusive: ['version'],
46
46
  }),
47
+ verbose: Flags.boolean({
48
+ char: 'b',
49
+ dependsOn: ['available'],
50
+ description: 'Show more details about the available versions.',
51
+ }),
47
52
  version: Flags.string({
48
53
  char: 'v',
49
54
  description: 'Install a specific version.',
@@ -55,24 +60,31 @@ export default class UpdateCommand extends Command {
55
60
  const updater = new Updater(this.config);
56
61
  if (flags.available) {
57
62
  const { distTags, index, localVersions } = await lookupVersions(updater, this.config);
58
- const headers = [
59
- { align: 'left', value: 'Location' },
60
- { align: 'left', value: 'Version' },
61
- ];
62
- if (distTags) {
63
- headers.push({ align: 'left', value: 'Channel' });
64
- }
65
- // eslint-disable-next-line new-cap
66
- const t = TtyTable(headers, sort(Object.keys(index))
67
- .reverse()
68
- .map((version) => {
63
+ const data = Object.keys(index).map((version) => {
69
64
  const location = localVersions.find((l) => basename(l).startsWith(version)) || index[version];
70
- if (distTags) {
71
- return [location, version, distTags[version] ?? ''];
72
- }
73
- return [location, version];
74
- }), { compact: true });
75
- ux.stdout(t.render());
65
+ const channel = distTags[version] === 'latest'
66
+ ? 'stable'
67
+ : distTags[version] === 'latest-rc'
68
+ ? 'stable-rc'
69
+ : distTags[version];
70
+ return {
71
+ channel,
72
+ downloaded: location.includes('http') ? '' : 'true',
73
+ location,
74
+ version: this.config.version === version ? `${ux.colorize('yellowBright', version)} (current)` : version,
75
+ };
76
+ });
77
+ printTable({
78
+ borderStyle: 'vertical-with-outline',
79
+ columns: flags.verbose
80
+ ? ['version', 'channel', 'downloaded', 'location']
81
+ : ['version', 'channel', 'downloaded'],
82
+ data,
83
+ headerOptions: {
84
+ formatter: 'capitalCase',
85
+ },
86
+ overflow: 'wrap',
87
+ });
76
88
  return;
77
89
  }
78
90
  if (args.channel && flags.version) {
package/dist/update.js CHANGED
@@ -165,7 +165,7 @@ ${binPathEnvVar}="\$DIR/${bin}" ${redirectedEnvVar}=1 "$DIR/../${version}/bin/${
165
165
  return versions.map((file) => basename(file)).find((file) => file.startsWith(version));
166
166
  }
167
167
  async refreshConfig(version) {
168
- this.config = (await Config.load({ root: join(this.clientRoot, version) }));
168
+ this.config = await Config.load({ root: join(this.clientRoot, version) });
169
169
  }
170
170
  // removes any unused CLIs
171
171
  async tidy() {
@@ -64,6 +64,16 @@
64
64
  "allowNo": false,
65
65
  "type": "boolean"
66
66
  },
67
+ "verbose": {
68
+ "char": "b",
69
+ "dependsOn": [
70
+ "available"
71
+ ],
72
+ "description": "Show more details about the available versions.",
73
+ "name": "verbose",
74
+ "allowNo": false,
75
+ "type": "boolean"
76
+ },
67
77
  "version": {
68
78
  "char": "v",
69
79
  "description": "Install a specific version.",
@@ -96,5 +106,5 @@
96
106
  ]
97
107
  }
98
108
  },
99
- "version": "4.5.10"
109
+ "version": "4.6.0"
100
110
  }
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@oclif/plugin-update",
3
- "version": "4.5.10",
3
+ "version": "4.6.0",
4
4
  "author": "Salesforce",
5
5
  "bugs": "https://github.com/oclif/plugin-update/issues",
6
6
  "dependencies": {
7
7
  "@inquirer/select": "^2.5.0",
8
8
  "@oclif/core": "^4",
9
+ "@oclif/table": "^0.1.12",
9
10
  "ansis": "^3.3.2",
10
11
  "debug": "^4.3.7",
11
12
  "filesize": "^6.1.0",
12
13
  "got": "^13",
13
14
  "proxy-agent": "^6.4.0",
14
15
  "semver": "^7.6.3",
15
- "tar-fs": "^2.1.1",
16
- "tty-table": "^4.2.3"
16
+ "tar-fs": "^2.1.1"
17
17
  },
18
18
  "devDependencies": {
19
19
  "@commitlint/config-conventional": "^19",