diff --git a/package.json b/package.json index 68f4151bc..8604667e3 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@oclif/core", "description": "base library for oclif CLIs", - "version": "1.26.1", + "version": "1.26.2", "author": "Salesforce", "bugs": "https://github.com/oclif/core/issues", "dependencies": { diff --git a/src/config/config.ts b/src/config/config.ts index 8df1f9311..eb8b12bd4 100644 --- a/src/config/config.ts +++ b/src/config/config.ts @@ -311,6 +311,10 @@ export class Config implements IConfig { await search(module).call(context, {...opts as any, config: this}) final.successes.push({plugin: p, result}) + if (p.name === '@oclif/plugin-legacy' && event === 'init') { + this.insertLegacyPlugins(result as IPlugin[]) + } + debug('done') } catch (error: any) { final.failures.push({plugin: p, error: error as Error}) @@ -745,6 +749,14 @@ export class Config implements IConfig { }) return commandPlugins[0] } + + private insertLegacyPlugins(plugins: IPlugin[]) { + for (const plugin of plugins) { + const idx = this.plugins.findIndex(p => p.name === plugin.name) + if (idx !== -1) this.plugins = this.plugins.splice(idx, 1, plugin) + this.loadCommands(plugin) + } + } } // when no manifest exists, the default is calculated. This may throw, so we need to catch it