Skip to content

Commit

Permalink
Default to converting folder name for cli plugin to kebab-case
Browse files Browse the repository at this point in the history
Signed-off-by: Vacha Shah <[email protected]>
  • Loading branch information
VachaShah committed May 19, 2021
1 parent a408c7a commit 917c078
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 917c078

Please sign in to comment.