@@ -35,7 +35,7 @@ e.g. If you have a core plugin that has a 'hello' command, installing a user-ins
35
35
for ( let name of argv ) {
36
36
if ( aliases [ name ] === null ) this . error ( `${ name } is blacklisted` )
37
37
name = aliases [ name ] || name
38
- let p = parsePlugin ( name )
38
+ let p = await this . parsePlugin ( name )
39
39
let plugin
40
40
if ( p . type === 'npm' ) {
41
41
cli . action . start ( `Installing plugin ${ chalk . cyan ( this . plugins . friendlyName ( p . name ) ) } ` )
@@ -50,18 +50,19 @@ e.g. If you have a core plugin that has a 'hello' command, installing a user-ins
50
50
cli . action . stop ( `installed v${ plugin . version } ` )
51
51
}
52
52
}
53
- }
54
53
55
- function parsePlugin ( input : string ) : { name : string , tag : string , type : 'npm' } | { url : string , type : 'repo' } {
56
- if ( input . includes ( '@' ) && input . includes ( '/' ) ) {
57
- input = input . slice ( 1 )
58
- let [ name , tag = 'latest' ] = input . split ( '@' )
59
- return { name : '@' + name , tag, type : 'npm' }
60
- } else if ( input . includes ( '/' ) ) {
61
- if ( input . includes ( ':' ) ) return { url : input , type : 'repo' }
62
- else return { url : `https://github.com/${ input } ` , type : 'repo' }
63
- } else {
64
- let [ name , tag = 'latest' ] = input . split ( '@' )
65
- return { name, tag, type : 'npm' }
54
+ async parsePlugin ( input : string ) : Promise < { name : string , tag : string , type : 'npm' } | { url : string , type : 'repo' } > {
55
+ if ( input . includes ( '@' ) && input . includes ( '/' ) ) {
56
+ input = input . slice ( 1 )
57
+ let [ name , tag = 'latest' ] = input . split ( '@' )
58
+ return { name : '@' + name , tag, type : 'npm' }
59
+ } else if ( input . includes ( '/' ) ) {
60
+ if ( input . includes ( ':' ) ) return { url : input , type : 'repo' }
61
+ else return { url : `https://github.com/${ input } ` , type : 'repo' }
62
+ } else {
63
+ let [ name , tag = 'latest' ] = input . split ( '@' )
64
+ name = await this . plugins . maybeUnfriendlyName ( name )
65
+ return { name, tag, type : 'npm' }
66
+ }
66
67
}
67
68
}
0 commit comments