@grafana/create-plugin 0.8.3 → 0.9.0

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 CHANGED
@@ -1,3 +1,27 @@
1
+ # v0.9.0 (Thu Jan 26 2023)
2
+
3
+ #### 🚀 Enhancement
4
+
5
+ - Create Plugin: Update jest config to support Grafana 9.4 packages [#188](https://github.com/grafana/plugin-tools/pull/188) ([@jackw](https://github.com/jackw))
6
+
7
+ #### Authors: 1
8
+
9
+ - Jack Westbrook ([@jackw](https://github.com/jackw))
10
+
11
+ ---
12
+
13
+ # v0.8.4 (Fri Jan 13 2023)
14
+
15
+ #### 🐛 Bug Fix
16
+
17
+ - Create Plugin: Make sure nested plugins dist directory structure is correct [#182](https://github.com/grafana/plugin-tools/pull/182) ([@jackw](https://github.com/jackw))
18
+
19
+ #### Authors: 1
20
+
21
+ - Jack Westbrook ([@jackw](https://github.com/jackw))
22
+
23
+ ---
24
+
1
25
  # v0.8.3 (Thu Jan 12 2023)
2
26
 
3
27
  #### 🐛 Bug Fix
@@ -68,7 +68,7 @@ function default_1(plop) {
68
68
  name: 'pluginType',
69
69
  type: 'list',
70
70
  choices: [constants_1.PLUGIN_TYPES.app, constants_1.PLUGIN_TYPES.datasource, constants_1.PLUGIN_TYPES.panel],
71
- message: 'What kind of plugin would you like? '
71
+ message: 'What type of plugin would you like?'
72
72
  },
73
73
  {
74
74
  name: 'hasBackend',
@@ -200,6 +200,6 @@ function printSuccessMessage(answers) {
200
200
  '- `docker-compose up` to start a grafana development server. Restart this command after each time you run mage to run your new backend code.',
201
201
  '- Open http://localhost:3000 in your browser to create a dashboard to begin developing your plugin.',
202
202
  ], false);
203
- var msg = "\nCongratulations on scaffolding a Grafana ".concat(answers.pluginType, " plugin! \uD83D\uDE80\n\n## What's next?\n\nRun the following commands to get started:\n").concat(commands.map(function (command) { return command; }).join('\n'), "\n\n_Note: We strongly recommend creating a new Git repository by running `git init` in ./").concat(directory, " before continuing._\n\n- View ./").concat(directory, "/README.md\n- Learn more about Grafana Plugins at https://grafana.com/docs/grafana/latest/plugins/developing/development/\n");
203
+ var msg = "\nCongratulations on scaffolding a Grafana ".concat(answers.pluginType, " plugin! \uD83D\uDE80\n\n## What's next?\n\nRun the following commands to get started:\n").concat(commands.map(function (command) { return command; }).join('\n'), "\n\n_Note: We strongly recommend creating a new Git repository by running `git init` in ./").concat(directory, " before continuing._\n\n- View create-plugin documentation at https://grafana.github.io/plugin-tools/\n- Learn more about Grafana Plugins at https://grafana.com/docs/grafana/latest/plugins/developing/development/\n");
204
204
  return (0, utils_console_1.displayAsMarkdown)(msg);
205
205
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/create-plugin",
3
- "version": "0.8.3",
3
+ "version": "0.9.0",
4
4
  "main": "index.js",
5
5
  "repository": {
6
6
  "directory": "packages/create-plugin",
@@ -60,5 +60,5 @@
60
60
  "engines": {
61
61
  "node": ">=16"
62
62
  },
63
- "gitHead": "f8c0d2ac3a8b264aac4cf8cf4dbfaf60ae084ad4"
63
+ "gitHead": "f27f1333941079ea7e39799f8e6c8ca3e0c6cea3"
64
64
  }
@@ -65,7 +65,7 @@ export default function (plop: NodePlopAPI) {
65
65
  name: 'pluginType',
66
66
  type: 'list',
67
67
  choices: [PLUGIN_TYPES.app, PLUGIN_TYPES.datasource, PLUGIN_TYPES.panel],
68
- message: 'What kind of plugin would you like? ',
68
+ message: 'What type of plugin would you like?',
69
69
  },
70
70
  {
71
71
  name: 'hasBackend',
@@ -272,7 +272,7 @@ ${commands.map((command) => command).join('\n')}
272
272
 
273
273
  _Note: We strongly recommend creating a new Git repository by running \`git init\` in ./${directory} before continuing._
274
274
 
275
- - View ./${directory}/README.md
275
+ - View create-plugin documentation at https://grafana.github.io/plugin-tools/
276
276
  - Learn more about Grafana Plugins at https://grafana.com/docs/grafana/latest/plugins/developing/development/
277
277
  `;
278
278
 
@@ -11,7 +11,16 @@
11
11
  const nodeModulesToTransform = (moduleNames) => `node_modules\/(?!(${moduleNames.join('|')})\/)`;
12
12
 
13
13
  // Array of known nested grafana package dependencies that only bundle an ESM version
14
- const grafanaESModules = ['ol', 'react-colorful', 'uuid'];
14
+ const grafanaESModules = [
15
+ 'd3',
16
+ 'd3-color',
17
+ 'd3-force',
18
+ 'd3-interpolate',
19
+ 'd3-scale-chromatic',
20
+ 'ol',
21
+ 'react-colorful',
22
+ 'uuid',
23
+ ];
15
24
 
16
25
  module.exports = {
17
26
  nodeModulesToTransform,
@@ -21,21 +21,22 @@ export function hasReadme() {
21
21
  }
22
22
 
23
23
  export async function getEntries(): Promise<Record<string, string>> {
24
- const parent = '..';
25
- const pluginsJson = await globAsync('**/src/**/plugin.json');
26
-
27
- const plugins = await Promise.all(pluginsJson.map(pluginJson => {
28
- const folder = path.dirname(pluginJson);
29
- return globAsync(`${folder}/module.{ts,tsx,js}`);
30
- }));
24
+ const pluginsJson = await globAsync('**/src/**/plugin.json', { absolute: true });
25
+
26
+ const plugins = await Promise.all(pluginsJson.map((pluginJson) => {
27
+ const folder = path.dirname(pluginJson);
28
+ return globAsync(`${folder}/module.{ts,tsx,js}`, { absolute: true });
29
+ })
30
+ );
31
31
 
32
32
  return plugins.reduce((result, modules) => {
33
33
  return modules.reduce((result, module) => {
34
- const pluginPath = path.resolve(path.dirname(module), parent);
34
+ const pluginPath = path.dirname(module);
35
35
  const pluginName = path.basename(pluginPath);
36
- const entryName = plugins.length > 1 ? `${pluginName}/module` : 'module';
37
-
38
- result[entryName] = path.join(parent, module);
36
+ // support bundling nested plugins
37
+ const entryName = pluginName === 'src' ? 'module' : `${pluginName}/module`;
38
+
39
+ result[entryName] = module;
39
40
  return result;
40
41
  }, result);
41
42
  }, {});