@grafana/create-plugin 0.8.1 → 0.8.2-canary.182.e5280e4.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.
@@ -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',
@@ -196,6 +196,6 @@ function printSuccessMessage(answers) {
196
196
  ], (answers.hasBackend ? ['- `mage -v build:linux` to build the plugin backend code.'] : []), true), [
197
197
  '- Open http://localhost:3000 in your browser to create a dashboard to begin developing your plugin.',
198
198
  ], false);
199
- 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");
199
+ 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");
200
200
  return (0, utils_console_1.displayAsMarkdown)(msg);
201
201
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/create-plugin",
3
- "version": "0.8.1",
3
+ "version": "0.8.2-canary.182.e5280e4.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": "7e37e9a641ecc2845c6fad2e51bd5892f2196b26"
63
+ "gitHead": "e5280e4497637813ad0aab2687a8438452578133"
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',
@@ -268,7 +268,7 @@ ${commands.map((command) => command).join('\n')}
268
268
 
269
269
  _Note: We strongly recommend creating a new Git repository by running \`git init\` in ./${directory} before continuing._
270
270
 
271
- - View ./${directory}/README.md
271
+ - View create-plugin documentation at https://grafana.github.io/plugin-tools/
272
272
  - Learn more about Grafana Plugins at https://grafana.com/docs/grafana/latest/plugins/developing/development/
273
273
  `;
274
274
 
@@ -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
  }, {});