@elliemae/pui-cli 6.0.0-beta.23 → 6.0.0-beta.27

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.
@@ -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
- // if (!CI) {
25
- // try {
26
- // await lintJS();
27
- // await lintCSS();
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');
@@ -0,0 +1,18 @@
1
+ const path = require('path');
2
+ const fs = require('fs');
3
+ const { merge } = require('lodash');
4
+
5
+ const baseConfig = {
6
+ esBuild: {
7
+ target: 'es2020',
8
+ },
9
+ };
10
+
11
+ const getPUIConfig = () => {
12
+ const configPath = path.resolve(process.cwd(), './pui.config.js');
13
+ if (!fs.existsSync(configPath)) return baseConfig;
14
+ const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
15
+ return merge(baseConfig, config);
16
+ };
17
+
18
+ exports.getPUIConfig = getPUIConfig;
@@ -74,17 +74,20 @@ const jestConfig = {
74
74
  testRegex: '(app|lib).*/tests/.*\\.test\\.[jt]sx?$',
75
75
  snapshotSerializers: [],
76
76
  testResultsProcessor: 'jest-sonar-reporter',
77
- resolver: 'ts-jest-resolver',
77
+ resolver: path.resolve(__dirname, './resolver.js'),
78
78
  transform: {
79
79
  '^.+\\.[jt]sx?$': [
80
80
  'esbuild-jest',
81
81
  {
82
- target: 'node14',
82
+ target: 'es2020',
83
+ loaders: {
84
+ '.js': 'jsx',
85
+ },
83
86
  },
84
87
  ],
85
88
  },
86
89
  transformIgnorePatterns: [
87
- 'node_modules/(?!(@elliemae/pui-cli/lib/testing/*)/)',
90
+ 'node_modules/(?!(@elliemae/em-platform-document-viewer|@elliemae/pui-cli|@elliemae/pui-app-widgets|lodash-es|react-spring|react-select|react-dates|@babel/runtime)/)',
88
91
  ],
89
92
  globals: {
90
93
  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
+ };
@@ -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
 
@@ -2,12 +2,13 @@ const esbuild = require('esbuild');
2
2
  const fg = require('fast-glob');
3
3
  const fs = require('fs');
4
4
  const path = require('path');
5
+ const { getPUIConfig } = require('../pui-config');
5
6
 
6
- const ESBUILD_TARGET = 'es2020';
7
+ const { esBuild } = getPUIConfig();
7
8
 
8
9
  const commonConfig = {
9
10
  bundle: false,
10
- target: ESBUILD_TARGET,
11
+ target: esBuild.target,
11
12
  loader: { '.js': 'jsx' },
12
13
  mainFields: ['module', 'browser', 'main'],
13
14
  inject: [path.resolve(__dirname, './react-shim.js')],
@@ -33,30 +34,29 @@ const build = async ({ srcPath, commonJS }) => {
33
34
  `!${srcPath}/**/*.stories.{js,jsx,ts,tsx}`,
34
35
  `!${srcPath}/**/*.endpoint.{js,jsx,ts,tsx}`,
35
36
  ];
36
- if (!commonJS) {
37
- const outdir = `${distFolder}/es`;
38
- const entryPoints = await fg(inputFiles);
37
+ if (commonJS) {
38
+ const outdir = `${distFolder}/cjs`;
39
+ const commonJSEntryPoints = await fg(inputFiles);
39
40
  await esbuild.build({
40
- entryPoints,
41
+ entryPoints: commonJSEntryPoints,
41
42
  ...commonConfig,
42
43
  outdir,
43
- format: 'esm',
44
+ format: 'cjs',
44
45
  });
45
46
  await copyFiles({ srcdir: srcPath, outdir });
46
47
  } else {
47
- const outdir = `${distFolder}/cjs`;
48
- const commonJSEntryPoints = await fg(
49
- inputFiles.concat([`${srcPath}/**/*.cjs`]),
48
+ const outdir = `${distFolder}/es`;
49
+ const entryPoints = await fg(
50
+ inputFiles.concat([`!${srcPath}/**/cjs/**/*.{js,jsx,ts,tsx}`]),
50
51
  );
51
52
  await esbuild.build({
52
- entryPoints: commonJSEntryPoints,
53
+ entryPoints,
53
54
  ...commonConfig,
54
55
  outdir,
55
- format: 'cjs',
56
+ format: 'esm',
56
57
  });
57
58
  await copyFiles({ srcdir: srcPath, outdir });
58
59
  }
59
60
  };
60
61
 
61
62
  exports.esBuild = build;
62
- exports.ESBUILD_TARGET = ESBUILD_TARGET;
@@ -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
  };
@@ -17,7 +17,8 @@ const {
17
17
  getAlias,
18
18
  getPaths,
19
19
  } = require('./helpers');
20
- const { ESBUILD_TARGET } = require('../transpile/esbuild');
20
+ const { getPUIConfig } = require('../pui-config');
21
+ const { esBuild } = getPUIConfig();
21
22
 
22
23
  const minicssLoader = {
23
24
  loader: MiniCssExtractPlugin.loader,
@@ -152,7 +153,7 @@ module.exports = (options) => ({
152
153
  loader: 'esbuild-loader',
153
154
  options: {
154
155
  loader: 'jsx',
155
- target: ESBUILD_TARGET,
156
+ target: esBuild.target,
156
157
  },
157
158
  },
158
159
  },
@@ -166,7 +167,7 @@ module.exports = (options) => ({
166
167
  loader: 'esbuild-loader',
167
168
  options: {
168
169
  loader: 'tsx',
169
- target: ESBUILD_TARGET,
170
+ target: esBuild.target,
170
171
  },
171
172
  },
172
173
  },
@@ -207,6 +208,7 @@ module.exports = (options) => ({
207
208
  {
208
209
  test: /\.svg$/i,
209
210
  issuer: /\.[jt]sx?$/,
211
+ resourceQuery: /^((?!url).)*$/,
210
212
  use: ['@svgr/webpack'],
211
213
  },
212
214
  {
@@ -19,7 +19,8 @@ const {
19
19
  getAssetPath,
20
20
  getAlias,
21
21
  } = require('./helpers');
22
- const { ESBUILD_TARGET } = require('../transpile/esbuild');
22
+ const { getPUIConfig } = require('../pui-config');
23
+ const { esBuild } = getPUIConfig();
23
24
 
24
25
  const minicssLoader = {
25
26
  loader: MiniCssExtractPlugin.loader,
@@ -100,7 +101,7 @@ module.exports = (options) => ({
100
101
  loader: 'esbuild-loader',
101
102
  options: {
102
103
  loader: 'jsx',
103
- target: ESBUILD_TARGET,
104
+ target: esBuild.target,
104
105
  },
105
106
  },
106
107
  },
@@ -114,7 +115,7 @@ module.exports = (options) => ({
114
115
  loader: 'esbuild-loader',
115
116
  options: {
116
117
  loader: 'tsx',
117
- target: ESBUILD_TARGET,
118
+ target: esBuild.target,
118
119
  },
119
120
  },
120
121
  },
@@ -172,6 +173,7 @@ module.exports = (options) => ({
172
173
  {
173
174
  test: /\.svg$/i,
174
175
  issuer: /\.[jt]sx?$/,
176
+ resourceQuery: /^((?!url).)*$/,
175
177
  use: ['@svgr/webpack'],
176
178
  },
177
179
  {
@@ -4,7 +4,8 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
4
4
  const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
5
5
  const { ESBuildMinifyPlugin } = require('esbuild-loader');
6
6
  const { getLibraryName, getCompressionPlugins } = require('./helpers');
7
- const { ESBUILD_TARGET } = require('../transpile/esbuild');
7
+ const { getPUIConfig } = require('../pui-config');
8
+ const { esBuild } = getPUIConfig();
8
9
 
9
10
  const libraryName = getLibraryName();
10
11
 
@@ -23,7 +24,7 @@ module.exports = require('./webpack.lib.base.babel')({
23
24
  minimize: true,
24
25
  minimizer: [
25
26
  new ESBuildMinifyPlugin({
26
- target: ESBUILD_TARGET,
27
+ target: esBuild.target,
27
28
  css: true,
28
29
  }),
29
30
  ],
@@ -61,7 +62,7 @@ module.exports = require('./webpack.lib.base.babel')({
61
62
  chunkFilename: `css/${libraryName}.[contenthash].chunk.css`,
62
63
  }),
63
64
 
64
- ...getCompressionPlugins(),
65
+ ...getCompressionPlugins(true),
65
66
 
66
67
  new BundleAnalyzerPlugin({
67
68
  analyzerMode: 'static',
@@ -16,7 +16,8 @@ const {
16
16
  isGoogleTagManagerEnabled,
17
17
  getCompressionPlugins,
18
18
  } = require('./helpers');
19
- const { ESBUILD_TARGET } = require('../transpile/esbuild');
19
+ const { getPUIConfig } = require('../pui-config');
20
+ const { esBuild } = getPUIConfig();
20
21
 
21
22
  const getProdConfig = ({ latestVersion = true } = {}) => {
22
23
  const { buildPath, publicPath } = getPaths(latestVersion);
@@ -41,7 +42,7 @@ const getProdConfig = ({ latestVersion = true } = {}) => {
41
42
  moduleIds: 'deterministic',
42
43
  minimizer: [
43
44
  new ESBuildMinifyPlugin({
44
- target: ESBUILD_TARGET,
45
+ target: esBuild.target,
45
46
  css: true,
46
47
  }),
47
48
  ],
@@ -69,6 +69,7 @@ const getModuleRules = () => [
69
69
  {
70
70
  test: /\.svg$/i,
71
71
  issuer: /\.[jt]sx?$/,
72
+ resourceQuery: /^((?!url).)*$/,
72
73
  use: ['@svgr/webpack'],
73
74
  },
74
75
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/pui-cli",
3
- "version": "6.0.0-beta.23",
3
+ "version": "6.0.0-beta.27",
4
4
  "private": false,
5
5
  "description": "ICE MT UI Platform CLI",
6
6
  "sideEffects": false,
@@ -70,27 +70,27 @@
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.7",
74
- "@storybook/addon-essentials": "~6.4.7",
73
+ "@storybook/addon-a11y": "~6.4.8",
74
+ "@storybook/addon-essentials": "~6.4.8",
75
75
  "@storybook/addon-events": "~6.2.9",
76
- "@storybook/addon-interactions": "~6.4.7",
77
- "@storybook/addon-links": "~6.4.7",
78
- "@storybook/addon-storysource": "~6.4.7",
79
- "@storybook/builder-webpack5": "~6.4.7",
80
- "@storybook/manager-webpack5": "~6.4.7",
81
- "@storybook/react": "~6.4.7",
82
- "@storybook/theming": "~6.4.7",
76
+ "@storybook/addon-interactions": "~6.4.8",
77
+ "@storybook/addon-links": "~6.4.8",
78
+ "@storybook/addon-storysource": "~6.4.8",
79
+ "@storybook/builder-webpack5": "~6.4.8",
80
+ "@storybook/manager-webpack5": "~6.4.8",
81
+ "@storybook/react": "~6.4.8",
82
+ "@storybook/theming": "~6.4.8",
83
83
  "@stylelint/postcss-css-in-js": "~0.37.2",
84
84
  "@svgr/webpack": "~6.1.1",
85
- "@testing-library/jest-dom": "~5.16.0",
85
+ "@testing-library/jest-dom": "~5.16.1",
86
86
  "@testing-library/react": "~12.1.2",
87
87
  "@testing-library/react-hooks": "~7.0.2",
88
88
  "@types/jest": "~27.0.3",
89
- "@types/node": "~16.11.11",
89
+ "@types/node": "~16.11.12",
90
90
  "@types/rimraf": "~3.0.2",
91
91
  "@types/testing-library__jest-dom": "~5.14.2",
92
- "@typescript-eslint/eslint-plugin": "~5.5.0",
93
- "@typescript-eslint/parser": "~5.5.0",
92
+ "@typescript-eslint/eslint-plugin": "~5.6.0",
93
+ "@typescript-eslint/parser": "~5.6.0",
94
94
  "autoprefixer": "~10.4.0",
95
95
  "axe-core": "~4.3.5",
96
96
  "babel-loader": "~8.2.3",
@@ -125,11 +125,12 @@
125
125
  "dotenv": "~10.0.0",
126
126
  "dotenv-webpack": "~7.0.3",
127
127
  "duplicate-package-checker-webpack-plugin": "~3.0.0",
128
+ "enhanced-resolve": "~5.8.3",
128
129
  "esbuild": "~0.14.2",
129
130
  "esbuild-jest": "~0.5.0",
130
131
  "esbuild-loader": "~2.16.0",
131
132
  "esbuild-plugin-svgr": "~0.0.3",
132
- "eslint": "~8.4.0",
133
+ "eslint": "~8.4.1",
133
134
  "eslint-config-airbnb": "~18.2.1",
134
135
  "eslint-config-airbnb-base": "~15.0.0",
135
136
  "eslint-config-airbnb-typescript": "~15.0.0",
@@ -148,7 +149,7 @@
148
149
  "eslint-plugin-prettier": "~4.0.0",
149
150
  "eslint-plugin-react": "~7.27.1",
150
151
  "eslint-plugin-react-hooks": "~4.3.0",
151
- "eslint-plugin-redux-saga": "~1.2.1",
152
+ "eslint-plugin-redux-saga": "~1.2.2",
152
153
  "eslint-plugin-storybook": "~0.5.3",
153
154
  "eslint-plugin-testing-library": "~5.0.1",
154
155
  "eslint-plugin-wdio": "~7.4.2",
@@ -179,15 +180,16 @@
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.0",
183
+ "msw": "~0.36.2",
184
+ "node-gyp": "~8.4.1",
183
185
  "node-plop": "~0.30.0",
184
186
  "nodemon": "~2.0.15",
185
- "npm-check-updates": "12.0.2",
187
+ "npm-check-updates": "12.0.3",
186
188
  "null-loader": "~4.0.1",
187
189
  "pino": "~7.5.1",
188
190
  "pino-pretty": "~7.2.0",
189
191
  "pinst": "~2.1.6",
190
- "plop": "~3.0.2",
192
+ "plop": "~3.0.3",
191
193
  "postcss": "~8.4.4",
192
194
  "postcss-jsx": "~0.36.4",
193
195
  "postcss-html": "~1.3.0",
@@ -210,8 +212,8 @@
210
212
  "script-loader": "~0.7.2",
211
213
  "semantic-release": "~18.0.1",
212
214
  "shelljs": "~0.8.4",
213
- "slackify-markdown": "~4.3.0",
214
- "storybook-builder-vite": "~0.1.10",
215
+ "slackify-markdown": "~4.3.1",
216
+ "storybook-builder-vite": "~0.1.11",
215
217
  "storybook-addon-turbo-build": "~1.0.1",
216
218
  "storybook-react-router": "~1.0.8",
217
219
  "style-loader": "~3.3.1",
@@ -223,7 +225,6 @@
223
225
  "svg-url-loader": "~7.1.1",
224
226
  "svgo": "~2.8.0",
225
227
  "terser-webpack-plugin": "~5.2.5",
226
- "ts-jest-resolver": "~2.0.0",
227
228
  "ts-node": "~10.4.0",
228
229
  "tsc-alias": "~1.4.2",
229
230
  "tsc-files": "~1.1.3",
@@ -234,8 +235,8 @@
234
235
  "update-notifier": "~5.1.0",
235
236
  "url-loader": "~4.1.1",
236
237
  "uuid": "~8.3.2",
237
- "vite": "~2.6.14",
238
- "webpack": "~5.64.4",
238
+ "vite": "~2.7.1",
239
+ "webpack": "~5.65.0",
239
240
  "webpack-bundle-analyzer": "~4.5.0",
240
241
  "webpack-cli": "~4.9.1",
241
242
  "webpack-dev-middleware": "~5.2.2",