Skip to content

Commit

Permalink
fix(cli): minor fixes for garden create module command
Browse files Browse the repository at this point in the history
  • Loading branch information
edvald committed Feb 20, 2020
1 parent 63e0d8c commit 97afb22
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions garden-service/src/commands/create/create-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -215,10 +215,14 @@ export class CreateModuleCommand extends Command<CreateModuleArgs, CreateModuleO
if (projectConfig) {
const allProviders = flatten([
projectConfig.providers,
...projectConfig.environments.map((e) => 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(
Expand Down

0 comments on commit 97afb22

Please sign in to comment.