@grafana/create-plugin 4.15.0-canary.984.dbba404.0 → 4.16.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 +36 -0
- package/dist/commands/generate/print-success-message.js +1 -1
- package/dist/constants.js +1 -1
- package/dist/utils/tests/utils.config.test.js +3 -3
- package/dist/utils/tests/utils.helpers.test.js +52 -0
- package/dist/utils/utils.config.js +22 -11
- package/dist/utils/utils.helpers.js +3 -0
- package/package.json +2 -2
- package/src/commands/generate/print-success-message.ts +1 -1
- package/src/constants.ts +1 -1
- package/src/utils/tests/utils.config.test.ts +3 -3
- package/src/utils/tests/utils.helpers.test.ts +58 -0
- package/src/utils/utils.config.ts +30 -12
- package/src/utils/utils.helpers.ts +3 -0
- package/templates/common/.config/Dockerfile +2 -1
- package/templates/common/.config/webpack/publicPath.ts +17 -0
- package/templates/common/.config/webpack/webpack.config.ts +14 -7
- package/templates/common/.cprc.json +2 -4
- package/templates/common/_package.json +1 -0
- package/templates/common/docker-compose.yaml +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,39 @@
|
|
|
1
|
+
# v4.16.0 (Mon Jul 08 2024)
|
|
2
|
+
|
|
3
|
+
#### 🚀 Enhancement
|
|
4
|
+
|
|
5
|
+
- Create Plugin: Allow setting feature flags via cli args [#984](https://github.com/grafana/plugin-tools/pull/984) ([@jackw](https://github.com/jackw))
|
|
6
|
+
|
|
7
|
+
#### Authors: 1
|
|
8
|
+
|
|
9
|
+
- Jack Westbrook ([@jackw](https://github.com/jackw))
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
# v4.15.0 (Thu Jul 04 2024)
|
|
14
|
+
|
|
15
|
+
#### 🚀 Enhancement
|
|
16
|
+
|
|
17
|
+
- Create Plugin: Dynamic webpack publicPath [#966](https://github.com/grafana/plugin-tools/pull/966) ([@jackw](https://github.com/jackw))
|
|
18
|
+
|
|
19
|
+
#### Authors: 1
|
|
20
|
+
|
|
21
|
+
- Jack Westbrook ([@jackw](https://github.com/jackw))
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
# v4.14.1 (Thu Jul 04 2024)
|
|
26
|
+
|
|
27
|
+
#### 🐛 Bug Fix
|
|
28
|
+
|
|
29
|
+
- Create Plugin: Fix backend dev env for arm64 hosts [#990](https://github.com/grafana/plugin-tools/pull/990) ([@jackw](https://github.com/jackw))
|
|
30
|
+
|
|
31
|
+
#### Authors: 1
|
|
32
|
+
|
|
33
|
+
- Jack Westbrook ([@jackw](https://github.com/jackw))
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
1
37
|
# v4.14.0 (Mon Jul 01 2024)
|
|
2
38
|
|
|
3
39
|
#### 🚀 Enhancement
|
|
@@ -11,7 +11,7 @@ export function printGenerateSuccessMessage(answers) {
|
|
|
11
11
|
`- \`${packageManagerName} run dev\` to build (and watch) the plugin frontend code.`,
|
|
12
12
|
...(answers.hasBackend
|
|
13
13
|
? [
|
|
14
|
-
'- `mage -v build:
|
|
14
|
+
'- `mage -v build:backend` to build the plugin backend code. Rerun this command every time you edit your backend files.',
|
|
15
15
|
]
|
|
16
16
|
: []),
|
|
17
17
|
'- `docker-compose up` to start a grafana development server.',
|
package/dist/constants.js
CHANGED
|
@@ -60,7 +60,7 @@ export const MIGRATION_CONFIG = {
|
|
|
60
60
|
devNpmDependenciesToRemove: ['@grafana/toolkit', '@grafana/runtime', '@grafana/data', '@grafana/ui'],
|
|
61
61
|
};
|
|
62
62
|
export const UDPATE_CONFIG = {
|
|
63
|
-
filesToOverride: ['.config/'],
|
|
63
|
+
filesToOverride: ['.config/', '.cprc.json'],
|
|
64
64
|
};
|
|
65
65
|
export const TEXT = {
|
|
66
66
|
overrideFilesPrompt: '**The following files will be overriden, would you like to continue?**',
|
|
@@ -32,19 +32,19 @@ describe('getConfig', () => {
|
|
|
32
32
|
});
|
|
33
33
|
it('should override default feature flags via cli args', async () => {
|
|
34
34
|
mocks.argv = {
|
|
35
|
-
|
|
36
|
-
bundleGrafanaUI: true,
|
|
35
|
+
'feature-flags': 'bundleGrafanaUI',
|
|
37
36
|
};
|
|
38
37
|
const config = getConfig(tmpDir);
|
|
39
38
|
expect(config).toEqual({
|
|
40
39
|
version: getVersion(),
|
|
41
|
-
features: { ...DEFAULT_FEATURE_FLAGS,
|
|
40
|
+
features: { ...DEFAULT_FEATURE_FLAGS, bundleGrafanaUI: true },
|
|
42
41
|
});
|
|
43
42
|
});
|
|
44
43
|
});
|
|
45
44
|
describe('Command: Update', () => {
|
|
46
45
|
beforeEach(() => {
|
|
47
46
|
mocks.commandName = 'update';
|
|
47
|
+
mocks.argv = {};
|
|
48
48
|
});
|
|
49
49
|
it('should give back the correct config when there are no config files at all', async () => {
|
|
50
50
|
const config = getConfig();
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { partitionArr } from '../utils.helpers.js';
|
|
2
|
+
describe('partitionArr', () => {
|
|
3
|
+
it('should partition an array of numbers based on a predicate', () => {
|
|
4
|
+
const arr = [1, 2, 3, 4, 5, 6];
|
|
5
|
+
const isEven = (num) => num % 2 === 0;
|
|
6
|
+
const result = partitionArr(arr, isEven);
|
|
7
|
+
expect(result).toEqual([
|
|
8
|
+
[2, 4, 6],
|
|
9
|
+
[1, 3, 5],
|
|
10
|
+
]);
|
|
11
|
+
});
|
|
12
|
+
it('should partition an array of strings based on a predicate', () => {
|
|
13
|
+
const arr = ['apple', 'banana', 'cherry', 'date'];
|
|
14
|
+
const startsWithA = (str) => str[0] === 'a';
|
|
15
|
+
const result = partitionArr(arr, startsWithA);
|
|
16
|
+
expect(result).toEqual([['apple'], ['banana', 'cherry', 'date']]);
|
|
17
|
+
});
|
|
18
|
+
it('should return two empty arrays if the input array is empty', () => {
|
|
19
|
+
const arr = [];
|
|
20
|
+
const isEven = (num) => num % 2 === 0;
|
|
21
|
+
const result = partitionArr(arr, isEven);
|
|
22
|
+
expect(result).toEqual([[], []]);
|
|
23
|
+
});
|
|
24
|
+
it('should place all items in the first partition if all match the predicate', () => {
|
|
25
|
+
const arr = [2, 4, 6, 8];
|
|
26
|
+
const isEven = (num) => num % 2 === 0;
|
|
27
|
+
const result = partitionArr(arr, isEven);
|
|
28
|
+
expect(result).toEqual([[2, 4, 6, 8], []]);
|
|
29
|
+
});
|
|
30
|
+
it('should place all items in the second partition if none match the predicate', () => {
|
|
31
|
+
const arr = [1, 3, 5, 7];
|
|
32
|
+
const isEven = (num) => num % 2 === 0;
|
|
33
|
+
const result = partitionArr(arr, isEven);
|
|
34
|
+
expect(result).toEqual([[], [1, 3, 5, 7]]);
|
|
35
|
+
});
|
|
36
|
+
it('should work with a complex object array and predicate', () => {
|
|
37
|
+
const arr = [
|
|
38
|
+
{ name: 'Alice', age: 25 },
|
|
39
|
+
{ name: 'Bob', age: 30 },
|
|
40
|
+
{ name: 'Charlie', age: 35 },
|
|
41
|
+
];
|
|
42
|
+
const isUnder30 = (person) => person.age < 30;
|
|
43
|
+
const result = partitionArr(arr, isUnder30);
|
|
44
|
+
expect(result).toEqual([
|
|
45
|
+
[{ name: 'Alice', age: 25 }],
|
|
46
|
+
[
|
|
47
|
+
{ name: 'Bob', age: 30 },
|
|
48
|
+
{ name: 'Charlie', age: 35 },
|
|
49
|
+
],
|
|
50
|
+
]);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
@@ -3,6 +3,9 @@ import path from 'node:path';
|
|
|
3
3
|
import { getVersion } from './utils.version.js';
|
|
4
4
|
import { argv, commandName } from './utils.cli.js';
|
|
5
5
|
import { DEFAULT_FEATURE_FLAGS } from '../constants.js';
|
|
6
|
+
import { printBox } from './utils.console.js';
|
|
7
|
+
import { partitionArr } from './utils.helpers.js';
|
|
8
|
+
let hasShownConfigWarnings = false;
|
|
6
9
|
export function getConfig(workDir = process.cwd()) {
|
|
7
10
|
const rootConfig = getRootConfig(workDir);
|
|
8
11
|
const userConfig = getUserConfig(workDir);
|
|
@@ -58,16 +61,24 @@ function readRCFileSync(path) {
|
|
|
58
61
|
}
|
|
59
62
|
}
|
|
60
63
|
function createFeatureFlags(flags) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
64
|
+
const featureFlags = commandName === 'generate' ? DEFAULT_FEATURE_FLAGS : flags ?? {};
|
|
65
|
+
const cliArgFlags = parseFeatureFlagsFromCliArgs();
|
|
66
|
+
return { ...featureFlags, ...cliArgFlags };
|
|
67
|
+
}
|
|
68
|
+
function parseFeatureFlagsFromCliArgs() {
|
|
69
|
+
const flagsfromCliArgs = argv['feature-flags'] ? argv['feature-flags'].split(',') : [];
|
|
70
|
+
const availableFeatureFlags = Object.keys(DEFAULT_FEATURE_FLAGS);
|
|
71
|
+
const [knownFlags, unknownFlags] = partitionArr(flagsfromCliArgs, (item) => availableFeatureFlags.includes(item));
|
|
72
|
+
if (unknownFlags.length > 0 && !hasShownConfigWarnings) {
|
|
73
|
+
printBox({
|
|
74
|
+
title: 'Warning! Unknown feature flags detected.',
|
|
75
|
+
subtitle: ``,
|
|
76
|
+
content: `The following feature-flags are unknown: ${unknownFlags.join(', ')}.\n\nAvailable feature-flags are: ${availableFeatureFlags.join(', ')}`,
|
|
77
|
+
color: 'yellow',
|
|
78
|
+
});
|
|
79
|
+
hasShownConfigWarnings = true;
|
|
71
80
|
}
|
|
72
|
-
return
|
|
81
|
+
return knownFlags.reduce((acc, flag) => {
|
|
82
|
+
return { ...acc, [flag]: true };
|
|
83
|
+
}, {});
|
|
73
84
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grafana/create-plugin",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.16.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": "099f28dc3dc6d823071a07f30487cd573bd6c009"
|
|
91
91
|
}
|
|
@@ -13,7 +13,7 @@ export function printGenerateSuccessMessage(answers: TemplateData) {
|
|
|
13
13
|
`- \`${packageManagerName} run dev\` to build (and watch) the plugin frontend code.`,
|
|
14
14
|
...(answers.hasBackend
|
|
15
15
|
? [
|
|
16
|
-
'- `mage -v build:
|
|
16
|
+
'- `mage -v build:backend` to build the plugin backend code. Rerun this command every time you edit your backend files.',
|
|
17
17
|
]
|
|
18
18
|
: []),
|
|
19
19
|
'- `docker-compose up` to start a grafana development server.',
|
package/src/constants.ts
CHANGED
|
@@ -40,14 +40,13 @@ describe('getConfig', () => {
|
|
|
40
40
|
|
|
41
41
|
it('should override default feature flags via cli args', async () => {
|
|
42
42
|
mocks.argv = {
|
|
43
|
-
|
|
44
|
-
bundleGrafanaUI: true,
|
|
43
|
+
'feature-flags': 'bundleGrafanaUI',
|
|
45
44
|
};
|
|
46
45
|
const config = getConfig(tmpDir);
|
|
47
46
|
|
|
48
47
|
expect(config).toEqual({
|
|
49
48
|
version: getVersion(),
|
|
50
|
-
features: { ...DEFAULT_FEATURE_FLAGS,
|
|
49
|
+
features: { ...DEFAULT_FEATURE_FLAGS, bundleGrafanaUI: true },
|
|
51
50
|
});
|
|
52
51
|
});
|
|
53
52
|
});
|
|
@@ -55,6 +54,7 @@ describe('getConfig', () => {
|
|
|
55
54
|
describe('Command: Update', () => {
|
|
56
55
|
beforeEach(() => {
|
|
57
56
|
mocks.commandName = 'update';
|
|
57
|
+
mocks.argv = {};
|
|
58
58
|
});
|
|
59
59
|
|
|
60
60
|
it('should give back the correct config when there are no config files at all', async () => {
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { partitionArr } from '../utils.helpers.js';
|
|
2
|
+
|
|
3
|
+
describe('partitionArr', () => {
|
|
4
|
+
it('should partition an array of numbers based on a predicate', () => {
|
|
5
|
+
const arr = [1, 2, 3, 4, 5, 6];
|
|
6
|
+
const isEven = (num: number) => num % 2 === 0;
|
|
7
|
+
const result = partitionArr(arr, isEven);
|
|
8
|
+
expect(result).toEqual([
|
|
9
|
+
[2, 4, 6],
|
|
10
|
+
[1, 3, 5],
|
|
11
|
+
]);
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
it('should partition an array of strings based on a predicate', () => {
|
|
15
|
+
const arr = ['apple', 'banana', 'cherry', 'date'];
|
|
16
|
+
const startsWithA = (str: string) => str[0] === 'a';
|
|
17
|
+
const result = partitionArr(arr, startsWithA);
|
|
18
|
+
expect(result).toEqual([['apple'], ['banana', 'cherry', 'date']]);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it('should return two empty arrays if the input array is empty', () => {
|
|
22
|
+
const arr: number[] = [];
|
|
23
|
+
const isEven = (num: number) => num % 2 === 0;
|
|
24
|
+
const result = partitionArr(arr, isEven);
|
|
25
|
+
expect(result).toEqual([[], []]);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it('should place all items in the first partition if all match the predicate', () => {
|
|
29
|
+
const arr = [2, 4, 6, 8];
|
|
30
|
+
const isEven = (num: number) => num % 2 === 0;
|
|
31
|
+
const result = partitionArr(arr, isEven);
|
|
32
|
+
expect(result).toEqual([[2, 4, 6, 8], []]);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('should place all items in the second partition if none match the predicate', () => {
|
|
36
|
+
const arr = [1, 3, 5, 7];
|
|
37
|
+
const isEven = (num: number) => num % 2 === 0;
|
|
38
|
+
const result = partitionArr(arr, isEven);
|
|
39
|
+
expect(result).toEqual([[], [1, 3, 5, 7]]);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('should work with a complex object array and predicate', () => {
|
|
43
|
+
const arr = [
|
|
44
|
+
{ name: 'Alice', age: 25 },
|
|
45
|
+
{ name: 'Bob', age: 30 },
|
|
46
|
+
{ name: 'Charlie', age: 35 },
|
|
47
|
+
];
|
|
48
|
+
const isUnder30 = (person: { name: string; age: number }) => person.age < 30;
|
|
49
|
+
const result = partitionArr(arr, isUnder30);
|
|
50
|
+
expect(result).toEqual([
|
|
51
|
+
[{ name: 'Alice', age: 25 }],
|
|
52
|
+
[
|
|
53
|
+
{ name: 'Bob', age: 30 },
|
|
54
|
+
{ name: 'Charlie', age: 35 },
|
|
55
|
+
],
|
|
56
|
+
]);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
@@ -3,6 +3,8 @@ import path from 'node:path';
|
|
|
3
3
|
import { getVersion } from './utils.version.js';
|
|
4
4
|
import { argv, commandName } from './utils.cli.js';
|
|
5
5
|
import { DEFAULT_FEATURE_FLAGS } from '../constants.js';
|
|
6
|
+
import { printBox } from './utils.console.js';
|
|
7
|
+
import { partitionArr } from './utils.helpers.js';
|
|
6
8
|
|
|
7
9
|
export type FeatureFlags = {
|
|
8
10
|
bundleGrafanaUI?: boolean;
|
|
@@ -21,6 +23,9 @@ export type UserConfig = {
|
|
|
21
23
|
features: FeatureFlags;
|
|
22
24
|
};
|
|
23
25
|
|
|
26
|
+
// TODO: Create a config manager of sorts so we don't call getConfig multiple times rendering multiple warnings.
|
|
27
|
+
let hasShownConfigWarnings = false;
|
|
28
|
+
|
|
24
29
|
export function getConfig(workDir = process.cwd()): CreatePluginConfig {
|
|
25
30
|
const rootConfig = getRootConfig(workDir);
|
|
26
31
|
const userConfig = getUserConfig(workDir);
|
|
@@ -83,19 +88,32 @@ function readRCFileSync(path: string): CreatePluginConfig | undefined {
|
|
|
83
88
|
}
|
|
84
89
|
}
|
|
85
90
|
|
|
91
|
+
// This function creates feature flags based on the defaults for generate command else flags read from config.
|
|
92
|
+
// In all cases it will override the flags with the featureFlag cli arg values.
|
|
86
93
|
function createFeatureFlags(flags?: FeatureFlags): FeatureFlags {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
94
|
+
const featureFlags = commandName === 'generate' ? DEFAULT_FEATURE_FLAGS : flags ?? {};
|
|
95
|
+
const cliArgFlags = parseFeatureFlagsFromCliArgs();
|
|
96
|
+
return { ...featureFlags, ...cliArgFlags };
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function parseFeatureFlagsFromCliArgs() {
|
|
100
|
+
const flagsfromCliArgs: string[] = argv['feature-flags'] ? argv['feature-flags'].split(',') : [];
|
|
101
|
+
const availableFeatureFlags = Object.keys(DEFAULT_FEATURE_FLAGS);
|
|
102
|
+
const [knownFlags, unknownFlags] = partitionArr(flagsfromCliArgs, (item) => availableFeatureFlags.includes(item));
|
|
103
|
+
|
|
104
|
+
if (unknownFlags.length > 0 && !hasShownConfigWarnings) {
|
|
105
|
+
printBox({
|
|
106
|
+
title: 'Warning! Unknown feature flags detected.',
|
|
107
|
+
subtitle: ``,
|
|
108
|
+
content: `The following feature-flags are unknown: ${unknownFlags.join(
|
|
109
|
+
', '
|
|
110
|
+
)}.\n\nAvailable feature-flags are: ${availableFeatureFlags.join(', ')}`,
|
|
111
|
+
color: 'yellow',
|
|
112
|
+
});
|
|
113
|
+
hasShownConfigWarnings = true;
|
|
98
114
|
}
|
|
99
115
|
|
|
100
|
-
return
|
|
116
|
+
return knownFlags.reduce((acc, flag) => {
|
|
117
|
+
return { ...acc, [flag]: true };
|
|
118
|
+
}, {} as FeatureFlags);
|
|
101
119
|
}
|
|
@@ -4,10 +4,11 @@ ARG grafana_image=grafana-enterprise
|
|
|
4
4
|
FROM grafana/${grafana_image}:${grafana_version}
|
|
5
5
|
|
|
6
6
|
ARG development=false
|
|
7
|
+
ARG TARGETARCH
|
|
7
8
|
|
|
8
9
|
{{#if hasBackend}}
|
|
9
10
|
ARG GO_VERSION=1.21.6
|
|
10
|
-
ARG GO_ARCH
|
|
11
|
+
ARG GO_ARCH=${TARGETARCH:-amd64}
|
|
11
12
|
{{/if}}
|
|
12
13
|
|
|
13
14
|
ENV DEV "${development}"
|
|
@@ -0,0 +1,17 @@
|
|
|
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 }}/';
|
|
@@ -36,6 +36,8 @@ const config = async (env): Promise<Configuration> => {
|
|
|
36
36
|
entry: await getEntries(),
|
|
37
37
|
|
|
38
38
|
externals: [
|
|
39
|
+
// Required for dynamic publicPath resolution
|
|
40
|
+
{ 'amd-module': 'module' },
|
|
39
41
|
'lodash',
|
|
40
42
|
'jquery',
|
|
41
43
|
'moment',
|
|
@@ -104,6 +106,17 @@ const config = async (env): Promise<Configuration> => {
|
|
|
104
106
|
},
|
|
105
107
|
},
|
|
106
108
|
},
|
|
109
|
+
{
|
|
110
|
+
test: /src\/(?:.*\/)?module\.tsx?$/,
|
|
111
|
+
use: [
|
|
112
|
+
{
|
|
113
|
+
loader: 'imports-loader',
|
|
114
|
+
options: {
|
|
115
|
+
imports: `side-effects ${path.join(__dirname, 'publicPath.ts')}`,
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
},
|
|
107
120
|
{
|
|
108
121
|
test: /\.css$/,
|
|
109
122
|
use: ['style-loader', 'css-loader'],
|
|
@@ -116,9 +129,6 @@ const config = async (env): Promise<Configuration> => {
|
|
|
116
129
|
test: /\.(png|jpe?g|gif|svg)$/,
|
|
117
130
|
type: 'asset/resource',
|
|
118
131
|
generator: {
|
|
119
|
-
// Keep publicPath relative for host.com/grafana/ deployments
|
|
120
|
-
publicPath: `public/plugins/${pluginJson.id}/img/`,
|
|
121
|
-
outputPath: 'img/',
|
|
122
132
|
filename: Boolean(env.production) ? '[hash][ext]' : '[file]',
|
|
123
133
|
},
|
|
124
134
|
},
|
|
@@ -126,10 +136,7 @@ const config = async (env): Promise<Configuration> => {
|
|
|
126
136
|
test: /\.(woff|woff2|eot|ttf|otf)(\?v=\d+\.\d+\.\d+)?$/,
|
|
127
137
|
type: 'asset/resource',
|
|
128
138
|
generator: {
|
|
129
|
-
|
|
130
|
-
publicPath: `public/plugins/${pluginJson.id}/fonts/`,
|
|
131
|
-
outputPath: 'fonts/',
|
|
132
|
-
filename: Boolean(env.production) ? '[hash][ext]' : '[name][ext]',
|
|
139
|
+
filename: Boolean(env.production) ? '[hash][ext]' : '[file]',
|
|
133
140
|
},
|
|
134
141
|
},
|
|
135
142
|
],
|