-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docs: Update the "Prompts" page (#1042)
Co-authored-by: Jack Westbrook <[email protected]> Co-authored-by: Joe Perez <[email protected]>
- Loading branch information
1 parent
e54ad1a
commit 8b23d1b
Showing
10 changed files
with
158 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 0 additions & 30 deletions
30
docusaurus/docs/migration-guides/update-create-plugin-versions.mdx
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
--- | ||
id: cli-commands | ||
title: CLI commands | ||
description: Reference for commands available in the create-plugin tool. | ||
keywords: | ||
- grafana | ||
- plugins | ||
- plugin | ||
- create-plugin | ||
- prompts | ||
- commands | ||
sidebar_position: 40 | ||
--- | ||
|
||
import ScaffoldNPM from '@snippets/createplugin-scaffold.npm.md'; | ||
import ScaffoldPNPM from '@snippets/createplugin-scaffold.pnpm.md'; | ||
import ScaffoldYarn from '@snippets/createplugin-scaffold.yarn.md'; | ||
import UpdateNPM from '@snippets/createplugin-update.npm.md'; | ||
import UpdatePNPM from '@snippets/createplugin-update.pnpm.md'; | ||
import UpdateYarn from '@snippets/createplugin-update.yarn.md'; | ||
import UpdateForceNPM from '@snippets/createplugin-update-force.npm.md'; | ||
import UpdateForcePNPM from '@snippets/createplugin-update-force.pnpm.md'; | ||
import UpdateForceYarn from '@snippets/createplugin-update-force.yarn.md'; | ||
|
||
# CLI commands | ||
|
||
Below you can find the available commands in `@grafana/create-plugin`. | ||
|
||
## create-plugin | ||
|
||
Use the `create-plugin` command to scaffold your plugin. | ||
|
||
<CodeSnippets | ||
snippets={[ | ||
{ component: ScaffoldNPM, label: 'npm' }, | ||
{ component: ScaffoldPNPM, label: 'pnpm' }, | ||
{ component: ScaffoldYarn, label: 'yarn' }, | ||
]} | ||
groupId="package-manager" | ||
queryString="current-package-manager" | ||
/> | ||
|
||
|
||
When running the `create-plugin` command, the following prompts appear: | ||
|
||
### Select a plugin type | ||
|
||
``` | ||
? Select a plugin type … | ||
❯ App (add custom pages, UI extensions and bundle other plugins) | ||
Data source (query data from a custom source) | ||
Panel (add a visualization for data or a widget) | ||
App with Scenes (create dynamic dashboards in app pages) | ||
``` | ||
|
||
To learn more about the various types of plugins, refer to [Grafana plugin types and usage](../key-concepts/plugin-types-usage.md). | ||
|
||
For more information on how Scenes allows you to create dashboard-like experiences in app plugins, see the [Scenes](https://grafana.com/developers/scenes) documentation. | ||
|
||
### Add a backend to support server-side functionality? (y/N) | ||
|
||
If you are creating an app or a data source plugin, you will be asked whether to additionally add a backend component. | ||
|
||
Backend plugins offer powerful features such as: | ||
|
||
- Enable [Grafana Alerting](https://grafana.com/docs/grafana/latest/alerting/) for data sources. | ||
- Connect to non-HTTP services to which a browser normally can’t connect. For example, SQL database servers. | ||
- Keep state between users. For example, query caching for data sources. | ||
- Use custom authentication methods and/or authorization checks that aren’t supported in Grafana. | ||
- Use a custom data source request proxy. | ||
|
||
To learn more, refer to [Backend plugins](../key-concepts/backend-plugins/index.md). | ||
|
||
### Enter a name for your plugin | ||
|
||
Give your plugin a name which helps identify its purpose. | ||
|
||
### Enter your organization name (usually your Grafana Cloud org) | ||
|
||
Enter the name of your organization. This must be your [Grafana Cloud](https://grafana.com/signup/) organization. With the organization name you can [sign](../publish-a-plugin/sign-a-plugin.md) and optionally [publish](../publish-a-plugin/publish-or-update-a-plugin.md) the plugin to the [Grafana plugin catalog](https://grafana.com/grafana/plugins). | ||
|
||
### Bypass prompts | ||
|
||
You can bypass all the preceding prompts by using `create-plugin` CLI arguments. | ||
To scaffold a plugin with the CLI arguments, pass them to the `create-plugin` command like so: | ||
|
||
``` | ||
npx @grafana/create-plugin \ | ||
--plugin-type="app" \ | ||
--plugin-name="myPlugin" \ | ||
--org-name="myorg" \ | ||
--backend | ||
``` | ||
|
||
You can scaffold plugins using CLI arguments to get started faster. Using arguments also allows you to run the tool in a non-interactive environment such as CI or to scaffold plugins with other tooling. | ||
|
||
Refer to the following table for the full list of prompt bypass options: | ||
|
||
| Prompt | Equivalent Argument Name | Values | | ||
| ---------------- | ---------------------------- | -------------------------------------------------- | | ||
| **Plugin type** | `--plugin-type` | one of `app`, `datasource`, `panel` or `scenesapp` | | ||
| **Backend** | `--backend` / `--no-backend` | boolean | | ||
| **Name** | `--plugin-name` | string | | ||
| **Organization** | `--org-name` | string | | ||
|
||
|
||
## update | ||
|
||
To update an existing plugin to use the latest version of the `create-plugin` tool, run the following command from your plugin's root directory: | ||
|
||
<CodeSnippets | ||
snippets={[ | ||
{ component: UpdateNPM, label: 'npm' }, | ||
{ component: UpdatePNPM, label: 'pnpm' }, | ||
{ component: UpdateYarn, label: 'yarn' }, | ||
]} | ||
groupId="package-manager" | ||
queryString="current-package-manager" | ||
/> | ||
|
||
This command updates the following: | ||
* **`/.config`** - configuration files for building a plugin | ||
* **NPM dependencies** - dependencies (mostly used for supporting latest Grafana versions and build updates) | ||
* **NPM scripts** - any updates in build-related scripts | ||
|
||
### update --force | ||
|
||
By default, the `update` command will stop if there are any uncommitted changes in the repository. If you want to force the update, you can use the `--force` flag: | ||
|
||
<CodeSnippets | ||
snippets={[ | ||
{ component: UpdateForceNPM, label: 'npm' }, | ||
{ component: UpdateForcePNPM, label: 'pnpm' }, | ||
{ component: UpdateForceYarn, label: 'yarn' }, | ||
]} | ||
groupId="package-manager" | ||
queryString="current-package-manager" | ||
/> | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```shell | ||
npx @grafana/create-plugin@latest update --force | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```shell | ||
pnpm dlx @grafana/create-plugin@latest update --force | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
```shell | ||
yarn create @grafana/plugin update --force | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters