Skip to content

Commit

Permalink
Default to converting folder name for cli plugin to kebab-case (opens…
Browse files Browse the repository at this point in the history
…earch-project#357)

Signed-off-by: Vacha Shah <vachshah@amazon.com>
  • Loading branch information
VachaShah committed May 25, 2021
1 parent 4a47d8c commit 747ef8e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/cli_plugin/install/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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');
Expand Down
3 changes: 2 additions & 1 deletion src/cli_plugin/install/opensearch_dashboards.js
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down

0 comments on commit 747ef8e

Please sign in to comment.