We are always grateful to receive contribution!
The following guidelines help you on how to start with the codebase and how to submit your work.
You need to have npm or yarn installed.
git clone git@github.com:grafana/plugin-tools.git
cd plugin-tools
yarn installPlop- we are using Plop for the CLI tool and for scaffolding
@grafana/create-plugin consists of the following folder structure:
├── src // Executable code
│ ├── bin // the entrypoint file
│ ├── commands // Code that runs commands
│ └── utils // Utilities used by commands
└── templates // Plop templates
├── _partials // Composable parts of a template
├── app // Templates specific to scaffolding an app plugin
├── backend // Templates specific to scaffolding backend plugin code
├── common // Common templates used by all plugin types (e.g. tooling config files)
├── datasource // Templates specific to scaffolding a datasource plugin
├── github // Templates for github workflows
└── panel // Templates specific to scaffolding a panel pluginThere are a collection of commands to assist with developing create-plugin. Please read the main contributing guide before contributing any code changes to the project.
Below are the main commands used for developing create-plugin. They can be run by either yarn workspace @grafana/create-plugin run <name_of_command> or navigating to packages/create-plugin and running the command directly as detailed below.
yarn build # used to build @grafana/create-pluginyarn dev # watches for changes to files and rebuilds @grafana/create-plugin automaticallyyarn dev-app # watches for changes and scaffolds an app plugin (in ./generated) for developing app configsyarn dev-panel # watches for changes and scaffolds an app plugin (in ./generated) for developing panel configsyarn dev-datasource # watches for changes and scaffolds an app plugin (in ./generated) for developing datasource configsWork in progress.
The templates are used by Plop to scaffold Grafana plugins. Whilst they appear to be the intended filetype they are infact treated as markdown by Plop when it runs. As such we need to be mindful of syntax and to escape particular characters where necessary. The github/ci.yml file is a good example of this.