@grafana/create-plugin 0.9.0 → 0.9.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 CHANGED
@@ -1,3 +1,15 @@
1
+ # v0.9.1 (Thu Feb 02 2023)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - Create Plugin: Fix deeply nested plugins [#195](https://github.com/grafana/plugin-tools/pull/195) ([@jackw](https://github.com/jackw))
6
+
7
+ #### Authors: 1
8
+
9
+ - Jack Westbrook ([@jackw](https://github.com/jackw))
10
+
11
+ ---
12
+
1
13
  # v0.9.0 (Thu Jan 26 2023)
2
14
 
3
15
  #### 🚀 Enhancement
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/create-plugin",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
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": "f27f1333941079ea7e39799f8e6c8ca3e0c6cea3"
63
+ "gitHead": "cf5b9a9afc6bd925f47c95a9a155137301c0f9d4"
64
64
  }
@@ -20,24 +20,25 @@ export function hasReadme() {
20
20
  return fs.existsSync(path.resolve(process.cwd(), SOURCE_DIR, 'README.md'));
21
21
  }
22
22
 
23
+ // Support bundling nested plugins by finding all plugin.json files in src directory
24
+ // then checking for a sibling module.[jt]sx? file.
23
25
  export async function getEntries(): Promise<Record<string, string>> {
24
26
  const pluginsJson = await globAsync('**/src/**/plugin.json', { absolute: true });
25
27
 
26
28
  const plugins = await Promise.all(pluginsJson.map((pluginJson) => {
27
29
  const folder = path.dirname(pluginJson);
28
- return globAsync(`${folder}/module.{ts,tsx,js}`, { absolute: true });
30
+ return globAsync(`${folder}/module.{ts,tsx,js,jsx}`, { absolute: true });
29
31
  })
30
32
  );
31
33
 
32
34
  return plugins.reduce((result, modules) => {
33
35
  return modules.reduce((result, module) => {
34
36
  const pluginPath = path.dirname(module);
35
- const pluginName = path.basename(pluginPath);
36
- // support bundling nested plugins
37
- const entryName = pluginName === 'src' ? 'module' : `${pluginName}/module`;
37
+ const pluginName = path.relative(process.cwd(), pluginPath).replace(/src\/?/i, '');
38
+ const entryName = pluginName === '' ? 'module' : `${pluginName}/module`;
38
39
 
39
40
  result[entryName] = module;
40
41
  return result;
41
42
  }, result);
42
43
  }, {});
43
- }
44
+ }
@@ -96,7 +96,6 @@ const config = async (env): Promise<Configuration> => ({
96
96
  use: ["style-loader", "css-loader"]
97
97
  },
98
98
  {
99
- exclude: /(node_modules)/,
100
99
  test: /\.s[ac]ss$/,
101
100
  use: ['style-loader', 'css-loader', 'sass-loader'],
102
101
  },