From 97afb22342ac1674572553118488a1afe203b919 Mon Sep 17 00:00:00 2001 From: Jon Edvald Date: Thu, 20 Feb 2020 15:37:46 +0100 Subject: [PATCH] fix(cli): minor fixes for garden create module command --- garden-service/src/commands/create/create-module.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/garden-service/src/commands/create/create-module.ts b/garden-service/src/commands/create/create-module.ts index be17660a15..bc1711ba3e 100644 --- a/garden-service/src/commands/create/create-module.ts +++ b/garden-service/src/commands/create/create-module.ts @@ -24,13 +24,13 @@ import { getConfigFilePath, isDirectory } from "../../util/fs" import { loadConfig, findProjectConfig } from "../../config/base" import { resolve, basename, relative } from "path" import { GardenBaseError, ParameterError } from "../../exceptions" -import { getModuleTypes } from "../../plugins" +import { getModuleTypes, getPluginBaseNames } from "../../plugins" import { addConfig } from "./helpers" import { supportedPlugins } from "../../plugins/plugins" import { baseModuleSpecSchema } from "../../config/module" import { renderConfigReference } from "../../docs/config" import { DOCS_BASE_URL } from "../../constants" -import { flatten } from "lodash" +import { flatten, keyBy } from "lodash" import { fixedPlugins } from "../../config/project" import { deline, wordWrap, truncate } from "../../util/string" import { joi } from "../../config/common" @@ -215,10 +215,14 @@ export class CreateModuleCommand extends Command e.providers || []), + ...(projectConfig.environments || []).map((e) => e.providers || []), ]) - if (!allProviders.map((p) => p.name).includes(pluginName)) { + const allProvidersWithBases = flatten( + allProviders.map((p) => getPluginBaseNames(p.name, keyBy(supportedPlugins, "name"))) + ) + + if (!allProvidersWithBases.includes(pluginName)) { log.warn( chalk.yellow( wordWrap(