Fix loading plugin help (#4463)
This commit is contained in:
parent
9b8b40c570
commit
201fb8b62b
|
|
@ -11,14 +11,14 @@ export async function registerPluginOptions(yargsInstance, plugins) {
|
|||
for (const pluginName of plugins) {
|
||||
try {
|
||||
// Dynamically import the plugin
|
||||
const plugin = await importGlobalSilent(pluginName);
|
||||
let { default: plugin } = await importGlobalSilent(pluginName);
|
||||
// If the plugin exports a function to get CLI options, merge them
|
||||
if (plugin && typeof plugin.getCliOptions === 'function') {
|
||||
const options = plugin.getCliOptions();
|
||||
yargsInstance.options(options);
|
||||
} else {
|
||||
try {
|
||||
const plugin = await import(pluginName);
|
||||
const { default: plugin } = await import(pluginName);
|
||||
if (plugin && typeof plugin.getCliOptions === 'function') {
|
||||
const options = plugin.getCliOptions();
|
||||
yargsInstance.options(options);
|
||||
|
|
|
|||
Loading…
Reference in New Issue