@elliemae/pui-cli 6.0.0-beta.24 → 6.0.0-beta.28
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 +4 -13
- package/lib/testing/jest.config.js +19 -9
- package/lib/testing/resolver.js +44 -0
- package/lib/testing/setup-react-env.js +3 -0
- package/lib/testing/setup-tests.js +23 -0
- package/lib/transpile/.swcrc +11 -0
- package/lib/transpile/swcrc.config.js +13 -0
- package/lib/webpack/helpers.js +9 -8
- package/lib/webpack/webpack.base.babel.js +1 -0
- package/lib/webpack/webpack.lib.base.babel.js +1 -0
- package/lib/webpack/webpack.lib.prod.babel.js +1 -1
- package/lib/webpack/webpack.storybook.js +1 -0
- package/package.json +24 -19
- package/lib/testing/setup-styled-components-tests.js +0 -1
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
|
|
|
@@ -21,18 +20,10 @@ async function handler(argv) {
|
|
|
21
20
|
if (argv.r) commandOptions += ' --bail --findRelatedTests';
|
|
22
21
|
if (argv.s) commandOptions += ' --silent';
|
|
23
22
|
try {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
// logSuccess('Linting completed');
|
|
29
|
-
// } catch (err) {
|
|
30
|
-
// logError('Linting failed');
|
|
31
|
-
// exit(-1, err);
|
|
32
|
-
// return -1;
|
|
33
|
-
// }
|
|
34
|
-
// }
|
|
35
|
-
await exec('rimraf ./reports');
|
|
23
|
+
if (CI) {
|
|
24
|
+
await exec('rimraf ./reports');
|
|
25
|
+
}
|
|
26
|
+
|
|
36
27
|
// eslint-disable-next-line jest/valid-title, jest/no-disabled-tests, jest/expect-expect
|
|
37
28
|
await test(commandOptions);
|
|
38
29
|
logSuccess('Unit test execution completed');
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const { getAppConfig, getAssetPath } = require('../webpack/helpers');
|
|
3
|
+
const swcrcConfig = require('../transpile/swcrc.config.js');
|
|
3
4
|
|
|
4
5
|
const name = '@elliemae/pui-cli';
|
|
5
6
|
const rootDir = path.join('<rootDir>', 'node_modules', name);
|
|
@@ -66,6 +67,9 @@ const jestConfig = {
|
|
|
66
67
|
'@elliemae/pui-user-monitoring': `${getRootDir()}/lib/testing/mocks/pui-user-monitoring.js`,
|
|
67
68
|
'@elliemae/pui-app-loader': `${getRootDir()}/lib/testing/mocks/pui-app-loader.js`,
|
|
68
69
|
'@elliemae/pui-diagnostics': `${getRootDir()}/lib/testing/mocks/pui-diagnostics.js`,
|
|
70
|
+
'react-spring/web': '<rootDir>/node_modules/react-spring/web.cjs.js',
|
|
71
|
+
'react-spring/renderprops':
|
|
72
|
+
'<rootDir>/node_modules/react-spring/renderprops.cjs.js',
|
|
69
73
|
'styled-components':
|
|
70
74
|
'<rootDir>/node_modules/styled-components/dist/styled-components.cjs.js',
|
|
71
75
|
},
|
|
@@ -74,17 +78,23 @@ const jestConfig = {
|
|
|
74
78
|
testRegex: '(app|lib).*/tests/.*\\.test\\.[jt]sx?$',
|
|
75
79
|
snapshotSerializers: [],
|
|
76
80
|
testResultsProcessor: 'jest-sonar-reporter',
|
|
77
|
-
resolver: '
|
|
81
|
+
resolver: path.resolve(__dirname, './resolver.js'),
|
|
78
82
|
transform: {
|
|
79
|
-
'^.+\\.[jt]sx?$': [
|
|
80
|
-
'esbuild-jest',
|
|
81
|
-
{
|
|
82
|
-
target: 'node14',
|
|
83
|
-
},
|
|
84
|
-
],
|
|
83
|
+
'^.+\\.[jt]sx?$': ['@swc/jest', swcrcConfig],
|
|
85
84
|
},
|
|
85
|
+
// transform: {
|
|
86
|
+
// '^.+\\.[jt]sx?$': [
|
|
87
|
+
// 'esbuild-jest',
|
|
88
|
+
// {
|
|
89
|
+
// target: 'es2020',
|
|
90
|
+
// loaders: {
|
|
91
|
+
// '.js': 'jsx',
|
|
92
|
+
// },
|
|
93
|
+
// },
|
|
94
|
+
// ],
|
|
95
|
+
// },
|
|
86
96
|
transformIgnorePatterns: [
|
|
87
|
-
'node_modules/(?!(@elliemae/pui-cli
|
|
97
|
+
'node_modules/(?!(@elliemae/pui-cli|lodash-es|react-select|react-dates)/)',
|
|
88
98
|
],
|
|
89
99
|
globals: {
|
|
90
100
|
APP_CONFIG: getAppConfig(),
|
|
@@ -96,6 +106,6 @@ const jestConfig = {
|
|
|
96
106
|
|
|
97
107
|
if (isReactModule && jestConfig.setupFilesAfterEnv)
|
|
98
108
|
jestConfig.setupFilesAfterEnv.push(
|
|
99
|
-
`${getRootDir()}/lib/testing/setup-
|
|
109
|
+
`${getRootDir()}/lib/testing/setup-react-env.js`,
|
|
100
110
|
);
|
|
101
111
|
module.exports = jestConfig;
|
|
@@ -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
|
+
};
|
|
@@ -8,6 +8,29 @@ import ResizeObserver from 'resize-observer-polyfill';
|
|
|
8
8
|
import addMatchMedia from './mocks/matchMedia.js';
|
|
9
9
|
import { logger } from './mocks/pui-diagnostics.js';
|
|
10
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
|
+
};
|
|
33
|
+
|
|
11
34
|
if (expect) expect.extend(jestAxe.toHaveNoViolations);
|
|
12
35
|
jest.setTimeout(60000);
|
|
13
36
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const { merge } = require('lodash');
|
|
4
|
+
|
|
5
|
+
let projectConfig = {};
|
|
6
|
+
const projectPath = path.join(process.cwd(), '.swcrc');
|
|
7
|
+
if (fs.existsSync(projectPath)) {
|
|
8
|
+
projectConfig = JSON.parse(fs.readFileSync(projectPath, 'utf-8'));
|
|
9
|
+
}
|
|
10
|
+
const localConfig = JSON.parse(
|
|
11
|
+
fs.readFileSync(path.join(__dirname, '.swcrc'), 'utf-8'),
|
|
12
|
+
);
|
|
13
|
+
module.exports = merge(localConfig, projectConfig);
|
package/lib/webpack/helpers.js
CHANGED
|
@@ -185,16 +185,17 @@ const isGoogleTagManagerEnabled = () => {
|
|
|
185
185
|
return !!appConfig?.googleTagManager;
|
|
186
186
|
};
|
|
187
187
|
|
|
188
|
-
const getCompressionPlugins = () => {
|
|
188
|
+
const getCompressionPlugins = (isLibrary = false) => {
|
|
189
|
+
const excludeList = [
|
|
190
|
+
/\/adrum-ext/,
|
|
191
|
+
/\/emuiUserMonitoring/,
|
|
192
|
+
/\/emuiDiagnostics/,
|
|
193
|
+
/\/emuiAppLoader/,
|
|
194
|
+
/\/encwLoader/,
|
|
195
|
+
];
|
|
189
196
|
const commonConfig = {
|
|
190
197
|
test: /\.(js|css)$/,
|
|
191
|
-
exclude: [
|
|
192
|
-
/\/adrum-ext/,
|
|
193
|
-
/\/emuiUserMonitoring/,
|
|
194
|
-
/\/emuiDiagnostics/,
|
|
195
|
-
/\/emuiAppLoader/,
|
|
196
|
-
/\/encwLoader/,
|
|
197
|
-
],
|
|
198
|
+
exclude: !isLibrary ? excludeList : [],
|
|
198
199
|
// 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
200
|
minRatio: Number.MAX_SAFE_INTEGER,
|
|
200
201
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elliemae/pui-cli",
|
|
3
|
-
"version": "6.0.0-beta.
|
|
3
|
+
"version": "6.0.0-beta.28",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "ICE MT UI Platform CLI",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -70,23 +70,26 @@
|
|
|
70
70
|
"@semantic-release/changelog": "~6.0.1",
|
|
71
71
|
"@semantic-release/exec": "~6.0.2",
|
|
72
72
|
"@semantic-release/git": "~10.0.1",
|
|
73
|
-
"@storybook/addon-a11y": "~6.4.
|
|
74
|
-
"@storybook/addon-essentials": "~6.4.
|
|
73
|
+
"@storybook/addon-a11y": "~6.4.9",
|
|
74
|
+
"@storybook/addon-essentials": "~6.4.9",
|
|
75
75
|
"@storybook/addon-events": "~6.2.9",
|
|
76
|
-
"@storybook/addon-interactions": "~6.4.
|
|
77
|
-
"@storybook/addon-links": "~6.4.
|
|
78
|
-
"@storybook/addon-storysource": "~6.4.
|
|
79
|
-
"@storybook/builder-webpack5": "~6.4.
|
|
80
|
-
"@storybook/manager-webpack5": "~6.4.
|
|
81
|
-
"@storybook/react": "~6.4.
|
|
82
|
-
"@storybook/theming": "~6.4.
|
|
76
|
+
"@storybook/addon-interactions": "~6.4.9",
|
|
77
|
+
"@storybook/addon-links": "~6.4.9",
|
|
78
|
+
"@storybook/addon-storysource": "~6.4.9",
|
|
79
|
+
"@storybook/builder-webpack5": "~6.4.9",
|
|
80
|
+
"@storybook/manager-webpack5": "~6.4.9",
|
|
81
|
+
"@storybook/react": "~6.4.9",
|
|
82
|
+
"@storybook/theming": "~6.4.9",
|
|
83
83
|
"@stylelint/postcss-css-in-js": "~0.37.2",
|
|
84
84
|
"@svgr/webpack": "~6.1.1",
|
|
85
|
+
"@swc/cli": "~0.1.52",
|
|
86
|
+
"@swc/core": "~1.2.118",
|
|
87
|
+
"@swc/jest": "~0.2.12",
|
|
85
88
|
"@testing-library/jest-dom": "~5.16.1",
|
|
86
89
|
"@testing-library/react": "~12.1.2",
|
|
87
90
|
"@testing-library/react-hooks": "~7.0.2",
|
|
88
91
|
"@types/jest": "~27.0.3",
|
|
89
|
-
"@types/node": "~16.11.
|
|
92
|
+
"@types/node": "~16.11.12",
|
|
90
93
|
"@types/rimraf": "~3.0.2",
|
|
91
94
|
"@types/testing-library__jest-dom": "~5.14.2",
|
|
92
95
|
"@typescript-eslint/eslint-plugin": "~5.6.0",
|
|
@@ -125,11 +128,12 @@
|
|
|
125
128
|
"dotenv": "~10.0.0",
|
|
126
129
|
"dotenv-webpack": "~7.0.3",
|
|
127
130
|
"duplicate-package-checker-webpack-plugin": "~3.0.0",
|
|
131
|
+
"enhanced-resolve": "~5.8.3",
|
|
128
132
|
"esbuild": "~0.14.2",
|
|
129
133
|
"esbuild-jest": "~0.5.0",
|
|
130
134
|
"esbuild-loader": "~2.16.0",
|
|
131
135
|
"esbuild-plugin-svgr": "~0.0.3",
|
|
132
|
-
"eslint": "~8.4.
|
|
136
|
+
"eslint": "~8.4.1",
|
|
133
137
|
"eslint-config-airbnb": "~18.2.1",
|
|
134
138
|
"eslint-config-airbnb-base": "~15.0.0",
|
|
135
139
|
"eslint-config-airbnb-typescript": "~15.0.0",
|
|
@@ -148,7 +152,7 @@
|
|
|
148
152
|
"eslint-plugin-prettier": "~4.0.0",
|
|
149
153
|
"eslint-plugin-react": "~7.27.1",
|
|
150
154
|
"eslint-plugin-react-hooks": "~4.3.0",
|
|
151
|
-
"eslint-plugin-redux-saga": "~1.2
|
|
155
|
+
"eslint-plugin-redux-saga": "~1.3.2",
|
|
152
156
|
"eslint-plugin-storybook": "~0.5.3",
|
|
153
157
|
"eslint-plugin-testing-library": "~5.0.1",
|
|
154
158
|
"eslint-plugin-wdio": "~7.4.2",
|
|
@@ -179,7 +183,8 @@
|
|
|
179
183
|
"minimist": "~1.2.5",
|
|
180
184
|
"moment": "~2.29.1",
|
|
181
185
|
"moment-locales-webpack-plugin": "~1.2.0",
|
|
182
|
-
"msw": "~0.36.
|
|
186
|
+
"msw": "~0.36.2",
|
|
187
|
+
"node-gyp": "~8.4.1",
|
|
183
188
|
"node-plop": "~0.30.0",
|
|
184
189
|
"nodemon": "~2.0.15",
|
|
185
190
|
"npm-check-updates": "12.0.3",
|
|
@@ -187,7 +192,7 @@
|
|
|
187
192
|
"pino": "~7.5.1",
|
|
188
193
|
"pino-pretty": "~7.2.0",
|
|
189
194
|
"pinst": "~2.1.6",
|
|
190
|
-
"plop": "~3.0.
|
|
195
|
+
"plop": "~3.0.4",
|
|
191
196
|
"postcss": "~8.4.4",
|
|
192
197
|
"postcss-jsx": "~0.36.4",
|
|
193
198
|
"postcss-html": "~1.3.0",
|
|
@@ -210,8 +215,8 @@
|
|
|
210
215
|
"script-loader": "~0.7.2",
|
|
211
216
|
"semantic-release": "~18.0.1",
|
|
212
217
|
"shelljs": "~0.8.4",
|
|
213
|
-
"slackify-markdown": "~4.3.
|
|
214
|
-
"storybook-builder-vite": "~0.1.
|
|
218
|
+
"slackify-markdown": "~4.3.1",
|
|
219
|
+
"storybook-builder-vite": "~0.1.11",
|
|
215
220
|
"storybook-addon-turbo-build": "~1.0.1",
|
|
216
221
|
"storybook-react-router": "~1.0.8",
|
|
217
222
|
"style-loader": "~3.3.1",
|
|
@@ -222,8 +227,8 @@
|
|
|
222
227
|
"stylelint-processor-styled-components": "~1.10.0",
|
|
223
228
|
"svg-url-loader": "~7.1.1",
|
|
224
229
|
"svgo": "~2.8.0",
|
|
230
|
+
"swc-loader": "~0.1.15",
|
|
225
231
|
"terser-webpack-plugin": "~5.2.5",
|
|
226
|
-
"ts-jest-resolver": "~2.0.0",
|
|
227
232
|
"ts-node": "~10.4.0",
|
|
228
233
|
"tsc-alias": "~1.4.2",
|
|
229
234
|
"tsc-files": "~1.1.3",
|
|
@@ -234,7 +239,7 @@
|
|
|
234
239
|
"update-notifier": "~5.1.0",
|
|
235
240
|
"url-loader": "~4.1.1",
|
|
236
241
|
"uuid": "~8.3.2",
|
|
237
|
-
"vite": "~2.
|
|
242
|
+
"vite": "~2.7.1",
|
|
238
243
|
"webpack": "~5.65.0",
|
|
239
244
|
"webpack-bundle-analyzer": "~4.5.0",
|
|
240
245
|
"webpack-cli": "~4.9.1",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import 'jest-styled-components';
|