@elliemae/pui-cli 5.21.3 → 5.23.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/lib/cli-commands/test.js +1 -12
- package/lib/testing/jest.config.js +3 -4
- package/lib/testing/resolver.js +44 -0
- package/lib/testing/setup-tests.js +25 -2
- package/lib/webpack/helpers.js +9 -8
- package/lib/webpack/webpack.base.babel.js +0 -13
- package/lib/webpack/webpack.lib.base.babel.js +0 -13
- package/lib/webpack/webpack.lib.prod.babel.js +1 -1
- package/package.json +14 -14
package/lib/cli-commands/test.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
const { exit } = require('yargs');
|
|
2
2
|
const { exec, logError, logSuccess } = require('./utils');
|
|
3
|
-
const { lintCSS, lintJS } = require('./lint');
|
|
4
3
|
|
|
5
4
|
const { CI = false } = process.env;
|
|
6
5
|
|
|
@@ -19,17 +18,7 @@ async function handler(argv) {
|
|
|
19
18
|
if (argv.r) commandOptions += ' --bail --findRelatedTests';
|
|
20
19
|
if (argv.s) commandOptions += ' --silent';
|
|
21
20
|
try {
|
|
22
|
-
if (
|
|
23
|
-
try {
|
|
24
|
-
await lintJS();
|
|
25
|
-
await lintCSS();
|
|
26
|
-
logSuccess('Linting completed');
|
|
27
|
-
} catch (err) {
|
|
28
|
-
logError('Linting failed');
|
|
29
|
-
exit(-1, err);
|
|
30
|
-
return -1;
|
|
31
|
-
}
|
|
32
|
-
} else {
|
|
21
|
+
if (CI) {
|
|
33
22
|
await exec('rimraf ./reports');
|
|
34
23
|
}
|
|
35
24
|
|
|
@@ -71,13 +71,12 @@ const jestConfig = {
|
|
|
71
71
|
},
|
|
72
72
|
setupFilesAfterEnv: [`${getRootDir()}/lib/testing/setup-tests.js`],
|
|
73
73
|
setupFiles: ['raf/polyfill', 'whatwg-fetch'],
|
|
74
|
-
testRegex: '(app|lib).*/tests/.*\\.test\\.(js|ts)$',
|
|
74
|
+
testRegex: '(app|lib).*/tests/.*\\.test\\.(js|ts|tsx|jsx)$',
|
|
75
75
|
snapshotSerializers: [],
|
|
76
76
|
testResultsProcessor: 'jest-sonar-reporter',
|
|
77
|
-
resolver: '
|
|
77
|
+
resolver: path.resolve(__dirname, './resolver.js'),
|
|
78
78
|
transformIgnorePatterns: [
|
|
79
|
-
'node_modules/(?!(@elliemae
|
|
80
|
-
'node_modules/@elliemae/em-platform-document-viewer',
|
|
79
|
+
'node_modules/(?!(@elliemae/em-platform-document-viewer|@elliemae/pui-cli|@elliemae/pui-app-widgets|lodash-es|react-spring|react-select|react-dates|@babel/runtime)/)',
|
|
81
80
|
],
|
|
82
81
|
globals: {
|
|
83
82
|
APP_CONFIG: getAppConfig(),
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
const resolutions = [
|
|
2
|
+
{
|
|
3
|
+
matcher: /\.jsx?$/i,
|
|
4
|
+
extensions: ['.tsx', '.ts'],
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
matcher: /\.mjs$/i,
|
|
8
|
+
extensions: ['.mts'],
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
matcher: /\.cjs$/i,
|
|
12
|
+
extensions: ['.cts'],
|
|
13
|
+
},
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
const importResolver = require('enhanced-resolve').create.sync({
|
|
17
|
+
conditionNames: ['import', 'node', 'default'],
|
|
18
|
+
extensions: ['.js', '.jsx', '.json', '.node', '.ts', '.tsx'],
|
|
19
|
+
});
|
|
20
|
+
const requireResolver = require('enhanced-resolve').create.sync({
|
|
21
|
+
conditionNames: ['require', 'node', 'default'],
|
|
22
|
+
extensions: ['.js', '.jsx', '.json', '.node', '.ts', '.tsx'],
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
module.exports = (request, options) => {
|
|
26
|
+
let resolver = requireResolver;
|
|
27
|
+
if (options.conditions?.includes('import')) {
|
|
28
|
+
resolver = importResolver;
|
|
29
|
+
}
|
|
30
|
+
const resolution = resolutions.find(({ matcher }) => matcher.test(request));
|
|
31
|
+
if (resolution) {
|
|
32
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
33
|
+
for (const extension of resolution.extensions) {
|
|
34
|
+
try {
|
|
35
|
+
return resolver(
|
|
36
|
+
options.basedir,
|
|
37
|
+
request.replace(resolution.matcher, extension),
|
|
38
|
+
);
|
|
39
|
+
// eslint-disable-next-line no-empty
|
|
40
|
+
} catch {}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return resolver(options.basedir, request);
|
|
44
|
+
};
|
|
@@ -5,8 +5,31 @@ import 'regenerator-runtime/runtime';
|
|
|
5
5
|
import '@testing-library/jest-dom/extend-expect';
|
|
6
6
|
import { toHaveNoViolations } from 'jest-axe';
|
|
7
7
|
import ResizeObserver from 'resize-observer-polyfill';
|
|
8
|
-
import addMatchMedia from '
|
|
9
|
-
import { logger } from '
|
|
8
|
+
import addMatchMedia from '@elliemae/pui-cli/lib/testing/mocks/matchMedia';
|
|
9
|
+
import { logger } from '@elliemae/pui-cli/lib/testing/mocks/pui-diagnostics';
|
|
10
|
+
|
|
11
|
+
// eslint-disable-next-line no-console
|
|
12
|
+
const originalError = console.error;
|
|
13
|
+
// eslint-disable-next-line no-console
|
|
14
|
+
console.error = (...args) => {
|
|
15
|
+
const ignoreList = [
|
|
16
|
+
`Warning: Can't perform a React state update on an unmounted component`,
|
|
17
|
+
`Warning: Function components cannot be given refs`,
|
|
18
|
+
`Warning: Failed %s type:`,
|
|
19
|
+
`Warning: Invalid DOM property`,
|
|
20
|
+
`Warning: Each child in a list should have a unique`,
|
|
21
|
+
'Warning: Received `%s` for a non-boolean attribute',
|
|
22
|
+
'Warning: <%s /> is using incorrect casing.',
|
|
23
|
+
'Warning: The tag <%s> is unrecognized in this browser',
|
|
24
|
+
];
|
|
25
|
+
if (
|
|
26
|
+
ignoreList.find(
|
|
27
|
+
(ignoreMsg) => !!args.find((arg) => arg.includes?.(ignoreMsg)),
|
|
28
|
+
)
|
|
29
|
+
)
|
|
30
|
+
return false;
|
|
31
|
+
return originalError(...args);
|
|
32
|
+
};
|
|
10
33
|
|
|
11
34
|
if (expect) expect.extend(toHaveNoViolations);
|
|
12
35
|
jest.setTimeout(60000);
|
package/lib/webpack/helpers.js
CHANGED
|
@@ -187,16 +187,17 @@ const isGoogleTagManagerEnabled = () => {
|
|
|
187
187
|
return !!appConfig?.googleTagManager;
|
|
188
188
|
};
|
|
189
189
|
|
|
190
|
-
const getCompressionPlugins = () => {
|
|
190
|
+
const getCompressionPlugins = (isLibrary = false) => {
|
|
191
|
+
const excludeList = [
|
|
192
|
+
/\/adrum-ext/,
|
|
193
|
+
/\/emuiUserMonitoring/,
|
|
194
|
+
/\/emuiDiagnostics/,
|
|
195
|
+
/\/emuiAppLoader/,
|
|
196
|
+
/\/encwLoader/,
|
|
197
|
+
];
|
|
191
198
|
const commonConfig = {
|
|
192
199
|
test: /\.(js|css)$/,
|
|
193
|
-
exclude: [
|
|
194
|
-
/\/adrum-ext/,
|
|
195
|
-
/\/emuiUserMonitoring/,
|
|
196
|
-
/\/emuiDiagnostics/,
|
|
197
|
-
/\/emuiAppLoader/,
|
|
198
|
-
/\/encwLoader/,
|
|
199
|
-
],
|
|
200
|
+
exclude: !isLibrary ? excludeList : [],
|
|
200
201
|
// 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
|
|
201
202
|
minRatio: Number.MAX_SAFE_INTEGER,
|
|
202
203
|
};
|
|
@@ -7,7 +7,6 @@ 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 ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
|
|
11
10
|
|
|
12
11
|
const {
|
|
13
12
|
excludeNodeModulesExcept,
|
|
@@ -16,7 +15,6 @@ const {
|
|
|
16
15
|
getAlias,
|
|
17
16
|
getPaths,
|
|
18
17
|
} = require('./helpers');
|
|
19
|
-
const { isTypeScriptEnabled } = require('../typescript/util');
|
|
20
18
|
|
|
21
19
|
// get the application configuration
|
|
22
20
|
const devMode = process.env.NODE_ENV !== 'production';
|
|
@@ -103,17 +101,6 @@ const plugins = [
|
|
|
103
101
|
new WebpackManifestPlugin(),
|
|
104
102
|
];
|
|
105
103
|
|
|
106
|
-
if (isTypeScriptEnabled()) {
|
|
107
|
-
plugins.push(
|
|
108
|
-
new ForkTsCheckerWebpackPlugin({
|
|
109
|
-
async: devMode,
|
|
110
|
-
eslint: {
|
|
111
|
-
files: './app/**/*.{ts,js,tsx,jsx}',
|
|
112
|
-
},
|
|
113
|
-
}),
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
104
|
module.exports = (options) => ({
|
|
118
105
|
mode: options.mode,
|
|
119
106
|
entry: options.entry,
|
|
@@ -10,7 +10,6 @@ const PostcssPresetEnv = require('postcss-preset-env');
|
|
|
10
10
|
const DuplicatePackageCheckerPlugin = require('duplicate-package-checker-webpack-plugin');
|
|
11
11
|
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin');
|
|
12
12
|
const MomentLocalesPlugin = require('moment-locales-webpack-plugin');
|
|
13
|
-
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
|
|
14
13
|
const ResolveTypeScriptPlugin = require('resolve-typescript-plugin').default;
|
|
15
14
|
|
|
16
15
|
const {
|
|
@@ -21,7 +20,6 @@ const {
|
|
|
21
20
|
getAssetPath,
|
|
22
21
|
getAlias,
|
|
23
22
|
} = require('./helpers');
|
|
24
|
-
const { isTypeScriptEnabled } = require('../typescript/util');
|
|
25
23
|
|
|
26
24
|
const devMode = process.env.NODE_ENV !== 'production';
|
|
27
25
|
const minicssLoader = {
|
|
@@ -62,17 +60,6 @@ const plugins = [
|
|
|
62
60
|
new MomentLocalesPlugin(),
|
|
63
61
|
];
|
|
64
62
|
|
|
65
|
-
if (isTypeScriptEnabled()) {
|
|
66
|
-
plugins.push(
|
|
67
|
-
new ForkTsCheckerWebpackPlugin({
|
|
68
|
-
async: devMode,
|
|
69
|
-
eslint: {
|
|
70
|
-
files: './lib/**/*.{ts,js,tsx,jsx}',
|
|
71
|
-
},
|
|
72
|
-
}),
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
63
|
module.exports = (options) => ({
|
|
77
64
|
mode: options.mode,
|
|
78
65
|
entry: [path.join(process.cwd(), 'lib/index')],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/pui-cli",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.23.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "EllieMae Platform UI CLI",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"@storybook/react": "~6.3.12",
|
|
89
89
|
"@storybook/theming": "~6.3.12",
|
|
90
90
|
"@stylelint/postcss-css-in-js": "~0.37.2",
|
|
91
|
-
"@svgr/webpack": "~6.1.
|
|
91
|
+
"@svgr/webpack": "~6.1.2",
|
|
92
92
|
"@testing-library/jest-dom": "~5.16.1",
|
|
93
93
|
"@testing-library/react": "~12.1.2",
|
|
94
94
|
"@testing-library/react-hooks": "~7.0.2",
|
|
@@ -112,17 +112,17 @@
|
|
|
112
112
|
"babel-plugin-transform-react-remove-prop-types": "~0.4.24",
|
|
113
113
|
"babel-plugin-transform-remove-console": "~6.9.4",
|
|
114
114
|
"babel-plugin-transform-strip-block": "~0.0.4",
|
|
115
|
-
"body-parser": "~1.19.
|
|
115
|
+
"body-parser": "~1.19.1",
|
|
116
116
|
"browserslist": "~4.18.1",
|
|
117
117
|
"bundlesize": "~0.18.1",
|
|
118
118
|
"case-sensitive-paths-webpack-plugin": "~2.4.0",
|
|
119
119
|
"chalk": "~4.1.2",
|
|
120
120
|
"circular-dependency-plugin": "~5.2.2",
|
|
121
121
|
"classnames": "~2.3.1",
|
|
122
|
-
"compare-versions": "~4.1.
|
|
122
|
+
"compare-versions": "~4.1.2",
|
|
123
123
|
"compression": "~1.7.4",
|
|
124
|
-
"compression-webpack-plugin": "~9.
|
|
125
|
-
"copy-webpack-plugin": "~10.
|
|
124
|
+
"compression-webpack-plugin": "~9.1.2",
|
|
125
|
+
"copy-webpack-plugin": "~10.1.0",
|
|
126
126
|
"cors": "~2.8.5",
|
|
127
127
|
"cross-env": "~7.0.3",
|
|
128
128
|
"css-loader": "~6.5.1",
|
|
@@ -132,6 +132,7 @@
|
|
|
132
132
|
"dotenv": "~10.0.0",
|
|
133
133
|
"dotenv-webpack": "~7.0.3",
|
|
134
134
|
"duplicate-package-checker-webpack-plugin": "~3.0.0",
|
|
135
|
+
"enhanced-resolve": "~5.8.3",
|
|
135
136
|
"eslint": "~8.4.1",
|
|
136
137
|
"eslint-config-airbnb": "~18.2.1",
|
|
137
138
|
"eslint-config-airbnb-base": "~15.0.0",
|
|
@@ -145,13 +146,13 @@
|
|
|
145
146
|
"eslint-plugin-eslint-comments": "~3.2.0",
|
|
146
147
|
"eslint-plugin-import": "~2.25.3",
|
|
147
148
|
"eslint-plugin-jest": "~25.3.0",
|
|
148
|
-
"eslint-plugin-jsdoc": "~37.
|
|
149
|
+
"eslint-plugin-jsdoc": "~37.2.0",
|
|
149
150
|
"eslint-plugin-jsx-a11y": "~6.5.1",
|
|
150
151
|
"eslint-plugin-mdx": "~1.16.0",
|
|
151
152
|
"eslint-plugin-prettier": "~4.0.0",
|
|
152
153
|
"eslint-plugin-react": "~7.27.1",
|
|
153
154
|
"eslint-plugin-react-hooks": "~4.3.0",
|
|
154
|
-
"eslint-plugin-redux-saga": "~1.2
|
|
155
|
+
"eslint-plugin-redux-saga": "~1.3.2",
|
|
155
156
|
"eslint-plugin-testing-library": "~5.0.1",
|
|
156
157
|
"eslint-plugin-wdio": "~7.4.2",
|
|
157
158
|
"execa": "~5.1.1",
|
|
@@ -169,7 +170,7 @@
|
|
|
169
170
|
"imports-loader": "~3.1.1",
|
|
170
171
|
"ip": "~1.1.5",
|
|
171
172
|
"jest-axe": "~5.0.1",
|
|
172
|
-
"jest-cli": "~27.4.
|
|
173
|
+
"jest-cli": "~27.4.4",
|
|
173
174
|
"jest-sonar-reporter": "~2.0.0",
|
|
174
175
|
"jest-styled-components": "~7.0.8",
|
|
175
176
|
"jscodeshift": "~0.13.0",
|
|
@@ -179,7 +180,7 @@
|
|
|
179
180
|
"minimist": "~1.2.5",
|
|
180
181
|
"moment": "~2.29.1",
|
|
181
182
|
"moment-locales-webpack-plugin": "~1.2.0",
|
|
182
|
-
"msw": "~0.36.
|
|
183
|
+
"msw": "~0.36.3",
|
|
183
184
|
"node-gyp": "~8.4.1",
|
|
184
185
|
"node-plop": "~0.30.0",
|
|
185
186
|
"nodemon": "~2.0.15",
|
|
@@ -188,8 +189,8 @@
|
|
|
188
189
|
"pino": "~7.5.1",
|
|
189
190
|
"pino-pretty": "~7.2.0",
|
|
190
191
|
"pinst": "~2.1.6",
|
|
191
|
-
"plop": "~3.0.
|
|
192
|
-
"postcss": "~8.4.
|
|
192
|
+
"plop": "~3.0.4",
|
|
193
|
+
"postcss": "~8.4.5",
|
|
193
194
|
"postcss-jsx": "~0.36.4",
|
|
194
195
|
"postcss-html": "~1.3.0",
|
|
195
196
|
"postcss-markdown": "~1.2.0",
|
|
@@ -222,14 +223,13 @@
|
|
|
222
223
|
"svg-url-loader": "~7.1.1",
|
|
223
224
|
"svgo": "~2.8.0",
|
|
224
225
|
"terser-webpack-plugin": "~5.2.5",
|
|
225
|
-
"ts-jest-resolver": "~2.0.0",
|
|
226
226
|
"ts-node": "~10.4.0",
|
|
227
227
|
"tsc-alias": "~1.4.2",
|
|
228
228
|
"tsc-files": "~1.1.3",
|
|
229
229
|
"tsconfig-paths": "~3.12.0",
|
|
230
230
|
"tsconfig-paths-webpack-plugin": "~3.5.2",
|
|
231
231
|
"type-fest": "~2.8.0",
|
|
232
|
-
"typescript": "~4.5.
|
|
232
|
+
"typescript": "~4.5.3",
|
|
233
233
|
"update-notifier": "~5.1.0",
|
|
234
234
|
"url-loader": "~4.1.1",
|
|
235
235
|
"uuid": "~8.3.2",
|