@grafana/create-plugin 5.0.0-canary.1018.f1b5b46.0 → 5.0.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/CHANGELOG.md CHANGED
@@ -1,3 +1,27 @@
1
+ # v5.0.0 (Wed Jul 31 2024)
2
+
3
+ #### 💥 Breaking Change
4
+
5
+ - Create-Plugin: Simplify Prompts [#1018](https://github.com/grafana/plugin-tools/pull/1018) ([@jackw](https://github.com/jackw))
6
+
7
+ #### Authors: 1
8
+
9
+ - Jack Westbrook ([@jackw](https://github.com/jackw))
10
+
11
+ ---
12
+
13
+ # v4.16.3 (Mon Jul 29 2024)
14
+
15
+ #### 🐛 Bug Fix
16
+
17
+ - Create Plugin: Template dynamic public path [#1023](https://github.com/grafana/plugin-tools/pull/1023) ([@jackw](https://github.com/jackw))
18
+
19
+ #### Authors: 1
20
+
21
+ - Jack Westbrook ([@jackw](https://github.com/jackw))
22
+
23
+ ---
24
+
1
25
  # v4.16.2 (Fri Jul 12 2024)
2
26
 
3
27
  #### 🐛 Bug Fix
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grafana/create-plugin",
3
- "version": "5.0.0-canary.1018.f1b5b46.0",
3
+ "version": "5.0.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": "f1b5b46e9628195550f3a8b899db1a6484c5f28b"
90
+ "gitHead": "56c4ac2b94ab9d83be84be4379a90751359fe66e"
91
91
  }
@@ -8,18 +8,30 @@
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 { getPackageJson, getPluginJson, hasReadme, getEntries, isWSL, getCPConfigVersion } from './utils';
18
- import { SOURCE_DIR, DIST_DIR } from './constants';
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 ${path.join(__dirname, 'publicPath.ts')}`,
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 + " */",
@@ -56,7 +56,8 @@
56
56
  "typescript": "4.8.4",
57
57
  "webpack": "^5.86.0",
58
58
  "webpack-cli": "^5.1.4",
59
- "webpack-livereload-plugin": "^3.0.2"
59
+ "webpack-livereload-plugin": "^3.0.2",
60
+ "webpack-virtual-modules": "^0.6.2"
60
61
  },
61
62
  "engines": {
62
63
  "node": ">=20"
@@ -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 }}/';