From 917c078c1db74d18689e85d8c071f62610ce2f56 Mon Sep 17 00:00:00 2001 From: Vacha Shah Date: Thu, 13 May 2021 16:19:36 -0700 Subject: [PATCH] Default to converting folder name for cli plugin to kebab-case Signed-off-by: Vacha Shah --- src/cli_plugin/install/install.js | 3 ++- src/cli_plugin/install/opensearch_dashboards.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cli_plugin/install/install.js b/src/cli_plugin/install/install.js index e76755c3b7ff..e48c7a1c1349 100644 --- a/src/cli_plugin/install/install.js +++ b/src/cli_plugin/install/install.js @@ -41,6 +41,7 @@ import { cleanPrevious, cleanArtifacts } from './cleanup'; import { extract, getPackData } from './pack'; import { renamePlugin } from './rename'; import { existingInstall, assertVersion } from './opensearch_dashboards'; +import { kebabCase } from 'lodash'; const mkdir = promisify(Fs.mkdir); @@ -62,7 +63,7 @@ export async function install(settings, logger) { assertVersion(settings); - const targetDir = path.join(settings.pluginDir, settings.plugins[0].id); + const targetDir = path.join(settings.pluginDir, kebabCase(settings.plugins[0].id)); await renamePlugin(settings.workingPath, targetDir); logger.log('Plugin installation complete'); diff --git a/src/cli_plugin/install/opensearch_dashboards.js b/src/cli_plugin/install/opensearch_dashboards.js index 5f31372f40d0..1aaf6a5cdf56 100644 --- a/src/cli_plugin/install/opensearch_dashboards.js +++ b/src/cli_plugin/install/opensearch_dashboards.js @@ -32,12 +32,13 @@ import path from 'path'; import { statSync } from 'fs'; +import { kebabCase } from 'lodash'; import { versionSatisfies, cleanVersion } from '../../legacy/utils/version'; export function existingInstall(settings, logger) { try { - statSync(path.join(settings.pluginDir, settings.plugins[0].id)); + statSync(path.join(settings.pluginDir, kebabCase(settings.plugins[0].id))); logger.error( `Plugin ${settings.plugins[0].id} already exists, please remove before installing a new version`