@elliemae/pui-cli 6.0.0-beta.21 → 6.0.0-beta.25

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.
@@ -4,7 +4,7 @@ const path = require('path');
4
4
  const { writeFile, readFile } = require('fs/promises');
5
5
  const { exec, logInfo, logError, logSuccess } = require('./utils');
6
6
  const { isTypeScriptEnabled } = require('../typescript/util');
7
- const { esBuild } = require('../esbuild');
7
+ const { esBuild } = require('../transpile/esbuild');
8
8
 
9
9
  const { name } = require('../../package.json');
10
10
 
@@ -1,6 +1,6 @@
1
1
  const { exit } = require('yargs');
2
2
  const { exec, logError, logSuccess } = require('./utils');
3
- const { lintCSS, lintJS } = require('./lint');
3
+ // const { lintCSS, lintJS } = require('./lint');
4
4
 
5
5
  const { CI = false } = process.env;
6
6
 
@@ -21,20 +21,18 @@ async function handler(argv) {
21
21
  if (argv.r) commandOptions += ' --bail --findRelatedTests';
22
22
  if (argv.s) commandOptions += ' --silent';
23
23
  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
- } else {
35
- await exec('rimraf ./reports');
36
- }
37
-
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');
38
36
  // eslint-disable-next-line jest/valid-title, jest/no-disabled-tests, jest/expect-expect
39
37
  await test(commandOptions);
40
38
  logSuccess('Unit test execution completed');
@@ -37,7 +37,7 @@ const baseRules = {
37
37
  'import/prefer-default-export': 0,
38
38
  'import/extensions': [
39
39
  2,
40
- 'ignorePackages',
40
+ 'never',
41
41
  {
42
42
  json: 'ignorePackages',
43
43
  js: 'ignorePackages',
@@ -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;
@@ -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;
File without changes
@@ -17,7 +17,8 @@ const {
17
17
  getAlias,
18
18
  getPaths,
19
19
  } = require('./helpers');
20
- const { ESBUILD_TARGET } = require('../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
  {
@@ -240,6 +242,6 @@ module.exports = (options) => ({
240
242
  '@elliemae/pui-diagnostics': 'emuiDiagnostics',
241
243
  },
242
244
  devtool: options.devtool || 'eval-source-map',
243
- target: 'web', // Make web variables accessible to webpack, e.g. window
245
+ target: 'web',
244
246
  performance: options.performance || {},
245
247
  });
@@ -105,8 +105,6 @@ const devConfig = {
105
105
  }),
106
106
  ],
107
107
 
108
- // Emit a source map for easier debugging
109
- // See https://webpack.js.org/configuration/devtool/#devtool
110
108
  devtool: 'eval-source-map',
111
109
 
112
110
  performance: {
@@ -19,7 +19,8 @@ const {
19
19
  getAssetPath,
20
20
  getAlias,
21
21
  } = require('./helpers');
22
- const { ESBUILD_TARGET } = require('../esbuild');
22
+ const { getPUIConfig } = require('../pui-config');
23
+ const { esBuild } = getPUIConfig();
23
24
 
24
25
  const minicssLoader = {
25
26
  loader: MiniCssExtractPlugin.loader,
@@ -74,7 +75,7 @@ module.exports = (options) => ({
74
75
  module: {
75
76
  rules: [
76
77
  {
77
- test: /^(?!.*\.exec\.js$).*\.(js|ts|jsx|tsx)$/,
78
+ test: /^(?!.*\.exec\.js$).*\.[jt]sx?$/,
78
79
  enforce: 'pre',
79
80
  exclude: /node_modules/,
80
81
  resolve: {
@@ -91,7 +92,7 @@ module.exports = (options) => ({
91
92
  ],
92
93
  },
93
94
  {
94
- test: /^(?!.*\.exec\.js$).*\.(js|ts|jsx|tsx)$/, // Transform all .js and .jsx files with Babel
95
+ test: /^(?!.*\.exec\.js$).*\.jsx?$/, // Transform all .js and .jsx files with Babel
95
96
  exclude: excludeNodeModulesExcept(modulesToTranspile),
96
97
  resolve: {
97
98
  fullySpecified: false,
@@ -100,7 +101,21 @@ module.exports = (options) => ({
100
101
  loader: 'esbuild-loader',
101
102
  options: {
102
103
  loader: 'jsx',
103
- target: ESBUILD_TARGET,
104
+ target: esBuild.target,
105
+ },
106
+ },
107
+ },
108
+ {
109
+ test: /^(?!.*\.exec\.js$).*\.tsx?$/, // Transform all .js and .jsx files with Babel
110
+ exclude: excludeNodeModulesExcept(modulesToTranspile),
111
+ resolve: {
112
+ fullySpecified: false,
113
+ },
114
+ use: {
115
+ loader: 'esbuild-loader',
116
+ options: {
117
+ loader: 'tsx',
118
+ target: esBuild.target,
104
119
  },
105
120
  },
106
121
  },
@@ -155,13 +170,10 @@ module.exports = (options) => ({
155
170
  exclude: excludeNodeModulesExcept(['@elliemae/*']),
156
171
  type: 'asset/resource',
157
172
  },
158
- {
159
- type: 'asset',
160
- resourceQuery: /url/, // *.svg?react
161
- },
162
173
  {
163
174
  test: /\.svg$/i,
164
175
  issuer: /\.[jt]sx?$/,
176
+ resourceQuery: /^((?!url).)*$/,
165
177
  use: ['@svgr/webpack'],
166
178
  },
167
179
  {
@@ -183,6 +195,10 @@ module.exports = (options) => ({
183
195
  resourceQuery: /resource/,
184
196
  type: 'asset/resource',
185
197
  },
198
+ {
199
+ type: 'asset',
200
+ resourceQuery: /url/,
201
+ },
186
202
  ],
187
203
  },
188
204
  plugins: plugins.concat(options.plugins || []),
@@ -191,7 +207,6 @@ module.exports = (options) => ({
191
207
  extensions: ['.wasm', '.mjs', '.ts', '.tsx', '.js', '.jsx', '.json'],
192
208
  mainFields: ['browser', 'module', 'main'],
193
209
  alias: {
194
- 'lodash-es': 'lodash',
195
210
  ...getAlias(),
196
211
  ...((options.resolve || {}).alias || {}),
197
212
  },
@@ -43,8 +43,6 @@ module.exports = require('./webpack.lib.base.babel')({
43
43
  }),
44
44
  ],
45
45
 
46
- // Emit a source map for easier debugging
47
- // See https://webpack.js.org/configuration/devtool/#devtool
48
46
  devtool: 'eval-source-map',
49
47
 
50
48
  performance: {
@@ -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('../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
  ],
@@ -16,7 +16,8 @@ const {
16
16
  isGoogleTagManagerEnabled,
17
17
  getCompressionPlugins,
18
18
  } = require('./helpers');
19
- const { ESBUILD_TARGET } = require('../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
  ],
@@ -1,6 +1,7 @@
1
1
  const webpack = require('webpack');
2
2
  const MiniCssExtractPlugin = require('mini-css-extract-plugin');
3
3
  const CopyWebpackPlugin = require('copy-webpack-plugin');
4
+ const ResolveTypeScriptPlugin = require('resolve-typescript-plugin').default;
4
5
  const {
5
6
  getAppConfig,
6
7
  isApp,
@@ -45,7 +46,7 @@ const getAdditionalPlugins = () => [
45
46
 
46
47
  const getModuleRules = () => [
47
48
  {
48
- test: /\.(js|ts|jsx|tsx)$/,
49
+ test: /\.[jt]sx?$/,
49
50
  enforce: 'pre',
50
51
  exclude: /node_modules/,
51
52
  resolve: {
@@ -68,6 +69,7 @@ const getModuleRules = () => [
68
69
  {
69
70
  test: /\.svg$/i,
70
71
  issuer: /\.[jt]sx?$/,
72
+ resourceQuery: /^((?!url).)*$/,
71
73
  use: ['@svgr/webpack'],
72
74
  },
73
75
  ];
@@ -87,6 +89,10 @@ exports.webpackFinal = async (config, { configType }) => {
87
89
  config.resolve.alias = { ...config.resolve.alias, ...getAlias() };
88
90
  config.resolve.fallback = { ...config.resolve.fallback, crypto: false };
89
91
  config.resolve.extensions.push('.svg');
92
+ config.resolve.plugins = [
93
+ ...(config.resolve.plugins || []),
94
+ new ResolveTypeScriptPlugin(),
95
+ ];
90
96
  config.externals = config.externals || {};
91
97
  config.externals['@elliemae/pui-user-monitoring'] = 'emuiUserMonitoring';
92
98
  config.externals['@elliemae/pui-app-loader'] = 'emuiAppLoader';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/pui-cli",
3
- "version": "6.0.0-beta.21",
3
+ "version": "6.0.0-beta.25",
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
- "@svgr/webpack": "~6.1.0",
85
- "@testing-library/jest-dom": "~5.16.0",
84
+ "@svgr/webpack": "~6.1.1",
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,11 @@
125
125
  "dotenv": "~10.0.0",
126
126
  "dotenv-webpack": "~7.0.3",
127
127
  "duplicate-package-checker-webpack-plugin": "~3.0.0",
128
- "esbuild": "~0.14.1",
128
+ "esbuild": "~0.14.2",
129
129
  "esbuild-jest": "~0.5.0",
130
130
  "esbuild-loader": "~2.16.0",
131
131
  "esbuild-plugin-svgr": "~0.0.3",
132
- "eslint": "~8.3.0",
132
+ "eslint": "~8.4.1",
133
133
  "eslint-config-airbnb": "~18.2.1",
134
134
  "eslint-config-airbnb-base": "~15.0.0",
135
135
  "eslint-config-airbnb-typescript": "~15.0.0",
@@ -179,10 +179,11 @@
179
179
  "minimist": "~1.2.5",
180
180
  "moment": "~2.29.1",
181
181
  "moment-locales-webpack-plugin": "~1.2.0",
182
- "msw": "~0.35.0",
182
+ "msw": "~0.36.1",
183
+ "node-gyp": "~8.4.1",
183
184
  "node-plop": "~0.30.0",
184
185
  "nodemon": "~2.0.15",
185
- "npm-check-updates": "12.0.2",
186
+ "npm-check-updates": "12.0.3",
186
187
  "null-loader": "~4.0.1",
187
188
  "pino": "~7.5.1",
188
189
  "pino-pretty": "~7.2.0",
@@ -195,7 +196,7 @@
195
196
  "postcss-syntax": "~0.36.2",
196
197
  "postcss-loader": "~6.2.1",
197
198
  "postcss-preset-env": "~7.0.1",
198
- "prettier": "~2.5.0",
199
+ "prettier": "~2.5.1",
199
200
  "pug": "~3.0.2",
200
201
  "pug-loader": "~2.4.0",
201
202
  "raf": "~3.4.1",
@@ -205,6 +206,7 @@
205
206
  "react-refresh": "~0.11.0",
206
207
  "react-test-renderer": "~17.0.2",
207
208
  "resize-observer-polyfill": "~1.5.1",
209
+ "resolve-typescript-plugin": "~1.1.1",
208
210
  "rimraf": "~3.0.2",
209
211
  "script-loader": "~0.7.2",
210
212
  "semantic-release": "~18.0.1",
@@ -234,7 +236,7 @@
234
236
  "url-loader": "~4.1.1",
235
237
  "uuid": "~8.3.2",
236
238
  "vite": "~2.6.14",
237
- "webpack": "~5.64.4",
239
+ "webpack": "~5.65.0",
238
240
  "webpack-bundle-analyzer": "~4.5.0",
239
241
  "webpack-cli": "~4.9.1",
240
242
  "webpack-dev-middleware": "~5.2.2",