@grafana/create-plugin

中文文档
9.0.3发布于 2026/11/11Apache-2.0ES Module构建来源已验证近 30 天下载 9953

轻松创建 Grafana 插件 .

中文使用文档
文档目录7 节
  1. 创建新插件
  2. 快速概览
  3. 迁移您已有的插件
  4. 更新您的插件构建配置
  5. 自定义或扩展基本配置
  6. 添加到您已有的插件中
  7. 捐款

Grafana / 创建插件

轻松创建 Grafana 插件 .

毒性

链接

@grafana/create-plugin 用于Linux(WSL)的macOS,Linux和Windows子系统的工作.
如果有什么不起作用,请 提交问题。 。 。 .
如果你有问题或需要帮助,请问 GitHub 讨论。 。 。 .

创建新插件

快速概览

在要存储您的插件的文件夹中运行命令 。 新插件将在您运行此命令的文件夹的子目录中被脚手架 .

创建插件可以与国家预防机制、PNPM或Yarn 1一起使用。 插件将被脚手架以使用您喜欢的软件包管理器 。 用您选择的软件包管理器运行命令 :

npx

npx @grafana/create-plugin@latest

npm

npm init @grafana/plugin

pnpm

pnpm dlx @grafana/create-plugin@latest

yarn (树莓)

yarn dlx @grafana/create-plugin@latest

yarn (1.x) (中文(简体) )

yarn create @grafana/plugin

迁移您已有的插件

警告:我们 不支持 写入的插件 angular

如果您有先前使用此程序创建的现有插件 @grafana/toolkit 您可以使用 遵循命令将其迁移到新建工具 :

# Run this command from the root of your plugin
cd ./my-plugin

npx @grafana/create-plugin@latest migrate

更多信息见 这里


更新您的插件构建配置

以防您的插件被使用 @grafana/toolkit 在确保首先使用 npx @grafana/create-plugin migrate。 。 。 .

随着Grafana新版本的出世,我们不断更新我们的插件构建工具,以便保持相容性,使其更能发挥作用. 为了接收这些修改,并确保您的插件与最新的 Grafana 版本兼容, 您可以使用 update 命令, 自动更新您的构建配置 :

# Run this command from the root of your plugin
cd ./my-plugin

npx @grafana/create-plugin@latest update

更多信息见 这里


自定义或扩展基本配置

您可以阅读更多关于定制或扩展我们的基本配置 文档。 。 。 .

添加到您已有的插件中

您可以通过在您现有的插件中包含规定来精简插件审查过程, 使审查人员能够更有效地测试您的插件 .

# Run this command from the root of your plugin
cd ./my-plugin

npx @grafana/create-plugin@latest provisioning

更多信息见我们 文档。 。 。 .


捐款

我们总是感激捐款! 见 捐款额 更多信息.

版本与发布记录

@grafana/create-plugin 共发布 1,530 个版本,首次发布于 2022/09/08;过去 12 个月发布了 355 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
9.0.3latest2026/11/115 天前
9.0.22026/11/115 天前
9.0.12026/11/106 天前
9.0.02026/11/106 天前
8.0.22026/11/0412 天前
8.0.12026/11/0413 天前

其他发布通道:canary → 7.6.3-canary.2678.26587359388.0。

关于 @grafana/create-plugin 的常见问题

@grafana/create-plugin 是什么?

轻松创建 Grafana 插件 .

如何安装 @grafana/create-plugin?

在项目目录运行 npm install @grafana/create-plugin,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 create-plugin,可以用 npx create-plugin 直接运行。

@grafana/create-plugin 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/grafana__create-plugin 是否存在。

@grafana/create-plugin 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@grafana/create-plugin 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=22。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@grafana/create-plugin 可以商用吗?

@grafana/create-plugin 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@grafana/create-plugin 的下载量有多少?

根据 npm 官方下载统计,@grafana/create-plugin 在 2026/10/17 – 2026/11/15 这 30 天内被下载 9,953 次,日均约 332 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@grafana/create-plugin 还在维护吗?

最新版本 9.0.3 发布于 2026/11/11(5 天前);至今共发布 1530 个版本,其中过去 12 个月发布了 355 个;首次发布于 2022/09/08。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。