@@ -55,6 +55,11 @@ export default class Plugins {
55
55
await this . createPJSON ( )
56
56
let plugin
57
57
const add = force ? [ 'add' , '--force' ] : [ 'add' ]
58
+ const invalidPluginError = new CLIError ( 'plugin is invalid' , {
59
+ suggestions : [
60
+ 'Plugin failed to install because it does not appear to be a valid CLI plugin.\nIf you are sure it is, contact the CLI developer noting this error.' ,
61
+ ] ,
62
+ } )
58
63
if ( name . includes ( ':' ) ) {
59
64
// url
60
65
const url = name
@@ -63,7 +68,7 @@ export default class Plugins {
63
68
plugin = await Config . load ( { devPlugins : false , userPlugins : false , root : path . join ( this . config . dataDir , 'node_modules' , name ) , name} )
64
69
await this . refresh ( plugin . root )
65
70
if ( ! plugin . valid && ! this . config . plugins . find ( p => p . name === '@oclif/plugin-legacy' ) ) {
66
- throw new Error ( 'plugin is invalid' )
71
+ throw invalidPluginError
67
72
}
68
73
await this . add ( { name, url, type : 'user' } )
69
74
} else {
@@ -76,7 +81,7 @@ export default class Plugins {
76
81
await this . yarn . exec ( [ ...add , `${ name } @${ tag } ` ] , yarnOpts )
77
82
plugin = await Config . load ( { devPlugins : false , userPlugins : false , root : path . join ( this . config . dataDir , 'node_modules' , name ) , name} )
78
83
if ( ! plugin . valid && ! this . config . plugins . find ( p => p . name === '@oclif/plugin-legacy' ) ) {
79
- throw new Error ( 'plugin is invalid' )
84
+ throw invalidPluginError
80
85
}
81
86
await this . refresh ( plugin . root )
82
87
await this . add ( { name, tag : range || tag , type : 'user' } )
0 commit comments