@grafana/plugin-meta-extractor 0.0.1-canary.805.cbc58e2.0 → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
1
+ # v0.0.1 (Fri May 03 2024)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - Plugin Meta Extractor: Initial version [#805](https://github.com/grafana/plugin-tools/pull/805) ([@mckn](https://github.com/mckn) [@leventebalogh](https://github.com/leventebalogh))
6
+
7
+ #### Authors: 2
8
+
9
+ - Levente Balogh ([@leventebalogh](https://github.com/leventebalogh))
10
+ - Marcus Andersson ([@mckn](https://github.com/mckn))
package/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # Grafana / Plugin Meta Extractor
2
2
 
3
- `@grafana/plugin-meta-extractor` is a small package that can be used to extract meta-information from the source code of a Grafana plugin. The main use case is to be able to automatically generate static information for a plugin without the need for manual intervention, which can help Grafana core to understand when a plugin that registers extensions should be preloaded without running the plugin code.
4
-
5
- (If you are developing a plugin there is nothing that you _have to_ do - only make sure that your plugin build workflow is up-to-date by running `npx @grafana/create-plugin@latest update`, and the build config will run this tool in the background.)
3
+ `@grafana/plugin-meta-extractor` is a cli tool that can be used to extract meta-information from the source code of a Grafana plugin. It is used to generate plugin metadata without the need for manual intervention, which is then used by the Grafana application to understand features or functionalities a plugin supports or uses.
6
4
 
7
5
  ## Install
8
6
 
@@ -14,7 +12,7 @@ npm install @grafana/plugin-meta-extractor --save-dev
14
12
 
15
13
  #### With Webpack
16
14
 
17
- The package exposes a webpack plugin that can be used to generate plugin meta-information on every build based on the source code. The plugin is adding the information to the `plugin.json` file by overriding the `generated` property in the JSON.
15
+ The package exposes a webpack plugin that can be used to generate plugin meta-information on every build based on the source code. The plugin adds additional information to the `plugin.json` file by overriding the `generated` property in the JSON.
18
16
 
19
17
  ```ts
20
18
  // webpack.config.ts
@@ -71,7 +69,7 @@ The returned meta-data is in the following format:
71
69
 
72
70
  ## Plugin support
73
71
 
74
- At this point the tool requires the `module.(ts|tsx)` to be in a certain format to be able to parse it (we are planning to improve on this in the future). The method calls for registering extensions have to be in the `module.(ts|tsx)`, and they need to be called on the `AppPlugin` instance in a "chained" manner:
72
+ This package requires the `module.(ts|tsx)` to be in a certain format to be able to parse it (we are planning to improve on this in the future). The method calls for registering extensions have to be in the `module.(ts|tsx)`, and they need to be called on the `AppPlugin` instance in a "chained" manner:
75
73
 
76
74
  ```ts
77
75
  // src/module.ts
package/dist/bin/run.js CHANGED
@@ -17,7 +17,7 @@ if (!fs.existsSync(entryPath)) {
17
17
  }
18
18
  // Check if it is a module file
19
19
  const fileName = entryPath.split('/').pop();
20
- if (!fileName?.match(/^(module\.ts|module\.tsx)$/)) {
20
+ if (!fileName?.match(/^(module\.tsx?)$/)) {
21
21
  console.error(`The tool can only run against a "module.ts" or "module.tsx" plugin file.\nThe following path is invalid: "${entryPath}".`);
22
22
  process.exit(1);
23
23
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/plugin-meta-extractor",
3
- "version": "0.0.1-canary.805.cbc58e2.0",
3
+ "version": "0.0.1",
4
4
  "description": "Extract meta information from a Grafana plugin source code.",
5
5
  "types": "./dist/index.d.ts",
6
6
  "bin": "./dist/bin/run.js",
@@ -44,5 +44,5 @@
44
44
  "react": "^18.2.0",
45
45
  "ts-jest": "^29.1.2"
46
46
  },
47
- "gitHead": "cbc58e2c9f1a0553e881b23a4ef53a04c61fb175"
47
+ "gitHead": "5533099402b7b5f626223a8d58592984c45b13eb"
48
48
  }
package/src/bin/run.ts CHANGED
@@ -19,7 +19,7 @@ if (!fs.existsSync(entryPath)) {
19
19
 
20
20
  // Check if it is a module file
21
21
  const fileName = entryPath.split('/').pop();
22
- if (!fileName?.match(/^(module\.ts|module\.tsx)$/)) {
22
+ if (!fileName?.match(/^(module\.tsx?)$/)) {
23
23
  console.error(
24
24
  `The tool can only run against a "module.ts" or "module.tsx" plugin file.\nThe following path is invalid: "${entryPath}".`
25
25
  );