File tree Expand file tree Collapse file tree 2 files changed +37
-2
lines changed Expand file tree Collapse file tree 2 files changed +37
-2
lines changed Original file line number Diff line number Diff line change @@ -3,8 +3,7 @@ const config = require('config');
3
3
4
4
exports . desc = 'List versions available in your project' ;
5
5
exports . category = 'services' ;
6
- exports . weight = 4 ;
7
- exports . action = 'versions:list' ;
6
+ exports . weight = 3 ;
8
7
9
8
exports . run = function ( { opts } ) {
10
9
let { key } = opts ;
Original file line number Diff line number Diff line change
1
+ const request = require ( 'request-promise-native' ) ;
2
+ const config = require ( 'config' ) ;
3
+
4
+ exports . desc = 'List versions available in your project' ;
5
+ exports . category = 'services' ;
6
+ exports . weight = 4 ;
7
+ exports . action = 'versions:versionId' ;
8
+
9
+ exports . run = function ( { opts } ) {
10
+ let { key } = opts ;
11
+ const { version } = opts ;
12
+
13
+ if ( ! key && opts . token ) {
14
+ console . warn (
15
+ 'Using `rdme` with --token has been deprecated. Please use --key and --id instead' ,
16
+ ) ;
17
+ [ key ] = opts . token . split ( '-' ) ;
18
+ }
19
+
20
+ if ( ! key ) {
21
+ return Promise . reject ( new Error ( 'No api key provided. Please use --key' ) ) ;
22
+ }
23
+
24
+ if ( ! version ) {
25
+ return Promise . reject (
26
+ new Error ( 'No version provided. Please specify a semantic version using --version' ) ,
27
+ ) ;
28
+ }
29
+
30
+ return request
31
+ . get ( `${ config . host } /api/v1/version/${ version } ` , {
32
+ json : true ,
33
+ auth : { user : key } ,
34
+ } )
35
+ . catch ( err => Promise . reject ( new Error ( err ) ) ) ;
36
+ } ;
You can’t perform that action at this time.
0 commit comments