@elliemae/pui-cli 6.0.0-beta.1 → 6.0.0-beta.13
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/babel/babel.config.js +8 -3
- package/lib/cli-commands/build.js +1 -1
- package/lib/cli-commands/lint.js +6 -4
- package/lib/cli-commands/pack.js +6 -11
- package/lib/cli-commands/storybook.js +1 -1
- package/lib/cli-commands/test.js +2 -1
- package/lib/esbuild.js +44 -0
- package/lib/lint/eslint/common.js +3 -3
- package/lib/lint/lint-staged.config.js +1 -1
- package/lib/lint/stylelint.config.js +2 -9
- package/lib/release/release.config.js +1 -1
- package/lib/server/csp.js +2 -0
- package/lib/server/index.js +5 -2
- package/lib/server/util/index.js +2 -2
- package/lib/testing/jest.config.js +2 -1
- package/lib/testing/mocks/svg.js +5 -3
- package/lib/typescript/util.js +1 -1
- package/lib/webpack/helpers.js +11 -35
- package/lib/webpack/webpack.base.babel.js +51 -53
- package/lib/webpack/webpack.dev.babel.js +15 -5
- package/lib/webpack/webpack.lib.base.babel.js +43 -48
- package/lib/webpack/webpack.lib.dev.babel.js +0 -4
- package/lib/webpack/webpack.lib.prod.babel.js +5 -13
- package/lib/webpack/webpack.prod.babel.js +11 -28
- package/lib/webpack/webpack.storybook.js +26 -50
- package/package.json +119 -120
|
@@ -4,16 +4,12 @@ const webpack = require('webpack');
|
|
|
4
4
|
const {
|
|
5
5
|
optimize: { LimitChunkCountPlugin },
|
|
6
6
|
} = require('webpack');
|
|
7
|
-
const StyleLintPlugin = require('stylelint-webpack-plugin');
|
|
8
7
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
9
8
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
10
9
|
const PostcssPresetEnv = require('postcss-preset-env');
|
|
11
10
|
const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin');
|
|
12
11
|
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
|
|
13
12
|
const MomentLocalesPlugin = require('moment-locales-webpack-plugin');
|
|
14
|
-
const stylelintFormatter = require('stylelint-formatter-pretty');
|
|
15
|
-
// const ESLintPlugin = require('eslint-webpack-plugin');
|
|
16
|
-
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
|
|
17
13
|
|
|
18
14
|
const {
|
|
19
15
|
excludeNodeModulesExcept,
|
|
@@ -22,12 +18,9 @@ const {
|
|
|
22
18
|
modulesToTranspile,
|
|
23
19
|
getAssetPath,
|
|
24
20
|
getAlias,
|
|
25
|
-
getImageMinimizerPlugin,
|
|
26
|
-
getMediaPath,
|
|
27
21
|
} = require('./helpers');
|
|
28
|
-
const {
|
|
22
|
+
const { ESBUILD_TARGET } = require('../esbuild');
|
|
29
23
|
|
|
30
|
-
const devMode = process.env.NODE_ENV !== 'production';
|
|
31
24
|
const minicssLoader = {
|
|
32
25
|
loader: MiniCssExtractPlugin.loader,
|
|
33
26
|
options: {},
|
|
@@ -46,15 +39,6 @@ const plugins = [
|
|
|
46
39
|
APP_CONFIG: getAppConfig(true),
|
|
47
40
|
}),
|
|
48
41
|
new CaseSensitivePathsPlugin(),
|
|
49
|
-
// new ESLintPlugin(),
|
|
50
|
-
new StyleLintPlugin({
|
|
51
|
-
emitError: true,
|
|
52
|
-
emitWarning: true,
|
|
53
|
-
allowEmptyInput: true,
|
|
54
|
-
failOnError: !devMode,
|
|
55
|
-
formatter: stylelintFormatter,
|
|
56
|
-
files: '(lib|app)/**/view/**/*.{js,ts,jsx,tsx}',
|
|
57
|
-
}),
|
|
58
42
|
new CopyWebpackPlugin({
|
|
59
43
|
patterns: [
|
|
60
44
|
{
|
|
@@ -73,20 +57,8 @@ const plugins = [
|
|
|
73
57
|
maxChunks: 1,
|
|
74
58
|
}),
|
|
75
59
|
new MomentLocalesPlugin(),
|
|
76
|
-
getImageMinimizerPlugin(),
|
|
77
60
|
];
|
|
78
61
|
|
|
79
|
-
if (isTypeScripEnabled()) {
|
|
80
|
-
plugins.push(
|
|
81
|
-
new ForkTsCheckerWebpackPlugin({
|
|
82
|
-
async: devMode,
|
|
83
|
-
eslint: {
|
|
84
|
-
files: './lib/**/*.{ts,js,tsx,jsx}',
|
|
85
|
-
},
|
|
86
|
-
}),
|
|
87
|
-
);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
62
|
module.exports = (options) => ({
|
|
91
63
|
mode: options.mode,
|
|
92
64
|
entry: [path.join(process.cwd(), 'lib/index')],
|
|
@@ -101,6 +73,21 @@ module.exports = (options) => ({
|
|
|
101
73
|
optimization: options.optimization,
|
|
102
74
|
module: {
|
|
103
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
|
+
},
|
|
104
91
|
{
|
|
105
92
|
test: /^(?!.*\.exec\.js$).*\.(js|ts|jsx|tsx)$/,
|
|
106
93
|
enforce: 'pre',
|
|
@@ -125,18 +112,31 @@ module.exports = (options) => ({
|
|
|
125
112
|
fullySpecified: false,
|
|
126
113
|
},
|
|
127
114
|
use: {
|
|
128
|
-
loader: '
|
|
115
|
+
loader: 'esbuild-loader',
|
|
129
116
|
options: {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
...(options.babelQuery || {}),
|
|
117
|
+
loader: 'jsx',
|
|
118
|
+
target: ESBUILD_TARGET,
|
|
133
119
|
},
|
|
134
120
|
},
|
|
135
121
|
},
|
|
136
122
|
{
|
|
137
123
|
test: /\.exec\.js$/,
|
|
138
124
|
exclude: /node_modules/,
|
|
139
|
-
use: [
|
|
125
|
+
use: [
|
|
126
|
+
{
|
|
127
|
+
loader: 'imports-loader',
|
|
128
|
+
options: {
|
|
129
|
+
wrapper: {
|
|
130
|
+
thisArg: 'window',
|
|
131
|
+
args: {
|
|
132
|
+
module: false,
|
|
133
|
+
exports: false,
|
|
134
|
+
define: false,
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
140
|
},
|
|
141
141
|
{
|
|
142
142
|
test: /\.css$/,
|
|
@@ -171,22 +171,16 @@ module.exports = (options) => ({
|
|
|
171
171
|
type: 'asset/resource',
|
|
172
172
|
},
|
|
173
173
|
{
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
loader: 'file-loader',
|
|
182
|
-
options: {
|
|
183
|
-
name: getMediaPath(),
|
|
184
|
-
},
|
|
185
|
-
},
|
|
186
|
-
],
|
|
174
|
+
type: 'asset',
|
|
175
|
+
resourceQuery: /url/, // *.svg?react
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
test: /\.svg$/i,
|
|
179
|
+
issuer: /\.[jt]sx?$/,
|
|
180
|
+
use: ['@svgr/webpack'],
|
|
187
181
|
},
|
|
188
182
|
{
|
|
189
|
-
test: /\.(jpe?g|png|gif)$/i,
|
|
183
|
+
test: /\.(jpe?g|png|gif|ico)$/i,
|
|
190
184
|
exclude: excludeNodeModulesExcept(['@elliemae/*']),
|
|
191
185
|
type: 'asset',
|
|
192
186
|
},
|
|
@@ -212,6 +206,7 @@ module.exports = (options) => ({
|
|
|
212
206
|
extensions: ['.wasm', '.mjs', '.ts', '.tsx', '.js', '.jsx', '.json'],
|
|
213
207
|
mainFields: ['browser', 'module', 'main'],
|
|
214
208
|
alias: {
|
|
209
|
+
'lodash-es': 'lodash',
|
|
215
210
|
...getAlias(),
|
|
216
211
|
...((options.resolve || {}).alias || {}),
|
|
217
212
|
},
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
// Important modules this config uses
|
|
2
1
|
const path = require('path');
|
|
3
|
-
const TerserPlugin = require('terser-webpack-plugin');
|
|
4
2
|
const CompressionPlugin = require('compression-webpack-plugin');
|
|
5
3
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
6
4
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
7
|
-
const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
|
|
8
5
|
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
|
|
6
|
+
const { ESBuildMinifyPlugin } = require('esbuild-loader');
|
|
9
7
|
const { getLibraryName } = require('./helpers');
|
|
8
|
+
const { ESBUILD_TARGET } = require('../esbuild');
|
|
10
9
|
|
|
11
10
|
const libraryName = getLibraryName();
|
|
12
11
|
|
|
@@ -24,17 +23,10 @@ module.exports = require('./webpack.lib.base.babel')({
|
|
|
24
23
|
moduleIds: 'deterministic',
|
|
25
24
|
minimize: true,
|
|
26
25
|
minimizer: [
|
|
27
|
-
new
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
comparisons: false,
|
|
31
|
-
},
|
|
32
|
-
format: {
|
|
33
|
-
comments: false,
|
|
34
|
-
},
|
|
35
|
-
},
|
|
26
|
+
new ESBuildMinifyPlugin({
|
|
27
|
+
target: ESBUILD_TARGET,
|
|
28
|
+
css: true,
|
|
36
29
|
}),
|
|
37
|
-
new CssMinimizerPlugin(),
|
|
38
30
|
],
|
|
39
31
|
nodeEnv: 'production',
|
|
40
32
|
sideEffects: true,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/* eslint-disable max-lines */
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
4
|
-
// const WebpackPwaManifest = require('webpack-pwa-manifest');
|
|
5
4
|
const { GenerateSW } = require('workbox-webpack-plugin');
|
|
6
5
|
const CompressionPlugin = require('compression-webpack-plugin');
|
|
7
6
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
@@ -15,7 +14,9 @@ const {
|
|
|
15
14
|
LATEST_VERSION,
|
|
16
15
|
getPaths,
|
|
17
16
|
getAppVersion,
|
|
17
|
+
isGoogleTagManagerEnabled,
|
|
18
18
|
} = require('./helpers');
|
|
19
|
+
const { ESBUILD_TARGET } = require('../esbuild');
|
|
19
20
|
|
|
20
21
|
const getProdConfig = ({ latestVersion = true } = {}) => {
|
|
21
22
|
const { buildPath, publicPath } = getPaths(latestVersion);
|
|
@@ -23,12 +24,10 @@ const getProdConfig = ({ latestVersion = true } = {}) => {
|
|
|
23
24
|
return {
|
|
24
25
|
mode: 'production',
|
|
25
26
|
|
|
26
|
-
// In production, we skip all hot-reloading stuff
|
|
27
27
|
entry: {
|
|
28
28
|
app: path.join(process.cwd(), 'app/index'),
|
|
29
29
|
},
|
|
30
30
|
|
|
31
|
-
// eslint-disable-next-line max-len
|
|
32
31
|
// Utilize long-term caching by adding content hashes (not compilation hashes) to compiled assets
|
|
33
32
|
output: {
|
|
34
33
|
path: buildPath,
|
|
@@ -42,7 +41,7 @@ const getProdConfig = ({ latestVersion = true } = {}) => {
|
|
|
42
41
|
moduleIds: 'deterministic',
|
|
43
42
|
minimizer: [
|
|
44
43
|
new ESBuildMinifyPlugin({
|
|
45
|
-
target:
|
|
44
|
+
target: ESBUILD_TARGET,
|
|
46
45
|
css: true,
|
|
47
46
|
}),
|
|
48
47
|
],
|
|
@@ -73,34 +72,17 @@ const getProdConfig = ({ latestVersion = true } = {}) => {
|
|
|
73
72
|
filename: '[path][base].gz',
|
|
74
73
|
algorithm: 'gzip',
|
|
75
74
|
test: /\.js$|\.css$$/,
|
|
76
|
-
exclude: [
|
|
75
|
+
exclude: [
|
|
76
|
+
/\/adrum-ext/,
|
|
77
|
+
/\/emuiUserMonitoring/,
|
|
78
|
+
/\/emuiDiagnostics/,
|
|
79
|
+
/\/emuiAppLoader/,
|
|
80
|
+
/\/encwLoader/,
|
|
81
|
+
],
|
|
77
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
|
|
78
83
|
minRatio: Number.MAX_SAFE_INTEGER,
|
|
79
84
|
}),
|
|
80
85
|
|
|
81
|
-
// new WebpackPwaManifest({
|
|
82
|
-
// name: 'Ellie Mae UI Boilerplate',
|
|
83
|
-
// short_name: 'EM BP',
|
|
84
|
-
// description: 'EllieMae UI Boilerplate-based project!',
|
|
85
|
-
// background_color: '#fafafa',
|
|
86
|
-
// theme_color: '#b1624d',
|
|
87
|
-
// inject: true,
|
|
88
|
-
// ios: true,
|
|
89
|
-
// icons: [
|
|
90
|
-
// {
|
|
91
|
-
// src: path.resolve('app/view/images/icon-512x512.png'),
|
|
92
|
-
// destination: path.join('media', 'images'),
|
|
93
|
-
// sizes: [72, 96, 128, 144, 192, 384, 512],
|
|
94
|
-
// },
|
|
95
|
-
// {
|
|
96
|
-
// src: path.resolve('app/view/images/icon-512x512.png'),
|
|
97
|
-
// sizes: [120, 152, 167, 180],
|
|
98
|
-
// ios: true,
|
|
99
|
-
// destination: path.join('media', 'images'),
|
|
100
|
-
// },
|
|
101
|
-
// ],
|
|
102
|
-
// }),
|
|
103
|
-
|
|
104
86
|
new BundleAnalyzerPlugin({
|
|
105
87
|
analyzerMode: 'static',
|
|
106
88
|
reportFilename: path.join(process.cwd(), 'reports/bundle-stats.html'),
|
|
@@ -158,6 +140,7 @@ const htmlWebpackPlugin = new HtmlWebpackPlugin({
|
|
|
158
140
|
appLoaderScriptPath,
|
|
159
141
|
diagnosticsScriptPath,
|
|
160
142
|
encwLoaderScriptPath,
|
|
143
|
+
googleTagManager: isGoogleTagManagerEnabled(),
|
|
161
144
|
},
|
|
162
145
|
});
|
|
163
146
|
|
|
@@ -1,27 +1,19 @@
|
|
|
1
|
-
/* eslint-disable max-lines
|
|
1
|
+
/* eslint-disable max-lines */
|
|
2
2
|
const webpack = require('webpack');
|
|
3
3
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
4
4
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
5
|
-
const StyleLintPlugin = require('stylelint-webpack-plugin');
|
|
6
|
-
const stylelintFormatter = require('stylelint-formatter-pretty');
|
|
7
5
|
const CompressionPlugin = require('compression-webpack-plugin');
|
|
8
|
-
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
|
|
9
6
|
const {
|
|
10
7
|
getAppConfig,
|
|
11
8
|
isApp,
|
|
12
9
|
getAlias,
|
|
13
10
|
excludeNodeModulesExcept,
|
|
14
|
-
modulesToTranspile,
|
|
15
|
-
resolveExtensions,
|
|
16
|
-
mainFields,
|
|
17
|
-
getMediaPath,
|
|
18
|
-
getImageMinimizerPlugin,
|
|
19
11
|
} = require('./helpers');
|
|
20
12
|
|
|
21
13
|
const IS_APP = isApp();
|
|
22
14
|
const CWD = process.cwd();
|
|
23
15
|
|
|
24
|
-
const getAdditionalPlugins = (
|
|
16
|
+
const getAdditionalPlugins = () => [
|
|
25
17
|
new webpack.DefinePlugin({
|
|
26
18
|
APP_CONFIG: getAppConfig(),
|
|
27
19
|
}),
|
|
@@ -51,15 +43,6 @@ const getAdditionalPlugins = (isProd) => [
|
|
|
51
43
|
},
|
|
52
44
|
],
|
|
53
45
|
}),
|
|
54
|
-
new StyleLintPlugin({
|
|
55
|
-
emitError: true,
|
|
56
|
-
emitWarning: true,
|
|
57
|
-
allowEmptyInput: true,
|
|
58
|
-
failOnError: isProd,
|
|
59
|
-
formatter: stylelintFormatter,
|
|
60
|
-
files: '(lib|app)/**/view/**/*.{js,ts,jsx,tsx}',
|
|
61
|
-
}),
|
|
62
|
-
getImageMinimizerPlugin(),
|
|
63
46
|
];
|
|
64
47
|
|
|
65
48
|
const compressionPlugin = new CompressionPlugin({
|
|
@@ -71,6 +54,21 @@ const compressionPlugin = new CompressionPlugin({
|
|
|
71
54
|
});
|
|
72
55
|
|
|
73
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
|
+
},
|
|
74
72
|
{
|
|
75
73
|
test: /\.(js|ts|jsx|tsx)$/,
|
|
76
74
|
enforce: 'pre',
|
|
@@ -91,41 +89,22 @@ const getModulePreRules = () => [
|
|
|
91
89
|
];
|
|
92
90
|
|
|
93
91
|
const getModuleRules = () => [
|
|
94
|
-
{
|
|
95
|
-
test: /\.(js|ts|jsx|tsx)$/,
|
|
96
|
-
exclude: excludeNodeModulesExcept(modulesToTranspile),
|
|
97
|
-
resolve: {
|
|
98
|
-
fullySpecified: false,
|
|
99
|
-
},
|
|
100
|
-
use: {
|
|
101
|
-
loader: 'babel-loader',
|
|
102
|
-
options: {
|
|
103
|
-
cacheDirectory: true,
|
|
104
|
-
},
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
92
|
{
|
|
108
93
|
test: /\.(woff|woff2)$/,
|
|
109
94
|
exclude: excludeNodeModulesExcept(['@elliemae/*']),
|
|
110
95
|
type: 'asset/resource',
|
|
111
96
|
},
|
|
112
97
|
{
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
loader: 'file-loader',
|
|
121
|
-
options: {
|
|
122
|
-
name: getMediaPath(),
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
],
|
|
98
|
+
type: 'asset',
|
|
99
|
+
resourceQuery: /url/, // *.svg?react
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
test: /\.svg$/i,
|
|
103
|
+
issuer: /\.[jt]sx?$/,
|
|
104
|
+
use: ['@svgr/webpack'],
|
|
126
105
|
},
|
|
127
106
|
{
|
|
128
|
-
test: /\.(jpe?g|png|gif)$/i,
|
|
107
|
+
test: /\.(jpe?g|png|gif|ico)$/i,
|
|
129
108
|
exclude: excludeNodeModulesExcept(['@elliemae/*']),
|
|
130
109
|
type: 'asset',
|
|
131
110
|
},
|
|
@@ -145,16 +124,13 @@ exports.webpackFinal = async (config, { configType }) => {
|
|
|
145
124
|
config.module.rules.push(...getModulePreRules());
|
|
146
125
|
config.module.rules.unshift(...getModuleRules(isProd));
|
|
147
126
|
|
|
148
|
-
config.plugins.push(...getAdditionalPlugins(
|
|
127
|
+
config.plugins.push(...getAdditionalPlugins());
|
|
149
128
|
if (isProd) {
|
|
150
129
|
config.plugins.push(compressionPlugin);
|
|
151
130
|
}
|
|
152
131
|
|
|
153
132
|
config.resolve.alias = { ...config.resolve.alias, ...getAlias() };
|
|
154
133
|
config.resolve.fallback = { ...config.resolve.fallback, crypto: false };
|
|
155
|
-
config.resolve.plugins = (config.resolve.plugins || []).concat([
|
|
156
|
-
new TsconfigPathsPlugin({ extensions: resolveExtensions, mainFields }),
|
|
157
|
-
]);
|
|
158
134
|
|
|
159
135
|
config.externals = config.externals || {};
|
|
160
136
|
config.externals['@elliemae/pui-user-monitoring'] = 'emuiUserMonitoring';
|