@redhat-cloud-services/frontend-components-config 4.6.22 → 4.6.23

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/bin/fec.js CHANGED
@@ -5,7 +5,7 @@ const yargs = require('yargs');
5
5
 
6
6
  const devScript = require('../src/scripts/dev-script');
7
7
  const buildScript = require('../src/scripts/build-script');
8
- const { logError } = require('../src/scripts/common');
8
+ const { logError, validateFECConfig } = require('../src/scripts/common');
9
9
 
10
10
  function patchHosts() {
11
11
  const command = `
@@ -59,7 +59,11 @@ const argv = yargs
59
59
  .argv;
60
60
 
61
61
  const scripts = {
62
- static,
62
+ static: (argv, cwd) => {
63
+ // set fec config
64
+ validateFECConfig(cwd)
65
+ static(argv, cwd)
66
+ },
63
67
  'patch-etc-hosts': patchHosts,
64
68
  dev: devScript,
65
69
  build: buildScript
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redhat-cloud-services/frontend-components-config",
3
- "version": "4.6.22",
3
+ "version": "4.6.23",
4
4
  "description": "Config plugins and settings for RedHat Cloud Services project.",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -28,9 +28,10 @@
28
28
  "buffer": "^6.0.3",
29
29
  "clean-webpack-plugin": "^3.0.0",
30
30
  "css-loader": "^5.2.7",
31
- "concurrently": "^6.5.1",
31
+ "concurrently": "^7.4.0",
32
32
  "chalk": "^4.1.2",
33
33
  "express": "^4.18.1",
34
+ "fork-ts-checker-webpack-plugin": "^7.2.13",
34
35
  "git-revision-webpack-plugin": "^3.0.6",
35
36
  "glob": "^7.2.3",
36
37
  "html-replace-webpack-plugin": "^2.6.0",
package/src/config.js CHANGED
@@ -39,6 +39,8 @@ module.exports = ({
39
39
  bounceProd,
40
40
  useAgent,
41
41
  useDevBuild = true,
42
+ useCache = false,
43
+ cacheConfig = {},
42
44
  } = {}) => {
43
45
  const filenameMask = `js/[name]${useFileHash ? `.${Date.now()}.[fullhash]` : ''}.js`;
44
46
  if (betaEnv) {
@@ -61,6 +63,18 @@ module.exports = ({
61
63
  return {
62
64
  mode: mode || (isProd ? 'production' : 'development'),
63
65
  devtool: false,
66
+ ...(useCache
67
+ ? {
68
+ cache: {
69
+ type: 'filesystem',
70
+ buildDependencies: {
71
+ config: [__filename],
72
+ },
73
+ cacheDirectory: path.resolve(rootFolder, '.cache'),
74
+ ...cacheConfig,
75
+ },
76
+ }
77
+ : {}),
64
78
  entry: {
65
79
  App: appEntry,
66
80
  },
@@ -89,6 +103,13 @@ module.exports = ({
89
103
  test: /src\/.*\.tsx?$/,
90
104
  loader: 'ts-loader',
91
105
  exclude: /(node_modules)/i,
106
+ /**
107
+ * Do not run type checking on main thread
108
+ * Type checking is offloaded to separate thread via ForkTsCheckerWebpackPlugin
109
+ */
110
+ options: {
111
+ transpileOnly: true,
112
+ },
92
113
  },
93
114
  {
94
115
  test: /\.s?[ac]ss$/,
package/src/plugins.js CHANGED
@@ -6,6 +6,7 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
6
6
  const HtmlReplaceWebpackPlugin = require('html-replace-webpack-plugin');
7
7
  const ChunkMapperPlugin = require('@redhat-cloud-services/frontend-components-config-utilities/chunk-mapper');
8
8
  const jsVarName = require('@redhat-cloud-services/frontend-components-config-utilities/jsVarName');
9
+ const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
9
10
 
10
11
  module.exports = ({
11
12
  rootFolder,
@@ -65,5 +66,6 @@ module.exports = ({
65
66
  Buffer: ['buffer', 'Buffer'],
66
67
  }),
67
68
  new ChunkMapperPlugin({ modules: [...(insights ? [jsVarName(insights.appname)] : []), ...(modules || [])] }),
69
+ new ForkTsCheckerWebpackPlugin(),
68
70
  ...(plugins || []),
69
71
  ];
@@ -8,12 +8,12 @@ describe('plugins generations, no option', () => {
8
8
  const enabledPlugins = plugins({ useChromeTemplate: false });
9
9
 
10
10
  it('should generate plugins', () => {
11
- expect(enabledPlugins.length).toBe(7);
11
+ expect(enabledPlugins.length).toBe(8);
12
12
  });
13
13
 
14
14
  it('should generate plugins with sourceMaps', () => {
15
15
  const enabledPlugins = plugins({ generateSourceMaps: true, useChromeTemplate: false });
16
- expect(enabledPlugins.length).toBe(8);
16
+ expect(enabledPlugins.length).toBe(9);
17
17
  });
18
18
 
19
19
  it('should generate correct template path for HtmlWebpackPlugin', () => {