@grafana/create-plugin 0.8.2 → 0.8.4

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,28 @@
1
+ # v0.8.4 (Fri Jan 13 2023)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - 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))
6
+
7
+ #### Authors: 1
8
+
9
+ - Jack Westbrook ([@jackw](https://github.com/jackw))
10
+
11
+ ---
12
+
13
+ # v0.8.3 (Thu Jan 12 2023)
14
+
15
+ #### 🐛 Bug Fix
16
+
17
+ - Create Plugin: Update yarn scripts and instructions to work post scaffold [#168](https://github.com/grafana/plugin-tools/pull/168) ([@sarahzinger](https://github.com/sarahzinger) [@jackw](https://github.com/jackw))
18
+
19
+ #### Authors: 2
20
+
21
+ - Jack Westbrook ([@jackw](https://github.com/jackw))
22
+ - Sarah Zinger ([@sarahzinger](https://github.com/sarahzinger))
23
+
24
+ ---
25
+
1
26
  # v0.8.2 (Wed Jan 11 2023)
2
27
 
3
28
  :tada: This release contains work from a new contributor! :tada:
@@ -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.2",
3
+ "version": "0.8.4",
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": "4bdbc3b4f52e243ec28419cfb8a263b7c6b5dffb"
63
+ "gitHead": "648d226cd34cecfaf840b26afe86166d29b9bf57"
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
 
@@ -6,14 +6,10 @@
6
6
  yarn install
7
7
  ```
8
8
 
9
- 2. Build plugin in development mode or run in watch mode
9
+ 2. Build plugin in development mode and run in watch mode
10
10
 
11
11
  ```bash
12
12
  yarn dev
13
-
14
- # or
15
-
16
- yarn watch
17
13
  ```
18
14
 
19
15
  3. Build plugin in production mode
@@ -25,11 +21,11 @@
25
21
  4. Run the tests (using Jest)
26
22
 
27
23
  ```bash
28
- # Runs the tests and watches for changes
24
+ # Runs the tests and watches for changes, requires git init first
29
25
  yarn test
30
26
 
31
27
  # Exists after running all the tests
32
- yarn lint:ci
28
+ yarn test:ci
33
29
  ```
34
30
 
35
31
  5. Spin up a Grafana instance and run the plugin inside it (using Docker)
@@ -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
  }, {});
@@ -6,7 +6,7 @@
6
6
  "build": "webpack -c ./.config/webpack/webpack.config.ts --env production",
7
7
  "dev": "webpack -w -c ./.config/webpack/webpack.config.ts --env development",
8
8
  "test": "jest --watch --onlyChanged",
9
- "test:ci": "jest --maxWorkers 4",
9
+ "test:ci": "jest --passWithNoTests --maxWorkers 4",
10
10
  "typecheck": "tsc --noEmit",
11
11
  "lint": "eslint --cache --ignore-path ./.gitignore --ext .js,.jsx,.ts,.tsx .",
12
12
  "lint:fix": "yarn lint --fix",
File without changes