@elliemae/pui-cli 6.0.0-beta.15 → 6.0.0-beta.19

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.
@@ -60,21 +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
- const serveCompressedAssets = (req, res, next) => {
64
- if (req.header('Accept-Encoding').includes('br')) {
65
- req.url += '.br';
66
- res.set('Content-Encoding', 'br');
67
- } else {
68
- req.url += '.gz';
69
- res.set('Content-Encoding', 'gzip');
70
- }
71
- next();
72
- };
73
-
74
- // use the compressed bundle
75
- app.get('*.js', serveCompressedAssets);
76
- app.get('*.css', serveCompressedAssets);
77
-
78
63
  // Start your app.
79
64
  app.listen(port, host, async (err) => {
80
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
  };
@@ -77,7 +77,6 @@ const getAlias = () =>
77
77
  'redux-saga',
78
78
  'moment',
79
79
  'lodash',
80
- 'connected-react-router',
81
80
  'styled-components',
82
81
  'immer',
83
82
  'react-dates',
@@ -188,7 +187,7 @@ const isGoogleTagManagerEnabled = () => {
188
187
 
189
188
  const getCompressionPlugins = () => {
190
189
  const commonConfig = {
191
- test: /\.(js|css|html|svg)$/,
190
+ test: /\.(js|css)$/,
192
191
  exclude: [
193
192
  /\/adrum-ext/,
194
193
  /\/emuiUserMonitoring/,
@@ -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',
@@ -43,7 +43,7 @@ const getAdditionalPlugins = () => [
43
43
  }),
44
44
  ];
45
45
 
46
- const getModulePreRules = () => [
46
+ const getModuleRules = () => [
47
47
  {
48
48
  test: /\.(js|ts|jsx|tsx)$/,
49
49
  enforce: 'pre',
@@ -61,11 +61,24 @@ const getModulePreRules = () => [
61
61
  },
62
62
  ],
63
63
  },
64
+ {
65
+ type: 'asset',
66
+ resourceQuery: /url/,
67
+ },
68
+ {
69
+ test: /\.svg$/i,
70
+ issuer: /\.[jt]sx?$/,
71
+ use: ['@svgr/webpack'],
72
+ },
64
73
  ];
65
74
 
66
75
  exports.webpackFinal = async (config, { configType }) => {
67
76
  const isProd = configType === 'PRODUCTION';
68
- config.module.rules.push(...getModulePreRules());
77
+ const fileLoaderRule = config.module.rules.find((rule) =>
78
+ rule.test?.test?.('.svg'),
79
+ );
80
+ fileLoaderRule.exclude = /\.svg$/i;
81
+ config.module.rules.unshift(...getModuleRules());
69
82
  config.plugins.push(...getAdditionalPlugins());
70
83
  if (isProd) {
71
84
  config.plugins = config.plugins.concat(getCompressionPlugins());
@@ -73,7 +86,7 @@ exports.webpackFinal = async (config, { configType }) => {
73
86
 
74
87
  config.resolve.alias = { ...config.resolve.alias, ...getAlias() };
75
88
  config.resolve.fallback = { ...config.resolve.fallback, crypto: false };
76
-
89
+ config.resolve.extensions.push('.svg');
77
90
  config.externals = config.externals || {};
78
91
  config.externals['@elliemae/pui-user-monitoring'] = 'emuiUserMonitoring';
79
92
  config.externals['@elliemae/pui-app-loader'] = 'emuiAppLoader';
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@elliemae/pui-cli",
3
- "version": "6.0.0-beta.15",
3
+ "version": "6.0.0-beta.19",
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",
@@ -151,9 +152,12 @@
151
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": {