@@ -81,9 +81,11 @@ async function invoke (pluginName, options = {}, context = process.cwd()) {
81
81
throw new Error ( `Plugin ${ id } does not have a generator.` )
82
82
}
83
83
84
- // resolve options if no command line options are passed, and the plugin
85
- // contains a prompt module.
86
- if ( ! Object . keys ( options ) . length ) {
84
+ // resolve options if no command line options (other than --registry) are passed,
85
+ // and the plugin contains a prompt module.
86
+ // eslint-disable-next-line prefer-const
87
+ let { registry, ...pluginOptions } = options
88
+ if ( ! Object . keys ( pluginOptions ) . length ) {
87
89
let pluginPrompts = loadModule ( `${ id } /prompts` , context )
88
90
if ( pluginPrompts ) {
89
91
if ( typeof pluginPrompts === 'function' ) {
@@ -92,14 +94,17 @@ async function invoke (pluginName, options = {}, context = process.cwd()) {
92
94
if ( typeof pluginPrompts . getPrompts === 'function' ) {
93
95
pluginPrompts = pluginPrompts . getPrompts ( pkg )
94
96
}
95
- options = await inquirer . prompt ( pluginPrompts )
97
+ pluginOptions = await inquirer . prompt ( pluginPrompts )
96
98
}
97
99
}
98
100
99
101
const plugin = {
100
102
id,
101
103
apply : pluginGenerator ,
102
- options
104
+ options : {
105
+ registry,
106
+ ...pluginOptions
107
+ }
103
108
}
104
109
105
110
await runGenerator ( context , plugin , pkg )
@@ -134,7 +139,7 @@ async function runGenerator (context, plugin, pkg = getPkg(context)) {
134
139
log ( )
135
140
const packageManager =
136
141
loadOptions ( ) . packageManager || ( hasProjectYarn ( context ) ? 'yarn' : 'npm' )
137
- await installDeps ( context , packageManager )
142
+ await installDeps ( context , packageManager , plugin . options . registry )
138
143
}
139
144
140
145
if ( createCompleteCbs . length ) {
0 commit comments