File tree Expand file tree Collapse file tree 3 files changed +389
-2
lines changed
Expand file tree Collapse file tree 3 files changed +389
-2
lines changed Original file line number Diff line number Diff line change 99 " upload" ,
1010 " download"
1111 ],
12- "version" : " 4.4.1 " ,
12+ "version" : " 4.4.0 " ,
1313 "author" : " Box <oss@box.com>" ,
1414 "license" : " Apache-2.0" ,
1515 "main" : " src/index.js" ,
2727 "@oclif/plugin-autocomplete" : " ^3.2.11" ,
2828 "@oclif/plugin-help" : " ^6.2.18" ,
2929 "@oclif/plugin-not-found" : " ^3.2.71" ,
30+ "@oclif/plugin-update" : " 3.2.4" ,
3031 "@oclif/plugin-version" : " ^2.2.16" ,
32+ "@oclif/table" : " ^0.4.14" ,
33+ "@octokit/rest" : " ^22.0.0" ,
3134 "archiver" : " ^3.0.0" ,
3235 "box-node-sdk" : " ^3.7.0" ,
3336 "box-typescript-sdk-gen" : " ^1.17.1" ,
3841 "debug" : " ^4.4.0" ,
3942 "express" : " ^4.21.1" ,
4043 "fs-extra" : " ^10.1.0" ,
44+ "got" : " ^14.6.1" ,
4145 "inquirer" : " ^8.2.7" ,
4246 "js-yaml" : " ^3.13.1" ,
4347 "keychain" : " ^1.4.0" ,
4751 "nanoid" : " ^3.3.8" ,
4852 "open" : " ^10.1.0" ,
4953 "ora" : " ^5.4.1" ,
50- "p-event" : " ^2.3.1"
54+ "p-event" : " ^2.3.1" ,
55+ "semver" : " ^7.7.3"
5156 },
5257 "devDependencies" : {
5358 "@oclif/test" : " ^3.2.15" ,
138143 "web-links" : {
139144 "description" : " Manage web links"
140145 }
146+ },
147+ "update" : {
148+ "github" : {
149+ "owner" : " box" ,
150+ "repo" : " boxcli"
151+ }
141152 }
142153 },
143154 "scripts" : {
150161 "postpack" : " rm -f oclif.manifest.json && rm -f npm-shrinkwrap.json" ,
151162 "version" : " oclif readme --multi && npm run updatemd && git add README.md && git add docs" ,
152163 "build" : " oclif pack:macos && rm -rf tmp/ && oclif pack:win && rm -rf tmp/" ,
164+ "build:tarballs" : " oclif pack:tarballs --no-xz --parallel" ,
153165 "changelog" : " node node_modules/standard-version/bin/cli.js --skip.commit --skip.push --skip.tag --dry-run" ,
154166 "license" : " generate-license-file --overwrite"
155167 },
Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+ const { sort } = require ( 'semver' ) ;
3+ const path = require ( 'path' ) ;
4+ const GitHubUpdater = require ( '../github-updater' ) ;
5+ const UpdateCommand =
6+ require ( '@oclif/plugin-update/lib/commands/update' ) . default ;
7+ // const { printTable } = require('@oclif/table');
8+
9+ class GithubUpdatecommand extends UpdateCommand {
10+ async run ( ) {
11+ const { args, flags } = await this . parse ( UpdateCommand ) ;
12+ const updater = new GitHubUpdater ( this . config ) ;
13+ if ( flags . available ) {
14+ const index = await updater . fetchVersionIndex ( ) ;
15+ const allVersions = sort ( Object . keys ( index ) ) . reverse ( ) ;
16+ const localVersions = await updater . findLocalVersions ( ) ;
17+
18+ const table = allVersions . map ( ( version ) => {
19+ const location =
20+ localVersions . find ( ( l ) => path . basename ( l ) . startsWith ( version ) ) ||
21+ index [ version ] ;
22+ return { version, location } ;
23+ } ) ;
24+
25+ // printTable({
26+ // columns: [
27+ // { key: 'version' },
28+ // { key: 'location' },
29+ // ],
30+ // data: table,
31+ // });
32+ console . log ( table ) ;
33+ return ;
34+ }
35+
36+ if ( args . channel && flags . version ) {
37+ this . error ( 'You cannot specify both a version and a channel.' ) ;
38+ }
39+
40+ updater . runUpdate ( {
41+ channel : args . channel ,
42+ autoUpdate : flags . autoupdate ,
43+ force : flags . force ,
44+ version : flags . interactive
45+ ? await this . promptForVersion ( updater )
46+ : flags . version ,
47+ } ) ;
48+ }
49+ }
50+
51+ module . exports = GithubUpdatecommand ;
You can’t perform that action at this time.
0 commit comments