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

Create Plugin: Improve cli args and add docs #1030

Merged
merged 7 commits into from
Aug 6, 2024

Conversation

jackw
Copy link
Collaborator

@jackw jackw commented Aug 2, 2024

What this PR does / why we need it:
With the release of create-plugin@5.0.0 we simplified the prompts. This PR enhances the cli args by:

  • adds kebab-case aliases to make it easier for users to type
  • provides a warning message if an unknown arg is passed in and ignores unknown cli args
  • disables and warns if hasBackend is passed in alongside pluginType="panel"
  • updates docs prompts page explaining how to use cli args to bypass prompts

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

📦 Published PR as canary version: Canary Versions

✨ Test out this PR locally via:

npm install @grafana/create-plugin@5.1.0-canary.1030.d9383c4.0
# or 
yarn add @grafana/create-plugin@5.1.0-canary.1030.d9383c4.0

@jackw jackw added type/docs Changes only affect the documentation create-plugin related to the create-plugin tool minor Increment the minor version when merged release Create a release when this pr is merged labels Aug 2, 2024
@jackw jackw self-assigned this Aug 2, 2024
@jackw jackw requested a review from a team as a code owner August 2, 2024 10:40
@jackw jackw requested review from Ukochka and removed request for a team August 2, 2024 10:40
Copy link

github-actions bot commented Aug 2, 2024

Hello! 👋 This repository uses Auto for releasing packages using PR labels.

✨ This PR can be merged and will trigger a new minor release.
NOTE: When merging a PR with the release label please avoid merging another PR. For further information see here.

Copy link
Contributor

@sympatheticmoose sympatheticmoose left a comment

Choose a reason for hiding this comment

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

Nice! No blockers from me other than the bit about gh workflows being added in. Would be good to have a style review from @josmperez

@sympatheticmoose sympatheticmoose requested review from josmperez and removed request for Ukochka August 2, 2024 10:58
@jackw jackw changed the title Create Plugin: Alias cli args to kebab-case and add docs Create Plugin: Improve cli args and add docs Aug 2, 2024
@jackw jackw force-pushed the jackw/create-plugin-cli-args branch from a7befb1 to f3736ae Compare August 2, 2024 13:50
@jackw jackw requested review from a team and leventebalogh and removed request for a team August 2, 2024 13:51
Copy link
Contributor

@josmperez josmperez left a comment

Choose a reason for hiding this comment

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

Some suggestions, but overall LGTM.

@@ -13,7 +13,7 @@ sidebar_position: 40

# Prompts

When running the `create-plugin` command, the following prompts appear:
When running the `create-plugin` command, the following prompts will appear.
Copy link
Contributor

Choose a reason for hiding this comment

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

preferred style is present indicative tense

@@ -118,7 +118,8 @@ export function getTemplateData(cliArgs?: GenerateCliArgs): TemplateData {
...EXTRA_TEMPLATE_VARIABLES,
pluginId: normalizeId(cliArgs.pluginName, cliArgs.orgName, cliArgs.pluginType),
pluginName: cliArgs.pluginName,
hasBackend: cliArgs.hasBackend,
// check plugintype and hasBackend as they can both be passed via user input (cli args).
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// check plugintype and hasBackend as they can both be passed via user input (cli args).
// check plugintype and hasBackend as they can both be passed through user input (CLI args).

Co-authored-by: Joseph Perez <45749060+josmperez@users.noreply.github.com>
Copy link
Collaborator

@leventebalogh leventebalogh left a comment

Choose a reason for hiding this comment

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

Nice 🚀

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not necessarily for this PR, but I think it would make sense to change to title from "Prompts" to something like "CLI prompts" (or similar) to make it more clear when navigating in the side menu.

Copy link
Contributor

@sunker sunker left a comment

Choose a reason for hiding this comment

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

Nice! Tested and it works as expected.

Nit and up to you: Now that we use kebab case in the docs, you may want to use this casing also in our npm scripts.

@jackw jackw merged commit 54c083c into main Aug 6, 2024
13 checks passed
@jackw jackw deleted the jackw/create-plugin-cli-args branch August 6, 2024 07:31
@jackw
Copy link
Collaborator Author

jackw commented Aug 6, 2024

Nice! Tested and it works as expected.

Nit and up to you: Now that we use kebab case in the docs, you may want to use this casing also in our npm scripts.

Thanks @sunker, I think we can update those separately if need be as there's also the CI workflow that is using the camel cased args. 👍

@grafana-plugins-platform-bot
Copy link

🚀 PR was released in @grafana/create-plugin@5.1.0 🚀

@grafana-plugins-platform-bot grafana-plugins-platform-bot bot added the released This issue/pull request has been released. label Aug 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
create-plugin related to the create-plugin tool minor Increment the minor version when merged release Create a release when this pr is merged released This issue/pull request has been released. type/docs Changes only affect the documentation
Projects
Development

Successfully merging this pull request may close these issues.

5 participants