diff --git a/lib/cli/commands-schema/resolve-final.js b/lib/cli/commands-schema/resolve-final.js index f7ea05af0..791c0e1f5 100644 --- a/lib/cli/commands-schema/resolve-final.js +++ b/lib/cli/commands-schema/resolve-final.js @@ -50,11 +50,7 @@ module.exports = (loadedPlugins, { providerName }) => { for (const hookName of Object.keys(loadedPlugin.hooks)) { const awsCommandName = optionalServiceCommandsHooksMap.get(hookName); if (awsCommandName && !commands.has(awsCommandName)) { - const awsCommandSchema = awsServiceCommands.get(awsCommandName); - const schema = { - ...awsCommandSchema, - options: { ...awsCommandSchema.options }, - }; + const schema = _.merge({}, awsServiceCommands.get(awsCommandName)); for (const awsSpecificOptionName of awsSpecificOptionNames) { delete schema.options[awsSpecificOptionName]; } @@ -70,13 +66,15 @@ module.exports = (loadedPlugins, { providerName }) => { if (commandConfig.type === 'entrypoint') continue; const fullCommandName = `${commandPrefix}${commandName}`; if (commandConfig.type !== 'container') { - const schema = commands.get(fullCommandName) || { - usage: commandConfig.usage, - serviceDependencyMode: 'required', - isHidden: commandConfig.isHidden, - noSupportNotice: commandConfig.noSupportNotice, - options: {}, - }; + const schema = commands.has(fullCommandName) + ? _.merge({}, commands.get(fullCommandName)) + : { + usage: commandConfig.usage, + serviceDependencyMode: 'required', + isHidden: commandConfig.isHidden, + noSupportNotice: commandConfig.noSupportNotice, + options: {}, + }; if (commandConfig.lifecycleEvents) schema.lifecycleEvents = commandConfig.lifecycleEvents; if (commandConfig.options) {