Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default to converting folder name for cli plugin to kebab-case #357

Merged

Conversation

VachaShah
Copy link
Contributor

@VachaShah VachaShah commented May 14, 2021

Description

This change intends to default the folder name for plugins being installed through cli to kebab-case.

To test the change, I ran ./bin/opensearch-dashboards-plugin install file:///anomalyDetectionDashboards-1.0.0.0-beta1.zip to verify the folder name generated which is now in kebab-case: anomaly-detection-dashboards.

Issues Resolved

Part 1 of #322

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

@opensearch-ci-bot
Copy link
Collaborator

❌   DCO Check Failed 41460d3
Run ./dev-tools/signoff-check.sh remotes/origin/main 41460d3d0ed467fdb16ba8b0c4e5c50e9e3faee5 to check locally
Use git commit with -s to add 'Signed-of-by: {EMAIL}' on impacted commits

@VachaShah VachaShah force-pushed the update_cli_plugin_folder_name_case branch from 41460d3 to 12a803d Compare May 14, 2021 00:44
@opensearch-ci-bot
Copy link
Collaborator

✅   DCO Check Passed 12a803d

ohltyler
ohltyler previously approved these changes May 18, 2021
Copy link
Member

@ohltyler ohltyler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks for the change!

dblock
dblock previously approved these changes May 18, 2021
@dblock
Copy link
Member

dblock commented May 19, 2021

We should have a test for this, too. But don't let that hold the merge.

@VachaShah VachaShah dismissed stale reviews from dblock and ohltyler via 917c078 May 19, 2021 22:37
@VachaShah VachaShah force-pushed the update_cli_plugin_folder_name_case branch from 12a803d to 917c078 Compare May 19, 2021 22:37
@opensearch-ci-bot
Copy link
Collaborator

✅   DCO Check Passed 917c078

@VachaShah
Copy link
Contributor Author

We should have a test for this, too. But don't let that hold the merge.

Sure. I have also made a change when checking the existing installation for a plugin which is a pre-check to installing the plugin. I think the kebab-case would have to added there as well.

@@ -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));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@VachaShah does this have any co-relation with removing plugin as well ? https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/src/cli_plugin/remove/remove.js

This would not affect the removing plugin logic as it does not take into consideration the plugin id.

@dblock
Copy link
Member

dblock commented May 20, 2021

This can be done later, but now that we are duplicating logic I would introduce settings.plugins[0].path that would default to kebabCase(id). Then it can be set as well and anywhere we assume ID = path (now at least in 2 places) can refer to it.

@VachaShah
Copy link
Contributor Author

This can be done later, but now that we are duplicating logic I would introduce settings.plugins[0].path that would default to kebabCase(id). Then it can be set as well and anywhere we assume ID = path (now at least in 2 places) can refer to it.

Sure, I can do this as part of the second item on the checklist.

Copy link
Contributor

@mihirsoni mihirsoni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM ! Thanks @VachaShah for the fix.

Copy link
Member

@kavilla kavilla left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@kavilla kavilla merged commit 747ef8e into opensearch-project:main May 25, 2021
@VachaShah VachaShah deleted the update_cli_plugin_folder_name_case branch May 25, 2021 18:45
kavilla pushed a commit that referenced this pull request May 25, 2021
kavilla added a commit to kavilla/OpenSearch-Dashboards-1 that referenced this pull request Jul 1, 2021
opensearch-project#357)"

This reverts commit 747ef8e.

Reverting for now because the full impact is not known and requires
subsequent commits to mitigate confusion related to CLI output.

Also, it seems like in the code there exists verification on the code
that plugins should explicitly be camelCase. So this merits more
discussion.

Issues related:
opensearch-project#322
opensearch-project#465
opensearch-project#366

Signed-off-by: Kawika Avilla <[email protected]>
kavilla added a commit that referenced this pull request Jul 1, 2021
#357)" (#578)

This reverts commit 747ef8e.

Reverting for now because the full impact is not known and requires
subsequent commits to mitigate confusion related to CLI output.

Also, it seems like in the code there exists verification on the code
that plugins should explicitly be camelCase. So this merits more
discussion.

Issues related:
#322
#465
#366

Signed-off-by: Kawika Avilla <[email protected]>
kavilla added a commit to kavilla/OpenSearch-Dashboards-1 that referenced this pull request Jul 1, 2021
opensearch-project#357)" (opensearch-project#578)

This reverts commit 747ef8e.

Reverting for now because the full impact is not known and requires
subsequent commits to mitigate confusion related to CLI output.

Also, it seems like in the code there exists verification on the code
that plugins should explicitly be camelCase. So this merits more
discussion.

Issues related:
opensearch-project#322
opensearch-project#465
opensearch-project#366

Signed-off-by: Kawika Avilla <[email protected]>
kavilla added a commit to kavilla/OpenSearch-Dashboards-1 that referenced this pull request Jul 1, 2021
opensearch-project#357)" (opensearch-project#578)

This reverts commit 747ef8e.

Reverting for now because the full impact is not known and requires
subsequent commits to mitigate confusion related to CLI output.

Also, it seems like in the code there exists verification on the code
that plugins should explicitly be camelCase. So this merits more
discussion.

Issues related:
opensearch-project#322
opensearch-project#465
opensearch-project#366

Signed-off-by: Kawika Avilla <[email protected]>
kavilla added a commit that referenced this pull request Jul 1, 2021
#357)" (#583)

This reverts commit 747ef8e.

Reverting for now because the full impact is not known and requires
subsequent commits to mitigate confusion related to CLI output.

Also, it seems like in the code there exists verification on the code
that plugins should explicitly be camelCase. So this merits more
discussion.

Issues related:
#322
#465
#366

Signed-off-by: Kawika Avilla <[email protected]>
kavilla added a commit that referenced this pull request Jul 1, 2021
#357)" (#584)

This reverts commit 747ef8e.

Reverting for now because the full impact is not known and requires
subsequent commits to mitigate confusion related to CLI output.

Also, it seems like in the code there exists verification on the code
that plugins should explicitly be camelCase. So this merits more
discussion.

Issues related:
#322
#465
#366

Signed-off-by: Kawika Avilla <[email protected]>
kavilla added a commit to kavilla/OpenSearch-Dashboards-1 that referenced this pull request Jul 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants