@grafana/create-plugin 0.9.0 → 0.9.1-canary.195.309a77f.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/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-canary.195.309a77f.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": "
|
|
63
|
+
"gitHead": "309a77f22020ef5506605d75c13ec5cd0197952b"
|
|
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.
|
|
36
|
-
|
|
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
|
+
}
|