CLI commands
Below you can find the available commands in @grafana/create-plugin
.
create-pluginβ
Use the create-plugin
command to scaffold your plugin.
- npm
- pnpm
- yarn
npx @grafana/create-plugin@latest
pnpm dlx @grafana/create-plugin@latest
yarn create @grafana/plugin
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.
For more information on how Scenes allows you to create dashboard-like experiences in app plugins, see the 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 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.
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 organization. With the organization name you can sign and optionally publish the plugin to the Grafana plugin catalog.
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:
- npm
- pnpm
- yarn
npx @grafana/create-plugin@latest update
pnpm dlx @grafana/create-plugin@latest update
yarn create @grafana/plugin update
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:
- npm
- pnpm
- yarn
npx @grafana/create-plugin@latest update --force
pnpm dlx @grafana/create-plugin@latest update --force
yarn create @grafana/plugin update --force