@redhat-cloud-services/frontend-components-config 5.0.0-beta.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/package.json +2 -2
- package/src/config.js +8 -2
- package/src/config.test.js +3 -1
- package/src/plugins.test.js +4 -4
- package/src/scripts/dev.webpack.config.js +12 -10
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redhat-cloud-services/frontend-components-config",
|
|
3
|
-
"version": "5.0.0
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "Config plugins and settings for RedHat Cloud Services project.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"homepage": "https://github.com/RedHatInsights/frontend-components/tree/master/packages/config#readme",
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.8",
|
|
24
|
-
"@redhat-cloud-services/frontend-components-config-utilities": "^2.0.
|
|
24
|
+
"@redhat-cloud-services/frontend-components-config-utilities": "^2.0.1",
|
|
25
25
|
"assert": "^2.0.0",
|
|
26
26
|
"axios": "^0.27.2",
|
|
27
27
|
"babel-loader": "^8.2.5",
|
package/src/config.js
CHANGED
|
@@ -33,7 +33,9 @@ module.exports = ({
|
|
|
33
33
|
useCloud,
|
|
34
34
|
target,
|
|
35
35
|
registry,
|
|
36
|
-
client = {
|
|
36
|
+
client = {
|
|
37
|
+
overlay: false,
|
|
38
|
+
},
|
|
37
39
|
bundlePfModules = false,
|
|
38
40
|
bounceProd,
|
|
39
41
|
useAgent,
|
|
@@ -42,6 +44,8 @@ module.exports = ({
|
|
|
42
44
|
cacheConfig = {},
|
|
43
45
|
_unstableHotReload = false,
|
|
44
46
|
resolve = {},
|
|
47
|
+
// additional node_modules dirs for searchIgnoredStyles, usefull in monorepo scenario
|
|
48
|
+
nodeModulesDirectories = [],
|
|
45
49
|
} = {}) => {
|
|
46
50
|
const filenameMask = `js/[name].${!_unstableHotReload && useFileHash ? `[fullhash].` : ''}js`;
|
|
47
51
|
if (betaEnv) {
|
|
@@ -175,7 +179,9 @@ module.exports = ({
|
|
|
175
179
|
...resolve,
|
|
176
180
|
extensions: ['.ts', '.tsx', '.mjs', '.js', '.scss', ...(resolve.extensions, [])],
|
|
177
181
|
alias: {
|
|
178
|
-
...(bundlePfModules
|
|
182
|
+
...(bundlePfModules
|
|
183
|
+
? {}
|
|
184
|
+
: searchIgnoredStyles(rootFolder, ...(Array.isArray(nodeModulesDirectories) ? nodeModulesDirectories : [nodeModulesDirectories]))),
|
|
179
185
|
...resolve.alias,
|
|
180
186
|
},
|
|
181
187
|
fallback: {
|
package/src/config.test.js
CHANGED
package/src/plugins.test.js
CHANGED
|
@@ -7,19 +7,19 @@ describe('plugins generations, no option', () => {
|
|
|
7
7
|
const enabledPlugins = plugins({ rootFolder: '/foo/bar' });
|
|
8
8
|
|
|
9
9
|
it('should generate plugins', () => {
|
|
10
|
-
expect(enabledPlugins.length).toBe(
|
|
10
|
+
expect(enabledPlugins.length).toBe(4);
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
it('should generate plugins with sourceMaps', () => {
|
|
14
14
|
const enabledPlugins = plugins({ generateSourceMaps: true, rootFolder: '/foo/bar' });
|
|
15
|
-
expect(enabledPlugins.length).toBe(
|
|
15
|
+
expect(enabledPlugins.length).toBe(5);
|
|
16
16
|
});
|
|
17
17
|
});
|
|
18
18
|
|
|
19
19
|
describe('TS for plugins', () => {
|
|
20
20
|
const pluginsWithTs = plugins({ generateSourceMaps: true, rootFolder: path.resolve(__dirname, '../../../') });
|
|
21
|
-
it('should have TSForkPlugin and
|
|
22
|
-
expect(pluginsWithTs).toHaveLength(
|
|
21
|
+
it('should have TSForkPlugin and 6 plugins in todal', () => {
|
|
22
|
+
expect(pluginsWithTs).toHaveLength(6);
|
|
23
23
|
});
|
|
24
24
|
});
|
|
25
25
|
|
|
@@ -5,20 +5,22 @@ const fecConfig = require(process.env.FEC_CONFIG_PATH);
|
|
|
5
5
|
const isBeta = process.env.BETA === 'true';
|
|
6
6
|
|
|
7
7
|
function parseRegexpURL(url) {
|
|
8
|
-
return new RegExp(
|
|
8
|
+
return isBeta ? [new RegExp(`/beta${url.toString()}`), new RegExp(`/preview${url.toString()}`)] : new RegExp(url.toString());
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
function createAppUrl(appUrl) {
|
|
12
12
|
if (Array.isArray(appUrl)) {
|
|
13
|
-
return appUrl
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
return appUrl
|
|
14
|
+
.map((url) => {
|
|
15
|
+
if (typeof url === 'object') {
|
|
16
|
+
return parseRegexpURL(url);
|
|
17
|
+
} else if (typeof url === 'string') {
|
|
18
|
+
return isBeta ? [`/beta${url}`, `/preview${url}`] : url;
|
|
19
|
+
} else {
|
|
20
|
+
throw `Invalid appURL format! Expected string or regexp, got ${typeof url}. Check your fec.config.js:appUrl.`;
|
|
21
|
+
}
|
|
22
|
+
})
|
|
23
|
+
.flat();
|
|
22
24
|
} else if (typeof appUrl === 'object') {
|
|
23
25
|
return parseRegexpURL(appUrl);
|
|
24
26
|
} else if (typeof appUrl === 'string') {
|