@elliemae/pui-cli 6.0.0-beta.14 → 6.0.0-beta.18

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/lib/esbuild.js CHANGED
@@ -9,6 +9,17 @@ const commonConfig = {
9
9
  target: ESBUILD_TARGET,
10
10
  loader: { '.js': 'jsx' },
11
11
  mainFields: ['module', 'browser', 'main'],
12
+ plugins: [
13
+ {
14
+ name: 'extension',
15
+ setup(build) {
16
+ // eslint-disable-next-line consistent-return
17
+ build.onResolve({ filter: /.*/ }, (args) => {
18
+ if (args.importer) return { path: `${args.path}.js`, external: true };
19
+ });
20
+ },
21
+ },
22
+ ],
12
23
  };
13
24
 
14
25
  const distFolder = 'dist';
@@ -60,13 +60,6 @@ const customHost = argv.host || process.env.HOST;
60
60
  const host = customHost || null; // Let http.Server use its default IPv6/4 host
61
61
  const prettyHost = customHost || 'localhost';
62
62
 
63
- // use the gzipped bundle
64
- app.get('*.js', (req, res, next) => {
65
- req.url += '.gz';
66
- res.set('Content-Encoding', 'gzip');
67
- next();
68
- });
69
-
70
63
  // Start your app.
71
64
  app.listen(port, host, async (err) => {
72
65
  if (err) {
@@ -1,5 +1,5 @@
1
1
  const webpack = require('webpack');
2
- const express = require('express');
2
+ const expressStaticGzip = require('express-static-gzip');
3
3
  const webpackDevMiddleware = require('webpack-dev-middleware');
4
4
  const webpackHotMiddleware = require('webpack-hot-middleware');
5
5
  const { sendFileWithCSPNonce } = require('../csp');
@@ -25,7 +25,7 @@ module.exports = function addDevMiddlewares(app, webpackConfig) {
25
25
  heartbeat: 10 * 1000,
26
26
  }),
27
27
  );
28
- app.use(express.static('cdn'));
28
+ app.use(expressStaticGzip('cdn'));
29
29
 
30
30
  const { outputFileSystem } = (middleware || {}).context || {};
31
31
 
@@ -1,6 +1,6 @@
1
1
  const path = require('path');
2
- const express = require('express');
3
2
  const compression = require('compression');
3
+ const expressStaticGzip = require('express-static-gzip');
4
4
  const { sendFileWithCSPNonce } = require('../csp');
5
5
 
6
6
  module.exports = function addProdMiddlewares(app, options) {
@@ -17,8 +17,15 @@ module.exports = function addProdMiddlewares(app, options) {
17
17
  sendFileWithCSPNonce({ outputPath, res });
18
18
  });
19
19
 
20
- app.use(publicPath, express.static(outputPath, { index: false }));
21
- app.use(express.static('cdn'));
20
+ app.use(
21
+ publicPath,
22
+ expressStaticGzip(outputPath, {
23
+ index: false,
24
+ enableBrotli: true,
25
+ orderPreference: ['br'],
26
+ }),
27
+ );
28
+ app.use(expressStaticGzip('cdn'));
22
29
 
23
30
  app.get('*', (req, res) => sendFileWithCSPNonce({ outputPath, res }));
24
31
  };
@@ -2,6 +2,8 @@
2
2
  const path = require('path');
3
3
  const fs = require('fs');
4
4
  const _ = require('lodash');
5
+ const CompressionPlugin = require('compression-webpack-plugin');
6
+ const zlib = require('zlib');
5
7
 
6
8
  let pathSep = path.sep;
7
9
  if (pathSep === '\\')
@@ -75,7 +77,6 @@ const getAlias = () =>
75
77
  'redux-saga',
76
78
  'moment',
77
79
  'lodash',
78
- 'connected-react-router',
79
80
  'styled-components',
80
81
  'immer',
81
82
  'react-dates',
@@ -184,6 +185,38 @@ const isGoogleTagManagerEnabled = () => {
184
185
  return !!appConfig?.googleTagManager;
185
186
  };
186
187
 
188
+ const getCompressionPlugins = () => {
189
+ const commonConfig = {
190
+ test: /\.(js|css)$/,
191
+ exclude: [
192
+ /\/adrum-ext/,
193
+ /\/emuiUserMonitoring/,
194
+ /\/emuiDiagnostics/,
195
+ /\/emuiAppLoader/,
196
+ /\/encwLoader/,
197
+ ],
198
+ // we are compressing all files since in aws cloudfront edge lambda, we don't want to whitelist files that are not compressed due to below limits
199
+ minRatio: Number.MAX_SAFE_INTEGER,
200
+ };
201
+ return [
202
+ new CompressionPlugin({
203
+ filename: '[path][base].gz',
204
+ algorithm: 'gzip',
205
+ ...commonConfig,
206
+ }),
207
+ new CompressionPlugin({
208
+ filename: '[path][base].br',
209
+ algorithm: 'brotliCompress',
210
+ ...commonConfig,
211
+ compressionOptions: {
212
+ params: {
213
+ [zlib.constants.BROTLI_PARAM_QUALITY]: 11,
214
+ },
215
+ },
216
+ }),
217
+ ];
218
+ };
219
+
187
220
  exports.excludeNodeModulesExcept = excludeNodeModulesExcept;
188
221
  exports.getLibraryName = getLibraryName;
189
222
  exports.getAppConfig = getAppConfig;
@@ -208,3 +241,4 @@ exports.resolveExtensions = [
208
241
  ];
209
242
  exports.mainFields = ['browser', 'module', 'main'];
210
243
  exports.isGoogleTagManagerEnabled = isGoogleTagManagerEnabled;
244
+ exports.getCompressionPlugins = getCompressionPlugins;
@@ -7,6 +7,7 @@ const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack
7
7
  const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
8
8
  const MomentLocalesPlugin = require('moment-locales-webpack-plugin');
9
9
  const { WebpackManifestPlugin } = require('webpack-manifest-plugin');
10
+ const FaviconsWebpackPlugin = require('favicons-webpack-plugin');
10
11
  const { ProvidePlugin } = require('webpack');
11
12
 
12
13
  const {
@@ -18,7 +19,6 @@ const {
18
19
  } = require('./helpers');
19
20
  const { ESBUILD_TARGET } = require('../esbuild');
20
21
 
21
- // get the application configuration
22
22
  const minicssLoader = {
23
23
  loader: MiniCssExtractPlugin.loader,
24
24
  options: {},
@@ -31,9 +31,6 @@ const postcssPlugins = [PostcssPresetEnv({ autoprefixer: { grid: true } })];
31
31
  const { buildPath, publicPath } = getPaths();
32
32
 
33
33
  const plugins = [
34
- // Always expose NODE_ENV to webpack, in order to use `process.env.NODE_ENV`
35
- // inside your code for any environment checks; Terser will automatically
36
- // drop any unreachable code.
37
34
  new webpack.EnvironmentPlugin({
38
35
  NODE_ENV: 'development',
39
36
  ASSET_PATH: '/',
@@ -44,7 +41,6 @@ const plugins = [
44
41
  APP_CONFIG: getAppConfig(),
45
42
  }),
46
43
  new CaseSensitivePathsPlugin(),
47
- // new ESLintPlugin(),
48
44
  new ProvidePlugin({
49
45
  React: 'react',
50
46
  }),
@@ -104,6 +100,17 @@ const plugins = [
104
100
  new DuplicatePackageCheckerPlugin(),
105
101
  new MomentLocalesPlugin(),
106
102
  new WebpackManifestPlugin(),
103
+ new FaviconsWebpackPlugin({
104
+ logo: './app/view/images/favicon.png',
105
+ favicons: {
106
+ developerName: 'ICE MT',
107
+ developerURL: null, // prevent retrieving from the nearest package.json
108
+ icons: {
109
+ coast: false,
110
+ yandex: false,
111
+ },
112
+ },
113
+ }),
107
114
  ];
108
115
 
109
116
  module.exports = (options) => ({
@@ -111,7 +118,6 @@ module.exports = (options) => ({
111
118
  entry: options.entry,
112
119
  output: {
113
120
  clean: true,
114
- // Compile into js/build.js
115
121
  path: buildPath,
116
122
  publicPath,
117
123
  ...options.output,
@@ -120,22 +126,7 @@ module.exports = (options) => ({
120
126
  module: {
121
127
  rules: [
122
128
  {
123
- test: /\.(jpe?g|png|gif|svg|ico)$/,
124
- use: [
125
- 'file-loader',
126
- {
127
- loader: 'image-webpack-loader',
128
- options: {
129
- gifsicle: {
130
- enabled: false,
131
- },
132
- },
133
- },
134
- ],
135
- enforce: 'pre',
136
- },
137
- {
138
- test: /\.(js|ts|jsx|tsx)$/,
129
+ test: /\.[jt]sx?$/,
139
130
  enforce: 'pre',
140
131
  exclude: /node_modules/,
141
132
  resolve: {
@@ -152,7 +143,7 @@ module.exports = (options) => ({
152
143
  ],
153
144
  },
154
145
  {
155
- test: /\.(js|jsx)$/,
146
+ test: /\.[j]sx?$/,
156
147
  exclude: excludeNodeModulesExcept(modulesToTranspile),
157
148
  resolve: {
158
149
  fullySpecified: false,
@@ -166,7 +157,7 @@ module.exports = (options) => ({
166
157
  },
167
158
  },
168
159
  {
169
- test: /\.(ts|tsx)$/,
160
+ test: /\.[t]sx?$/,
170
161
  exclude: excludeNodeModulesExcept(modulesToTranspile),
171
162
  resolve: {
172
163
  fullySpecified: false,
@@ -213,22 +204,13 @@ module.exports = (options) => ({
213
204
  exclude: excludeNodeModulesExcept(['@elliemae/*']),
214
205
  type: 'asset/resource',
215
206
  },
216
- {
217
- type: 'asset',
218
- resourceQuery: /url/, // *.svg?react
219
- },
220
207
  {
221
208
  test: /\.svg$/i,
222
209
  issuer: /\.[jt]sx?$/,
223
210
  use: ['@svgr/webpack'],
224
211
  },
225
212
  {
226
- test: /\.(jpe?g|png|gif|ico)$/i,
227
- exclude: excludeNodeModulesExcept(['@elliemae/*']),
228
- type: 'asset',
229
- },
230
- {
231
- test: /\.(mp4|webm)$/,
213
+ test: /\.(jpe?g|png|gif|ico|mp4|webm)$/i,
232
214
  exclude: excludeNodeModulesExcept(['@elliemae/*']),
233
215
  type: 'asset',
234
216
  },
@@ -236,6 +218,10 @@ module.exports = (options) => ({
236
218
  resourceQuery: /resource/,
237
219
  type: 'asset/resource',
238
220
  },
221
+ {
222
+ type: 'asset',
223
+ resourceQuery: /url/,
224
+ },
239
225
  ],
240
226
  },
241
227
  plugins: plugins.concat(options.plugins),
@@ -244,7 +230,6 @@ module.exports = (options) => ({
244
230
  extensions: ['.wasm', '.mjs', '.ts', '.tsx', '.js', '.jsx', '.json'],
245
231
  mainFields: ['browser', 'module', 'main'],
246
232
  alias: {
247
- 'lodash-es': 'lodash',
248
233
  ...getAlias(),
249
234
  ...((options.resolve || {}).alias || {}),
250
235
  },
@@ -73,21 +73,6 @@ module.exports = (options) => ({
73
73
  optimization: options.optimization,
74
74
  module: {
75
75
  rules: [
76
- {
77
- test: /\.(jpe?g|png|gif|svg|ico)$/,
78
- use: [
79
- 'file-loader',
80
- {
81
- loader: 'image-webpack-loader',
82
- options: {
83
- gifsicle: {
84
- enabled: false,
85
- },
86
- },
87
- },
88
- ],
89
- enforce: 'pre',
90
- },
91
76
  {
92
77
  test: /^(?!.*\.exec\.js$).*\.(js|ts|jsx|tsx)$/,
93
78
  enforce: 'pre',
@@ -1,10 +1,9 @@
1
1
  const path = require('path');
2
- const CompressionPlugin = require('compression-webpack-plugin');
3
2
  const MiniCssExtractPlugin = require('mini-css-extract-plugin');
4
3
  const HtmlWebpackPlugin = require('html-webpack-plugin');
5
4
  const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
6
5
  const { ESBuildMinifyPlugin } = require('esbuild-loader');
7
- const { getLibraryName } = require('./helpers');
6
+ const { getLibraryName, getCompressionPlugins } = require('./helpers');
8
7
  const { ESBUILD_TARGET } = require('../esbuild');
9
8
 
10
9
  const libraryName = getLibraryName();
@@ -62,13 +61,7 @@ module.exports = require('./webpack.lib.base.babel')({
62
61
  chunkFilename: `css/${libraryName}.[contenthash].chunk.css`,
63
62
  }),
64
63
 
65
- new CompressionPlugin({
66
- filename: '[path][base].gz',
67
- algorithm: 'gzip',
68
- test: /\.js$|\.css$$/,
69
- // we are compressing all files since in aws cloudfront edge lambda, we don't want to whitelist files that are not compressed due to below limits
70
- minRatio: Number.MAX_SAFE_INTEGER,
71
- }),
64
+ ...getCompressionPlugins(),
72
65
 
73
66
  new BundleAnalyzerPlugin({
74
67
  analyzerMode: 'static',
@@ -2,7 +2,6 @@
2
2
  const path = require('path');
3
3
  const HtmlWebpackPlugin = require('html-webpack-plugin');
4
4
  const { GenerateSW } = require('workbox-webpack-plugin');
5
- const CompressionPlugin = require('compression-webpack-plugin');
6
5
  const MiniCssExtractPlugin = require('mini-css-extract-plugin');
7
6
  const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
8
7
  const { ESBuildMinifyPlugin } = require('esbuild-loader');
@@ -15,6 +14,7 @@ const {
15
14
  getPaths,
16
15
  getAppVersion,
17
16
  isGoogleTagManagerEnabled,
17
+ getCompressionPlugins,
18
18
  } = require('./helpers');
19
19
  const { ESBUILD_TARGET } = require('../esbuild');
20
20
 
@@ -68,20 +68,7 @@ const getProdConfig = ({ latestVersion = true } = {}) => {
68
68
  chunkFilename: 'css/[name].[contenthash].chunk.css',
69
69
  }),
70
70
 
71
- new CompressionPlugin({
72
- filename: '[path][base].gz',
73
- algorithm: 'gzip',
74
- test: /\.js$|\.css$$/,
75
- exclude: [
76
- /\/adrum-ext/,
77
- /\/emuiUserMonitoring/,
78
- /\/emuiDiagnostics/,
79
- /\/emuiAppLoader/,
80
- /\/encwLoader/,
81
- ],
82
- // we are compressing all files since in aws cloudfront edge lambda, we don't want to whitelist files that are not compressed due to below limits
83
- minRatio: Number.MAX_SAFE_INTEGER,
84
- }),
71
+ ...getCompressionPlugins(),
85
72
 
86
73
  new BundleAnalyzerPlugin({
87
74
  analyzerMode: 'static',
@@ -1,13 +1,11 @@
1
- /* eslint-disable max-lines */
2
1
  const webpack = require('webpack');
3
2
  const MiniCssExtractPlugin = require('mini-css-extract-plugin');
4
3
  const CopyWebpackPlugin = require('copy-webpack-plugin');
5
- const CompressionPlugin = require('compression-webpack-plugin');
6
4
  const {
7
5
  getAppConfig,
8
6
  isApp,
9
7
  getAlias,
10
- excludeNodeModulesExcept,
8
+ getCompressionPlugins,
11
9
  } = require('./helpers');
12
10
 
13
11
  const IS_APP = isApp();
@@ -45,30 +43,7 @@ const getAdditionalPlugins = () => [
45
43
  }),
46
44
  ];
47
45
 
48
- const compressionPlugin = new CompressionPlugin({
49
- filename: '[path][base].gz',
50
- algorithm: 'gzip',
51
- test: /\.js$|\.css$$/,
52
- // we are compressing all files since in aws cloudfront edge lambda, we don't want to whitelist files that are not compressed due to below limits
53
- minRatio: Number.MAX_SAFE_INTEGER,
54
- });
55
-
56
- const getModulePreRules = () => [
57
- {
58
- test: /\.(jpe?g|png|gif|svg|ico)$/,
59
- use: [
60
- 'file-loader',
61
- {
62
- loader: 'image-webpack-loader',
63
- options: {
64
- gifsicle: {
65
- enabled: false,
66
- },
67
- },
68
- },
69
- ],
70
- enforce: 'pre',
71
- },
46
+ const getModuleRules = () => [
72
47
  {
73
48
  test: /\.(js|ts|jsx|tsx)$/,
74
49
  enforce: 'pre',
@@ -86,52 +61,32 @@ const getModulePreRules = () => [
86
61
  },
87
62
  ],
88
63
  },
89
- ];
90
-
91
- const getModuleRules = () => [
92
- {
93
- test: /\.(woff|woff2)$/,
94
- exclude: excludeNodeModulesExcept(['@elliemae/*']),
95
- type: 'asset/resource',
96
- },
97
64
  {
98
65
  type: 'asset',
99
- resourceQuery: /url/, // *.svg?react
66
+ resourceQuery: /url/,
100
67
  },
101
68
  {
102
69
  test: /\.svg$/i,
103
70
  issuer: /\.[jt]sx?$/,
104
71
  use: ['@svgr/webpack'],
105
72
  },
106
- {
107
- test: /\.(jpe?g|png|gif|ico)$/i,
108
- exclude: excludeNodeModulesExcept(['@elliemae/*']),
109
- type: 'asset',
110
- },
111
- {
112
- test: /\.(mp4|webm)$/,
113
- exclude: excludeNodeModulesExcept(['@elliemae/*']),
114
- type: 'asset',
115
- },
116
73
  ];
117
74
 
118
75
  exports.webpackFinal = async (config, { configType }) => {
119
76
  const isProd = configType === 'PRODUCTION';
120
- // remove asset processing that comes with storybook webpack, we will use ours
121
- config.module.rules = config.module.rules.filter(
122
- ({ type }) => type !== 'asset/resource',
77
+ const fileLoaderRule = config.module.rules.find((rule) =>
78
+ rule.test?.test?.('.svg'),
123
79
  );
124
- config.module.rules.push(...getModulePreRules());
125
- config.module.rules.unshift(...getModuleRules(isProd));
126
-
80
+ fileLoaderRule.exclude = /\.svg$/i;
81
+ config.module.rules.unshift(...getModuleRules());
127
82
  config.plugins.push(...getAdditionalPlugins());
128
83
  if (isProd) {
129
- config.plugins.push(compressionPlugin);
84
+ config.plugins = config.plugins.concat(getCompressionPlugins());
130
85
  }
131
86
 
132
87
  config.resolve.alias = { ...config.resolve.alias, ...getAlias() };
133
88
  config.resolve.fallback = { ...config.resolve.fallback, crypto: false };
134
-
89
+ config.resolve.extensions.push('.svg');
135
90
  config.externals = config.externals || {};
136
91
  config.externals['@elliemae/pui-user-monitoring'] = 'emuiUserMonitoring';
137
92
  config.externals['@elliemae/pui-app-loader'] = 'emuiAppLoader';
@@ -141,7 +96,7 @@ exports.webpackFinal = async (config, { configType }) => {
141
96
 
142
97
  // storybook manager webpack
143
98
  exports.managerWebpack = async (config) => {
144
- config.plugins.push(compressionPlugin);
99
+ config.plugins = config.plugins.concat(getCompressionPlugins());
145
100
  config.resolve.alias = { ...config.resolve.alias, ...getAlias() };
146
101
  return config;
147
102
  };
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@elliemae/pui-cli",
3
- "version": "6.0.0-beta.14",
3
+ "version": "6.0.0-beta.18",
4
4
  "private": false,
5
- "description": "EllieMae Platform UI CLI",
5
+ "description": "ICE MT UI Platform CLI",
6
6
  "sideEffects": false,
7
7
  "main": "./lib/index.js",
8
8
  "module": "./lib/index.js",
@@ -20,10 +20,10 @@
20
20
  "url": "https://git.elliemae.io/platform-ui/pui-cli.git"
21
21
  },
22
22
  "engines": {
23
- "npm": ">=7",
24
- "node": ">=14"
23
+ "npm": ">=8",
24
+ "node": ">=16"
25
25
  },
26
- "author": "Vinoth Kalyanasundaram",
26
+ "author": "ICE MT",
27
27
  "license": "MIT",
28
28
  "scripts": {
29
29
  "build": "exit 0",
@@ -128,6 +128,7 @@
128
128
  "esbuild": "~0.14.1",
129
129
  "esbuild-jest": "~0.5.0",
130
130
  "esbuild-loader": "~2.16.0",
131
+ "esbuild-plugin-svgr": "~0.0.3",
131
132
  "eslint": "~8.3.0",
132
133
  "eslint-config-airbnb": "~18.2.1",
133
134
  "eslint-config-airbnb-base": "~15.0.0",
@@ -148,12 +149,15 @@
148
149
  "eslint-plugin-react": "~7.27.1",
149
150
  "eslint-plugin-react-hooks": "~4.3.0",
150
151
  "eslint-plugin-redux-saga": "~1.2.1",
151
- "eslint-plugin-storybook": "~0.5.1",
152
+ "eslint-plugin-storybook": "~0.5.2",
152
153
  "eslint-plugin-testing-library": "~5.0.1",
153
154
  "eslint-plugin-wdio": "~7.4.2",
155
+ "express-static-gzip": "~2.1.1",
154
156
  "execa": "~5.1.1",
155
157
  "express": "~4.17.1",
156
158
  "express-pino-logger": "~7.0.0",
159
+ "favicons": "~6.2.2",
160
+ "favicons-webpack-plugin": "~5.0.2",
157
161
  "file-loader": "~6.2.0",
158
162
  "fork-ts-checker-webpack-plugin": "~6.5.0",
159
163
  "helmet-csp": "~3.4.0",
@@ -162,7 +166,6 @@
162
166
  "http-server": "~14.0.0",
163
167
  "husky": "~7.0.4",
164
168
  "husky-init": "~7.0.0",
165
- "image-webpack-loader": "~8.0.1",
166
169
  "imports-loader": "~3.1.1",
167
170
  "ip": "~1.1.5",
168
171
  "jest-axe": "~5.0.1",
@@ -240,7 +243,7 @@
240
243
  "webpack-pwa-manifest": "~4.3.0",
241
244
  "webpack-strip-block": "~0.3.0",
242
245
  "whatwg-fetch": "~3.6.2",
243
- "workbox-webpack-plugin": "~6.4.1",
246
+ "workbox-webpack-plugin": "~6.4.2",
244
247
  "yargs": "~17.3.0"
245
248
  },
246
249
  "devDependencies": {