@redhat-cloud-services/frontend-components-config 4.6.9 → 4.6.12
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 +1 -1
- package/src/plugins.js +6 -6
- package/src/plugins.test.js +8 -5
package/package.json
CHANGED
package/src/plugins.js
CHANGED
|
@@ -16,7 +16,7 @@ module.exports = ({
|
|
|
16
16
|
modules,
|
|
17
17
|
generateSourceMaps,
|
|
18
18
|
plugins,
|
|
19
|
-
useChromeTemplate =
|
|
19
|
+
useChromeTemplate = true,
|
|
20
20
|
definePlugin = {},
|
|
21
21
|
} = {}) => [
|
|
22
22
|
...(generateSourceMaps
|
|
@@ -54,12 +54,12 @@ module.exports = ({
|
|
|
54
54
|
},
|
|
55
55
|
...(replacePlugin || []),
|
|
56
56
|
]),
|
|
57
|
-
new DefinePlugin({
|
|
58
|
-
// we have to wrap the appname string in another string because of how define plugin explodes strings
|
|
59
|
-
CRC_APP_NAME: JSON.stringify(insights?.appname),
|
|
60
|
-
...(definePlugin || {}),
|
|
61
|
-
}),
|
|
62
57
|
]),
|
|
58
|
+
new DefinePlugin({
|
|
59
|
+
// we have to wrap the appname string in another string because of how define plugin explodes strings
|
|
60
|
+
CRC_APP_NAME: JSON.stringify(insights?.appname),
|
|
61
|
+
...(definePlugin || {}),
|
|
62
|
+
}),
|
|
63
63
|
new ProvidePlugin({
|
|
64
64
|
process: 'process/browser.js',
|
|
65
65
|
Buffer: ['buffer', 'Buffer'],
|
package/src/plugins.test.js
CHANGED
|
@@ -5,14 +5,14 @@ const REPLACE = 3;
|
|
|
5
5
|
const DEFINE_PLUGIN = 4;
|
|
6
6
|
|
|
7
7
|
describe('plugins generations, no option', () => {
|
|
8
|
-
const enabledPlugins = plugins();
|
|
8
|
+
const enabledPlugins = plugins({ useChromeTemplate: false });
|
|
9
9
|
|
|
10
10
|
it('should generate plugins', () => {
|
|
11
11
|
expect(enabledPlugins.length).toBe(7);
|
|
12
12
|
});
|
|
13
13
|
|
|
14
14
|
it('should generate plugins with sourceMaps', () => {
|
|
15
|
-
const enabledPlugins = plugins({ generateSourceMaps: true });
|
|
15
|
+
const enabledPlugins = plugins({ generateSourceMaps: true, useChromeTemplate: false });
|
|
16
16
|
expect(enabledPlugins.length).toBe(8);
|
|
17
17
|
});
|
|
18
18
|
|
|
@@ -22,7 +22,7 @@ describe('plugins generations, no option', () => {
|
|
|
22
22
|
});
|
|
23
23
|
|
|
24
24
|
describe('rootFolder', () => {
|
|
25
|
-
const enabledPlugins = plugins({ rootFolder: '/test/folder' });
|
|
25
|
+
const enabledPlugins = plugins({ rootFolder: '/test/folder', useChromeTemplate: false });
|
|
26
26
|
|
|
27
27
|
it('should generate correct template path for HtmlWebpackPlugin', () => {
|
|
28
28
|
expect(enabledPlugins[HTML_WEBPACK].userOptions.template).toBe('/test/folder/src/index.html');
|
|
@@ -30,7 +30,7 @@ describe('rootFolder', () => {
|
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
describe('appDeployment', () => {
|
|
33
|
-
const enabledPlugins = plugins({ appDeployment: '/test/folder' });
|
|
33
|
+
const enabledPlugins = plugins({ appDeployment: '/test/folder', useChromeTemplate: false });
|
|
34
34
|
|
|
35
35
|
it('should replace correct string', () => {
|
|
36
36
|
enabledPlugins[REPLACE].replace({ html: 'string @@env' }, (_, { html }) => expect(html).toBe('string /test/folder'));
|
|
@@ -38,12 +38,13 @@ describe('appDeployment', () => {
|
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
it('htmlPlugin should update', () => {
|
|
41
|
-
const enabledPlugins = plugins({ htmlPlugin: { title: 'myTitle' } });
|
|
41
|
+
const enabledPlugins = plugins({ htmlPlugin: { title: 'myTitle' }, useChromeTemplate: false });
|
|
42
42
|
expect(enabledPlugins[HTML_WEBPACK].userOptions.title).toBe('myTitle');
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
it('replacePlugin should update', () => {
|
|
46
46
|
const enabledPlugins = plugins({
|
|
47
|
+
useChromeTemplate: false,
|
|
47
48
|
replacePlugin: [
|
|
48
49
|
{
|
|
49
50
|
pattern: '@@another',
|
|
@@ -56,6 +57,7 @@ it('replacePlugin should update', () => {
|
|
|
56
57
|
|
|
57
58
|
it('definePlugin should have default replace of CRC_APP_NAME', () => {
|
|
58
59
|
const enabledPlugins = plugins({
|
|
60
|
+
useChromeTemplate: false,
|
|
59
61
|
insights: { appname: 'test_app' },
|
|
60
62
|
});
|
|
61
63
|
expect(enabledPlugins[DEFINE_PLUGIN].definitions.CRC_APP_NAME).toBe('"test_app"');
|
|
@@ -63,6 +65,7 @@ it('definePlugin should have default replace of CRC_APP_NAME', () => {
|
|
|
63
65
|
|
|
64
66
|
it('definePlugin should update', () => {
|
|
65
67
|
const enabledPlugins = plugins({
|
|
68
|
+
useChromeTemplate: false,
|
|
66
69
|
definePlugin: {
|
|
67
70
|
SOME_VAR: JSON.stringify('test_val'),
|
|
68
71
|
},
|