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

Docs: Move/redirect files out of 'Create a plugin' folder #993

Merged
merged 13 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions docusaurus/docs/create-a-plugin/_category_.json

This file was deleted.

This file was deleted.

13 changes: 0 additions & 13 deletions docusaurus/docs/create-a-plugin/develop-a-plugin/index.md

This file was deleted.

This file was deleted.

13 changes: 0 additions & 13 deletions docusaurus/docs/create-a-plugin/extend-a-plugin/index.md

This file was deleted.

15 changes: 0 additions & 15 deletions docusaurus/docs/create-a-plugin/index.md

This file was deleted.

4 changes: 2 additions & 2 deletions docusaurus/docs/get-started/best-practices.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ keywords:
- plugins
- plugin
- best practices
sidebar_position: 0.5
sidebar_position: 10
---

# Best practices for plugin development
Expand Down Expand Up @@ -75,4 +75,4 @@ Is something missing from this list? [Let us know](https://github.com/grafana/pl
## Publishing a plugin

- **Add a GitHub badge** - Follow [these steps](https://grafana.com/blog/2024/06/06/6-tips-to-improve-your-grafana-plugin-before-you-publish/#tip-4-add-dynamic-badges-to-your-readme) to help users find your plugin using GitHub badges.
- **Add workflow automation** - If your plugin is available on GitHub, consider [adding the GitHub workflows](../create-a-plugin/develop-a-plugin/set-up-github-workflows.md) for plugin development to your repository.
- **Add workflow automation** - If your plugin is available on GitHub, consider [adding the GitHub workflows](../get-started/set-up-github-workflows) for plugin development to your repository.
josmperez marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ keywords:
- plugin
- advanced
- configuration
sidebar_position: 60
---

The `.config/` directory holds the preferred configuration for the different tools used to develop, test, and build a Grafana plugin. Although you can make changes, we recommend against doing so. Instead, follow the guidance in this topic to customize your tooling configs.
Expand Down Expand Up @@ -79,7 +80,7 @@ There are two files in the project root that belong to Jest: `jest-setup.js` and

### ESM errors with Jest

If you see `SyntaxError: Cannot use import statement outside a module` when running Jest or `npm run test` see [Troubleshooting](../../troubleshooting.md#i-get-syntaxerror-cannot-use-import-statement-outside-a-module-when-running-jest-or-npm-run-test).
If you see `SyntaxError: Cannot use import statement outside a module` when running Jest or `npm run test` see [Troubleshooting](../troubleshooting#i-get-syntaxerror-cannot-use-import-statement-outside-a-module-when-running-jest-or-npm-run-test).

---

Expand Down
2 changes: 1 addition & 1 deletion docusaurus/docs/get-started/folder-structure.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ keywords:
- plugin
- create-plugin
- folders
sidebar_position: 2
sidebar_position: 25
---

After you [install](./get-started.mdx#step-1-install-the-create-plugin-tool) the `create-plugin` tool and have answered the prompts, your project should look similar to this:
Expand Down
2 changes: 1 addition & 1 deletion docusaurus/docs/get-started/get-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,6 @@ For a complete list of available CLI commands, refer to the [CLI reference](/ref
## Next steps

- Start your plugin journey with one of our [plugin development tutorials](/tutorials/).
- Learn how to [develop and extend](/create-a-plugin/) its functionality.
- Learn how to [develop and extend](/how-to-guides) its functionality.
josmperez marked this conversation as resolved.
Show resolved Hide resolved
- Review the [plugin examples](https://github.com/grafana/grafana-plugin-examples) to learn about good practices.
- Learn how to [package](/publish-a-plugin/package-a-plugin), [sign](/publish-a-plugin/sign-a-plugin), and [publish](/publish-a-plugin/publish-or-update-a-plugin.md) your plugin to the Grafana [plugin catalog](https://grafana.com/plugins).
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ description: Set up your development environment with Docker for Grafana plugin
- create-plugin
- Docker
- setup
sidebar_position: 3
sidebar_position: 20
---

import DockerNPM from '@snippets/docker-grafana-version.npm.md';
Expand Down
josmperez marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ keywords:
- CI
- continuous integration
- automation
sidebar_position: 4
sidebar_position: 30
---

Automate your development process to minimize errors and make it faster and more cost-efficient. The `create-plugin` tool helps you to configure your GitHub actions workflows to help automate your development process.
Expand All @@ -26,7 +26,7 @@ The release (`release.yml`) workflow is designed to build, test, package and sig

:::warning

This workflow requires a Grafana Cloud API key. Before you begin, follow the instructions for [generating an Access Policy token](../../publish-a-plugin/sign-a-plugin#generate-an-access-policy-token).
This workflow requires a Grafana Cloud API key. Before you begin, follow the instructions for [generating an Access Policy token](../publish-a-plugin/sign-a-plugin#generate-an-access-policy-token).

:::

Expand Down Expand Up @@ -84,5 +84,3 @@ The workflow contains the following steps:
1. Comparing the differences between that version and the latest version.
1. Looking for usages of those changed APIs inside your plugin.
1. Reporting any potential incompatibilities.

## Run e2e tests
josmperez marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
---
id: work-with-backend
title: Work with the backend
description: A guide to the Go commands frequently used in plugin development.
title: Work with backend components
description: A guide to the Go commands frequently used in backend plugin development.
keywords:
- grafana
- plugins
- plugin
- go
- CLI commands
sidebar_position: 2
sidebar_position: 50
---

Develop backend components for a Grafana plugin in [Go](https://go.dev/). The following commands are frequently used during backend plugin development:

## Update the Go SDK

To keep the [Grafana plugin SDK for Go](../../key-concepts/backend-plugins/grafana-plugin-sdk-for-go) up to date:
To keep the [Grafana plugin SDK for Go](../../key-concepts/backend-plugins/grafana-plugin-sdk-for-go) up to date:
To keep the [Grafana plugin SDK for Go](../key-concepts/backend-plugins/grafana-plugin-sdk-for-go) up to date:
To keep the [Grafana plugin SDK for Go](../key-concepts/backend-plugins/grafana-plugin-sdk-for-go) up to date:

```bash
go get -u github.com/grafana/grafana-plugin-sdk-go
Expand Down
josmperez marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ keywords:
- plugin
- frontend
- CLI
sidebar_position: 1
sidebar_position: 40
---

import FrontendCLInpm from '@snippets/createplugin-frontend-npm.md';
Expand Down
josmperez marked this conversation as resolved.
Show resolved Hide resolved
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ Use a contextual logger to automatically include additional key-value pairs atta

:::note

Make sure you are using at least [grafana-plugin-sdk-go v0.186.0](https://github.com/grafana/grafana-plugin-sdk-go/releases/tag/v0.186.0). Refer to [Update the Go SDK](../../create-a-plugin/develop-a-plugin/work-with-backend#update-the-go-sdk) for update instructions.
Make sure you are using at least [grafana-plugin-sdk-go v0.186.0](https://github.com/grafana/grafana-plugin-sdk-go/releases/tag/v0.186.0). Refer to [Update the Go SDK](../../get-started/work-with-backend#update-the-go-sdk) for update instructions.

:::

Expand Down Expand Up @@ -394,7 +394,7 @@ If tracing is disabled in Grafana, `backend.DefaultTracer()` returns a no-op tra

:::note

Make sure you are using at least [`grafana-plugin-sdk-go v0.157.0`](https://github.com/grafana/grafana-plugin-sdk-go/releases/tag/v0.157.0). Refer to [Update the Go SDK](../../create-a-plugin/develop-a-plugin/work-with-backend) for update instructions.
Make sure you are using at least [`grafana-plugin-sdk-go v0.157.0`](https://github.com/grafana/grafana-plugin-sdk-go/releases/tag/v0.157.0). Refer to [Update the Go SDK](../../get-started/work-with-backend) for update instructions.

:::

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ keywords:
- event bus
- subscribe
- events
sidebar_position: 5
---

# Subscribe to Grafana events
Expand Down
4 changes: 2 additions & 2 deletions docusaurus/docs/migration-guides/migrate-from-toolkit.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ When the migration command finishes running, follow these following steps:

1. Run each npm script inside `package.json` to confirm that the plugin can be built, tested, and signed.

If the plugin had customizations to the toolkit configs (for example, webpack), then refer to [Extend configurations](/create-a-plugin/extend-a-plugin/extend-configurations) to learn how to update them.
If the plugin had customizations to the toolkit configs (for example, webpack), then refer to [Extend configurations](/get-started/extend-configurations) to learn how to update them.

If the plugin can be built, but there are problems with Jest tests, then see the [Jest advanced configuration](/create-a-plugin/extend-a-plugin/extend-configurations#esm-errors-with-jest) issue regarding es modules.
If the plugin can be built, but there are problems with Jest tests, then see the [Jest advanced configuration](/get-started/extend-configurations#esm-errors-with-jest) issue regarding es modules.

For help with other issues, reach out on [Slack](https://grafana.slack.com/) or the [Community forum](https://community.grafana.com/c/plugin-development/30).
2 changes: 1 addition & 1 deletion docusaurus/docs/publish-a-plugin/build-automation.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ keywords:

# Automate packaging and signing with GitHub CI

We recommend setting up your plugin to use the supplied [Github workflows](../create-a-plugin/develop-a-plugin/set-up-github-workflows.md) from [create-plugin](../get-started/get-started.mdx)
We recommend setting up your plugin to use the supplied [Github workflows](../get-started/set-up-github-workflows) from [create-plugin](../get-started/get-started.mdx)
to ensure that your plugin will be built and packaged in the correct format.

To do so, refer to [these docs](https://github.com/grafana/plugin-actions/blob/main/build-plugin/README.md).
Expand Down
4 changes: 2 additions & 2 deletions docusaurus/docs/reference/prompts.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ App and data source plugins can have a backend component written in Go. Backend

### Do you want to add GitHub CI and Release workflows?

Add [GitHub workflows](/create-a-plugin/develop-a-plugin/set-up-github-workflows) to your development cycle to help catch issues early or release your plugin to the community.
Add [GitHub workflows](../get-started/set-up-github-workflows) to your development cycle to help catch issues early or release your plugin to the community.

### Do you want to add a GitHub workflow to automatically check Grafana API compatibility on PRs?

Add a [GitHub workflow](/create-a-plugin/develop-a-plugin/set-up-github-workflows#the-compatibility-check-is-compatibleyml) to regularly check that your plugin is compatible with the latest version of Grafana.
Add a [GitHub workflow](/get-started/set-up-github-workflows#the-compatibility-check-is-compatibleyml) to regularly check that your plugin is compatible with the latest version of Grafana.
2 changes: 1 addition & 1 deletion docusaurus/docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ If you're using mounts to access your files, it's likely that webpack isn't dete
#### What you can do:

- If you're editing your code from a native Windows app (such as VS Code), you need to manually rerun `yarn build` every time you want to see a change in your plugin.
- Use [webpack `watchOption` with `poll`](https://webpack.js.org/configuration/watch/#watchoptionspoll) in your project. Find instructions on how to extend webpack configuration in our [documentation](https://grafana.com/developers/plugin-tools/create-a-plugin/extend-configurations).
- Use [webpack `watchOption` with `poll`](https://webpack.js.org/configuration/watch/#watchoptionspoll) in your project. Find instructions on how to extend webpack configuration in our [documentation](/get-started/extend-configurations).

### I get `SyntaxError: Cannot use import statement outside a module` when running Jest or `npm run test`.

Expand Down
28 changes: 28 additions & 0 deletions docusaurus/website/docusaurus.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,34 @@ const plugins = [
from: ['/create-a-plugin/extend-a-plugin/include-dashboards'],
to: '/how-to-guides/data-source-plugins/include-dashboards',
},
{
from: ['/create-a-plugin/develop-a-plugin/work-with-frontend'],
to: '/get-started/work-with-frontend',
},
{
from: ['/create-a-plugin/develop-a-plugin/work-with-backend'],
to: '/get-started/work-with-backend',
},
{
from: ['/create-a-plugin/develop-a-plugin/set-up-github-workflows'],
to: '/get-started/set-up-github-workflows',
},
{
from: ['/create-a-plugin/develop-a-plugin/subscribe-events'],
to: '/how-to-guides/panel-plugins/subscribe-events',
},
{
from: ['/create-a-plugin/extend-a-plugin/add-anonymous-usage-reporting'],
to: '/how-to-guides/add-anonymous-usage-reporting',
},
{
from: ['/create-a-plugin/extend-a-plugin/add-return-to-previous-functionality'],
to: '/how-to-guides/add-return-to-previous-functionality',
},
{
from: ['/create-a-plugin/extend-a-plugin/extend-configurations'],
to: '/get-started/extend-configurations',
},
],
},
],
Expand Down
Loading