@grafana/create-plugin 4.16.2 → 4.16.3-canary.1023.697917b.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/README.md +1 -1
- package/dist/constants.js +1 -1
- package/package.json +2 -2
- package/src/constants.ts +1 -1
- package/templates/common/.config/_eslintrc +1 -1
- package/templates/common/.config/jest-setup.js +1 -1
- package/templates/common/.config/jest.config.js +1 -1
- package/templates/common/.config/tsconfig.json +1 -1
- package/templates/common/.config/webpack/webpack.config.ts +18 -5
- package/templates/common/_package.json +2 -1
- package/templates/common/.config/webpack/publicPath.ts +0 -17
package/README.md
CHANGED
|
@@ -97,7 +97,7 @@ For more information see [here](https://grafana.com/developers/plugin-tools/migr
|
|
|
97
97
|
|
|
98
98
|
## Customizing or extending the basic configs
|
|
99
99
|
|
|
100
|
-
You can read more about customizing or extending the basic configuration in our [documentation](https://grafana.com/developers/plugin-tools/
|
|
100
|
+
You can read more about customizing or extending the basic configuration in our [documentation](https://grafana.com/developers/plugin-tools/get-started/set-up-development-environment#extend-configurations).
|
|
101
101
|
|
|
102
102
|
## Add provisioning to your existing plugin
|
|
103
103
|
|
package/dist/constants.js
CHANGED
|
@@ -94,7 +94,7 @@ export const TEXT = {
|
|
|
94
94
|
* Run \`yarn build\` and observe the output for any errors.
|
|
95
95
|
* Test your plugin in grafana and make sure everything works as expected.
|
|
96
96
|
|
|
97
|
-
See instructions on how to customize your configuration here https://grafana.com/developers/plugin-tools/
|
|
97
|
+
See instructions on how to customize your configuration here https://grafana.com/developers/plugin-tools/get-started/set-up-development-environment#extend-configurations
|
|
98
98
|
`,
|
|
99
99
|
updateCommandWarning: '**⚠️ Warning!**\nThis is going to update files under the `.config/` folder.\nMake sure to commit your changes before running this script.',
|
|
100
100
|
updateCommandSuccess: '**Done.**\nIf you have any questions please open an issue/discussion in https://github.com/grafana/plugin-tools.',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grafana/create-plugin",
|
|
3
|
-
"version": "4.16.
|
|
3
|
+
"version": "4.16.3-canary.1023.697917b.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"directory": "packages/create-plugin",
|
|
6
6
|
"url": "https://github.com/grafana/plugin-tools"
|
|
@@ -87,5 +87,5 @@
|
|
|
87
87
|
"engines": {
|
|
88
88
|
"node": ">=20"
|
|
89
89
|
},
|
|
90
|
-
"gitHead": "
|
|
90
|
+
"gitHead": "697917b91cf3fe66f1b898f5c2b13a458a38cdfc"
|
|
91
91
|
}
|
package/src/constants.ts
CHANGED
|
@@ -129,7 +129,7 @@ export const TEXT = {
|
|
|
129
129
|
* Run \`yarn build\` and observe the output for any errors.
|
|
130
130
|
* Test your plugin in grafana and make sure everything works as expected.
|
|
131
131
|
|
|
132
|
-
See instructions on how to customize your configuration here https://grafana.com/developers/plugin-tools/
|
|
132
|
+
See instructions on how to customize your configuration here https://grafana.com/developers/plugin-tools/get-started/set-up-development-environment#extend-configurations
|
|
133
133
|
`,
|
|
134
134
|
|
|
135
135
|
updateCommandWarning: '**⚠️ Warning!**\nThis is going to update files under the `.config/` folder.\nMake sure to commit your changes before running this script.',
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️
|
|
3
3
|
*
|
|
4
4
|
* In order to extend the configuration follow the steps in
|
|
5
|
-
* https://grafana.com/developers/plugin-tools/
|
|
5
|
+
* https://grafana.com/developers/plugin-tools/get-started/set-up-development-environment#extend-the-eslint-config
|
|
6
6
|
*/
|
|
7
7
|
{
|
|
8
8
|
"extends": ["@grafana/eslint-config"],
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️
|
|
3
3
|
*
|
|
4
4
|
* In order to extend the configuration follow the steps in
|
|
5
|
-
* https://grafana.com/developers/plugin-tools/
|
|
5
|
+
* https://grafana.com/developers/plugin-tools/get-started/set-up-development-environment#extend-the-jest-config
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import '@testing-library/jest-dom';
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️
|
|
3
3
|
*
|
|
4
4
|
* In order to extend the configuration follow the steps in
|
|
5
|
-
* https://grafana.com/developers/plugin-tools/
|
|
5
|
+
* https://grafana.com/developers/plugin-tools/get-started/set-up-development-environment#extend-the-jest-config
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
const path = require('path');
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️
|
|
3
3
|
*
|
|
4
4
|
* In order to extend the configuration follow the steps in
|
|
5
|
-
* https://grafana.com/developers/plugin-tools/
|
|
5
|
+
* https://grafana.com/developers/plugin-tools/get-started/set-up-development-environment#extend-the-typescript-config
|
|
6
6
|
*/
|
|
7
7
|
{
|
|
8
8
|
"compilerOptions": {
|
|
@@ -2,24 +2,36 @@
|
|
|
2
2
|
* ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️
|
|
3
3
|
*
|
|
4
4
|
* In order to extend the configuration follow the steps in
|
|
5
|
-
* https://grafana.com/developers/plugin-tools/
|
|
5
|
+
* https://grafana.com/developers/plugin-tools/get-started/set-up-development-environment#extend-the-webpack-config
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import CopyWebpackPlugin from 'copy-webpack-plugin';
|
|
9
9
|
import ESLintPlugin from 'eslint-webpack-plugin';
|
|
10
10
|
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
|
|
11
|
-
import LiveReloadPlugin from 'webpack-livereload-plugin';
|
|
12
11
|
import path from 'path';
|
|
13
12
|
import ReplaceInFileWebpackPlugin from 'replace-in-file-webpack-plugin';
|
|
14
13
|
import TerserPlugin from 'terser-webpack-plugin';
|
|
15
14
|
import { type Configuration, BannerPlugin } from 'webpack';
|
|
15
|
+
import LiveReloadPlugin from 'webpack-livereload-plugin';
|
|
16
|
+
import VirtualModulesPlugin from 'webpack-virtual-modules';
|
|
16
17
|
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
18
|
+
import { DIST_DIR, SOURCE_DIR } from './constants';
|
|
19
|
+
import { getCPConfigVersion, getEntries, getPackageJson, getPluginJson, hasReadme, isWSL } from './utils';
|
|
19
20
|
|
|
20
21
|
const pluginJson = getPluginJson();
|
|
21
22
|
const cpVersion = getCPConfigVersion();
|
|
22
23
|
|
|
24
|
+
const virtualPublicPath = new VirtualModulesPlugin({
|
|
25
|
+
'node_modules/grafana-public-path.js': `
|
|
26
|
+
import amdMetaModule from 'amd-module';
|
|
27
|
+
|
|
28
|
+
__webpack_public_path__ =
|
|
29
|
+
amdMetaModule && amdMetaModule.uri
|
|
30
|
+
? amdMetaModule.uri.slice(0, amdMetaModule.uri.lastIndexOf('/') + 1)
|
|
31
|
+
: 'public/plugins/${pluginJson.id}/';
|
|
32
|
+
`,
|
|
33
|
+
});
|
|
34
|
+
|
|
23
35
|
const config = async (env): Promise<Configuration> => {
|
|
24
36
|
const baseConfig: Configuration = {
|
|
25
37
|
cache: {
|
|
@@ -112,7 +124,7 @@ const config = async (env): Promise<Configuration> => {
|
|
|
112
124
|
{
|
|
113
125
|
loader: 'imports-loader',
|
|
114
126
|
options: {
|
|
115
|
-
imports: `side-effects
|
|
127
|
+
imports: `side-effects grafana-public-path`,
|
|
116
128
|
},
|
|
117
129
|
},
|
|
118
130
|
],
|
|
@@ -169,6 +181,7 @@ const config = async (env): Promise<Configuration> => {
|
|
|
169
181
|
},
|
|
170
182
|
|
|
171
183
|
plugins: [
|
|
184
|
+
virtualPublicPath,
|
|
172
185
|
// Insert create plugin version information into the bundle
|
|
173
186
|
new BannerPlugin({
|
|
174
187
|
banner: "/* [create-plugin] version: " + cpVersion + " */",
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* ⚠️⚠️⚠️ THIS FILE WAS SCAFFOLDED BY `@grafana/create-plugin`. DO NOT EDIT THIS FILE DIRECTLY. ⚠️⚠️⚠️
|
|
3
|
-
*
|
|
4
|
-
* This file dynamically sets the public path at runtime based on the location of the plugin's AMD module.
|
|
5
|
-
* It relies on the magic `module` which is defined by the AMD loader.
|
|
6
|
-
* https://github.com/requirejs/requirejs/wiki/Differences-between-the-simplified-CommonJS-wrapper-and-standard-AMD-define#module
|
|
7
|
-
*
|
|
8
|
-
* We fallback to the plugin root so that older versions of Grafana will continue to load the plugin correctly.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
// @ts-nocheck
|
|
12
|
-
import amdMetaModule from 'amd-module';
|
|
13
|
-
|
|
14
|
-
__webpack_public_path__ =
|
|
15
|
-
amdMetaModule && amdMetaModule.uri
|
|
16
|
-
? amdMetaModule.uri.slice(0, amdMetaModule.uri.lastIndexOf('/') + 1)
|
|
17
|
-
: 'public/plugins/{{ pluginId }}/';
|