@elliemae/pui-cli 6.0.0-beta.3 → 6.0.0-beta.7

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,8 +1,10 @@
1
+ /* eslint-disable max-lines */
1
2
  const { exit } = require('yargs');
2
3
  const path = require('path');
3
4
  const { writeFile, readFile } = require('fs/promises');
4
5
  const { exec, logInfo, logError, logSuccess } = require('./utils');
5
6
  const { isTypeScriptEnabled } = require('../typescript/util');
7
+ const { esBuild } = require('../esbuild');
6
8
 
7
9
  const { name } = require('../../package.json');
8
10
 
@@ -37,14 +39,9 @@ async function createPackageJson(file, commonJS, sideEffects) {
37
39
  await writeFile(file, packageJSON);
38
40
  }
39
41
 
40
- async function nodeBuild({ srcPath, commonJS, emitModuleType, target }) {
42
+ async function nodeBuild({ srcPath, commonJS, emitModuleType }) {
41
43
  const outDir = `./dist/${commonJS ? 'cjs' : 'es'}`;
42
- const targetEnv = target === 'node' ? 'TARGET_ENV=node' : '';
43
- const babelEnv = commonJS ? ' ES_MODULES=false' : '';
44
- await exec(
45
- `cross-env NODE_ENV=production MODULE_EXTENSIONS=true ${targetEnv}${babelEnv} babel --extensions ".ts,.tsx,.js,.jsx" ${srcPath} --out-dir ${outDir} --copy-files --no-copy-ignored --ignore **/*.test.js --ignore **/*.test.ts --ignore **/*.spec.js --ignore **/*.spec.ts --ignore **/*.test.jsx --ignore **/*.test.tsx --ignore **/*.spec.jsx --ignore **/*.spec.tsx`,
46
- { shell: true, stdio: 'inherit' },
47
- );
44
+ await esBuild({ srcPath, commonJS });
48
45
  if (emitModuleType) {
49
46
  const sideEffects = await getSideEffects();
50
47
  await createPackageJson(
@@ -79,7 +76,6 @@ async function pack({ production, target, module, srcPath, emitModuleType }) {
79
76
  srcPath,
80
77
  commonJS: false,
81
78
  emitModuleType,
82
- target,
83
79
  });
84
80
  }
85
81
  }
@@ -118,7 +114,6 @@ exports.builder = {
118
114
  },
119
115
  emitModuleType: {
120
116
  type: 'boolean',
121
- // eslint-disable-next-line max-lines
122
117
  default: true,
123
118
  description:
124
119
  'creates type attribute in the package.json and sets its value to commonjs or module based on module cli argument. default: true',
package/lib/esbuild.js ADDED
@@ -0,0 +1,44 @@
1
+ const esbuild = require('esbuild');
2
+ const fg = require('fast-glob');
3
+
4
+ const ESBUILD_TARGET = 'es2020';
5
+
6
+ const commonConfig = {
7
+ bundle: false,
8
+ target: ESBUILD_TARGET,
9
+ loader: { '.js': 'jsx' },
10
+ mainFields: ['module', 'browser', 'main'],
11
+ };
12
+
13
+ const outDir = 'dist';
14
+
15
+ const build = async ({ srcPath, commonJS }) => {
16
+ const inputFiles = [
17
+ `${srcPath}/**/*.{js,jsx,ts,tsx}`,
18
+ `!${srcPath}/**/*.test.{js,jsx,ts,tsx}`,
19
+ `!${srcPath}/**/*.stories.{js,jsx,ts,tsx}`,
20
+ `!${srcPath}/**/*.endpoint.{js,jsx,ts,tsx}`,
21
+ ];
22
+ if (!commonJS) {
23
+ const entryPoints = await fg(inputFiles);
24
+ await esbuild.build({
25
+ entryPoints,
26
+ ...commonConfig,
27
+ outdir: `${outDir}/es`,
28
+ format: 'esm',
29
+ });
30
+ } else {
31
+ const commonJSEntryPoints = await fg(
32
+ inputFiles.concat([`${srcPath}/**/*.cjs`]),
33
+ );
34
+ await esbuild.build({
35
+ entryPoints: commonJSEntryPoints,
36
+ ...commonConfig,
37
+ outdir: `${outDir}/cjs`,
38
+ format: 'cjs',
39
+ });
40
+ }
41
+ };
42
+
43
+ exports.esBuild = build;
44
+ exports.ESBUILD_TARGET = ESBUILD_TARGET;
@@ -13,8 +13,11 @@ const { loadRoutes } = require('./util');
13
13
  const { getAssetPath } = require('../webpack/helpers');
14
14
 
15
15
  const pino = expressPinoLogger({
16
- prettyPrint: {
17
- levelFirst: true,
16
+ transport: {
17
+ target: 'pino-pretty',
18
+ options: {
19
+ colorize: true,
20
+ },
18
21
  },
19
22
  });
20
23
  pino.logger.level = 'warn';
@@ -209,4 +209,3 @@ exports.resolveExtensions = [
209
209
  ];
210
210
  exports.mainFields = ['browser', 'module', 'main'];
211
211
  exports.isGoogleTagManagerEnabled = isGoogleTagManagerEnabled;
212
- exports.ESBUILD_TARGET = 'es2020';
@@ -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
  const { ProvidePlugin } = require('webpack');
12
11
 
13
12
  const {
@@ -17,12 +16,10 @@ const {
17
16
  getAlias,
18
17
  getPaths,
19
18
  getMediaPath,
20
- ESBUILD_TARGET,
21
19
  } = require('./helpers');
22
- const { isTypeScriptEnabled } = require('../typescript/util');
20
+ const { ESBUILD_TARGET } = require('../esbuild');
23
21
 
24
22
  // get the application configuration
25
- const devMode = process.env.NODE_ENV !== 'production';
26
23
  const minicssLoader = {
27
24
  loader: MiniCssExtractPlugin.loader,
28
25
  options: {},
@@ -70,21 +67,29 @@ const plugins = [
70
67
  {
71
68
  from: 'node_modules/@elliemae/pui-user-monitoring/dist/public/js',
72
69
  to: 'js',
70
+ toType: 'dir',
71
+ info: { minimized: true },
73
72
  },
74
73
  {
75
- from: 'node_modules/@elliemae/pui-app-loader/dist/public/js/emuiAppLoader*.js',
76
- to: 'js/[name][ext]',
74
+ from: 'node_modules/@elliemae/pui-app-loader/dist/public/js',
75
+ to: 'js',
76
+ toType: 'dir',
77
77
  noErrorOnMissing: true,
78
+ info: { minimized: true },
78
79
  },
79
80
  {
80
- from: 'node_modules/@elliemae/encw-loader/dist/public/js/emuiEncwLoader*.js',
81
- to: 'js/[name][ext]',
81
+ from: 'node_modules/@elliemae/encw-loader/dist/public/js',
82
+ to: 'js',
83
+ toType: 'dir',
82
84
  noErrorOnMissing: true,
85
+ info: { minimized: true },
83
86
  },
84
87
  {
85
- from: 'node_modules/@elliemae/pui-diagnostics/dist/public/js/emuiDiagnostics*.js',
86
- to: 'js/[name][ext]',
88
+ from: 'node_modules/@elliemae/pui-diagnostics/dist/public/js',
89
+ to: 'js',
90
+ toType: 'dir',
87
91
  noErrorOnMissing: true,
92
+ info: { minimized: true },
88
93
  },
89
94
  {
90
95
  from: 'public',
@@ -102,17 +107,6 @@ const plugins = [
102
107
  new WebpackManifestPlugin(),
103
108
  ];
104
109
 
105
- if (isTypeScriptEnabled()) {
106
- plugins.push(
107
- new ForkTsCheckerWebpackPlugin({
108
- async: devMode,
109
- eslint: {
110
- files: './app/**/*.{ts,js,tsx,jsx}',
111
- },
112
- }),
113
- );
114
- }
115
-
116
110
  module.exports = (options) => ({
117
111
  mode: options.mode,
118
112
  entry: options.entry,
@@ -236,7 +230,7 @@ module.exports = (options) => ({
236
230
  ],
237
231
  },
238
232
  {
239
- test: /\.(jpe?g|png|gif)$/i,
233
+ test: /\.(jpe?g|png|gif|ico)$/i,
240
234
  exclude: excludeNodeModulesExcept(['@elliemae/*']),
241
235
  type: 'asset',
242
236
  },
@@ -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
 
15
14
  const {
16
15
  excludeNodeModulesExcept,
@@ -21,9 +20,8 @@ const {
21
20
  getAlias,
22
21
  getMediaPath,
23
22
  } = require('./helpers');
24
- const { isTypeScriptEnabled } = require('../typescript/util');
23
+ const { ESBUILD_TARGET } = require('../esbuild');
25
24
 
26
- const devMode = process.env.NODE_ENV !== 'production';
27
25
  const minicssLoader = {
28
26
  loader: MiniCssExtractPlugin.loader,
29
27
  options: {},
@@ -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')],
@@ -126,11 +113,10 @@ module.exports = (options) => ({
126
113
  fullySpecified: false,
127
114
  },
128
115
  use: {
129
- loader: 'babel-loader',
116
+ loader: 'esbuild-loader',
130
117
  options: {
131
- cacheDirectory: true,
132
- compact: !devMode,
133
- ...(options.babelQuery || {}),
118
+ loader: 'jsx',
119
+ target: ESBUILD_TARGET,
134
120
  },
135
121
  },
136
122
  },
@@ -201,7 +187,7 @@ module.exports = (options) => ({
201
187
  ],
202
188
  },
203
189
  {
204
- test: /\.(jpe?g|png|gif)$/i,
190
+ test: /\.(jpe?g|png|gif|ico)$/i,
205
191
  exclude: excludeNodeModulesExcept(['@elliemae/*']),
206
192
  type: 'asset',
207
193
  },
@@ -1,11 +1,11 @@
1
1
  const path = require('path');
2
- const TerserPlugin = require('terser-webpack-plugin');
3
2
  const CompressionPlugin = require('compression-webpack-plugin');
4
3
  const MiniCssExtractPlugin = require('mini-css-extract-plugin');
5
4
  const HtmlWebpackPlugin = require('html-webpack-plugin');
6
- const CssMinimizerPlugin = require('css-minimizer-webpack-plugin');
7
5
  const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
6
+ const { ESBuildMinifyPlugin } = require('esbuild-loader');
8
7
  const { getLibraryName } = require('./helpers');
8
+ const { ESBUILD_TARGET } = require('../esbuild');
9
9
 
10
10
  const libraryName = getLibraryName();
11
11
 
@@ -23,17 +23,10 @@ module.exports = require('./webpack.lib.base.babel')({
23
23
  moduleIds: 'deterministic',
24
24
  minimize: true,
25
25
  minimizer: [
26
- new TerserPlugin({
27
- terserOptions: {
28
- compress: {
29
- comparisons: false,
30
- },
31
- format: {
32
- comments: false,
33
- },
34
- },
26
+ new ESBuildMinifyPlugin({
27
+ target: ESBUILD_TARGET,
28
+ css: true,
35
29
  }),
36
- new CssMinimizerPlugin(),
37
30
  ],
38
31
  nodeEnv: 'production',
39
32
  sideEffects: true,
@@ -15,8 +15,8 @@ const {
15
15
  getPaths,
16
16
  getAppVersion,
17
17
  isGoogleTagManagerEnabled,
18
- ESBUILD_TARGET,
19
18
  } = require('./helpers');
19
+ const { ESBUILD_TARGET } = require('../esbuild');
20
20
 
21
21
  const getProdConfig = ({ latestVersion = true } = {}) => {
22
22
  const { buildPath, publicPath } = getPaths(latestVersion);
@@ -72,7 +72,13 @@ const getProdConfig = ({ latestVersion = true } = {}) => {
72
72
  filename: '[path][base].gz',
73
73
  algorithm: 'gzip',
74
74
  test: /\.js$|\.css$$/,
75
- exclude: [/\/adrum-ext/, /\/emuiUserMonitoring/],
75
+ exclude: [
76
+ /\/adrum-ext/,
77
+ /\/emuiUserMonitoring/,
78
+ /\/emuiDiagnostics/,
79
+ /\/emuiAppLoader/,
80
+ /\/encwLoader/,
81
+ ],
76
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
77
83
  minRatio: Number.MAX_SAFE_INTEGER,
78
84
  }),
@@ -3,17 +3,15 @@ const webpack = require('webpack');
3
3
  const MiniCssExtractPlugin = require('mini-css-extract-plugin');
4
4
  const CopyWebpackPlugin = require('copy-webpack-plugin');
5
5
  const CompressionPlugin = require('compression-webpack-plugin');
6
- const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
7
6
  const {
8
7
  getAppConfig,
9
8
  isApp,
10
9
  getAlias,
11
10
  excludeNodeModulesExcept,
12
11
  modulesToTranspile,
13
- resolveExtensions,
14
- mainFields,
15
12
  getMediaPath,
16
13
  } = require('./helpers');
14
+ const { ESBUILD_TARGET } = require('../esbuild');
17
15
 
18
16
  const IS_APP = isApp();
19
17
  const CWD = process.cwd();
@@ -101,9 +99,10 @@ const getModuleRules = () => [
101
99
  fullySpecified: false,
102
100
  },
103
101
  use: {
104
- loader: 'babel-loader',
102
+ loader: 'esbuild-loader',
105
103
  options: {
106
- cacheDirectory: true,
104
+ loader: 'jsx',
105
+ target: ESBUILD_TARGET,
107
106
  },
108
107
  },
109
108
  },
@@ -128,7 +127,7 @@ const getModuleRules = () => [
128
127
  ],
129
128
  },
130
129
  {
131
- test: /\.(jpe?g|png|gif)$/i,
130
+ test: /\.(jpe?g|png|gif|ico)$/i,
132
131
  exclude: excludeNodeModulesExcept(['@elliemae/*']),
133
132
  type: 'asset',
134
133
  },
@@ -155,9 +154,6 @@ exports.webpackFinal = async (config, { configType }) => {
155
154
 
156
155
  config.resolve.alias = { ...config.resolve.alias, ...getAlias() };
157
156
  config.resolve.fallback = { ...config.resolve.fallback, crypto: false };
158
- config.resolve.plugins = (config.resolve.plugins || []).concat([
159
- new TsconfigPathsPlugin({ extensions: resolveExtensions, mainFields }),
160
- ]);
161
157
 
162
158
  config.externals = config.externals || {};
163
159
  config.externals['@elliemae/pui-user-monitoring'] = 'emuiUserMonitoring';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/pui-cli",
3
- "version": "6.0.0-beta.3",
3
+ "version": "6.0.0-beta.7",
4
4
  "private": false,
5
5
  "description": "EllieMae Platform UI CLI",
6
6
  "sideEffects": false,
@@ -70,23 +70,21 @@
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.3.12",
74
- "@storybook/addon-actions": "~6.3.12",
75
- "@storybook/addon-backgrounds": "~6.3.12",
76
- "@storybook/addon-console": "~1.2.3",
77
- "@storybook/addon-controls": "~6.3.12",
78
- "@storybook/addon-docs": "~6.3.12",
73
+ "@storybook/addon-a11y": "~6.4.0",
74
+ "@storybook/addon-actions": "~6.4.0",
75
+ "@storybook/addon-backgrounds": "~6.4.0",
76
+ "@storybook/addon-controls": "~6.4.0",
77
+ "@storybook/addon-docs": "~6.4.0",
79
78
  "@storybook/addon-events": "~6.2.9",
80
- "@storybook/addon-knobs": "~6.3.1",
81
- "@storybook/addon-links": "~6.3.12",
82
- "@storybook/addon-storysource": "~6.3.12",
83
- "@storybook/addon-toolbars": "~6.3.12",
84
- "@storybook/addon-viewport": "~6.3.12",
85
- "@storybook/addons": "~6.3.12",
86
- "@storybook/builder-webpack5": "~6.3.12",
87
- "@storybook/manager-webpack5": "~6.3.12",
88
- "@storybook/react": "~6.3.12",
89
- "@storybook/theming": "~6.3.12",
79
+ "@storybook/addon-links": "~6.4.0",
80
+ "@storybook/addon-storysource": "~6.4.0",
81
+ "@storybook/addon-toolbars": "~6.4.0",
82
+ "@storybook/addon-viewport": "~6.4.0",
83
+ "@storybook/addons": "~6.4.0",
84
+ "@storybook/builder-webpack5": "~6.4.0",
85
+ "@storybook/manager-webpack5": "~6.4.0",
86
+ "@storybook/react": "~6.4.0",
87
+ "@storybook/theming": "~6.4.0",
90
88
  "@stylelint/postcss-css-in-js": "~0.37.2",
91
89
  "@svgr/webpack": "~5.5.0",
92
90
  "@testing-library/jest-dom": "~5.15.1",
@@ -98,6 +96,7 @@
98
96
  "@types/testing-library__jest-dom": "~5.14.1",
99
97
  "@typescript-eslint/eslint-plugin": "~5.4.0",
100
98
  "@typescript-eslint/parser": "~5.4.0",
99
+ "@vitejs/plugin-react": "~1.1.0",
101
100
  "autoprefixer": "~10.4.0",
102
101
  "axe-core": "~4.3.5",
103
102
  "babel-loader": "~8.2.3",
@@ -132,6 +131,8 @@
132
131
  "dotenv": "~10.0.0",
133
132
  "dotenv-webpack": "~7.0.3",
134
133
  "duplicate-package-checker-webpack-plugin": "~3.0.0",
134
+ "esbuild": "~0.14.0",
135
+ "esbuild-jest": "~0.5.0",
135
136
  "esbuild-loader": "~2.16.0",
136
137
  "eslint": "~8.3.0",
137
138
  "eslint-config-airbnb": "~18.2.1",
@@ -189,14 +190,14 @@
189
190
  "pino-pretty": "~7.2.0",
190
191
  "pinst": "~2.1.6",
191
192
  "plop": "~2.7.6",
192
- "postcss": "~8.4.1",
193
+ "postcss": "~8.4.3",
193
194
  "postcss-jsx": "~0.36.4",
194
195
  "postcss-html": "~1.3.0",
195
196
  "postcss-markdown": "~1.2.0",
196
197
  "postcss-syntax": "~0.36.2",
197
- "postcss-loader": "~6.2.0",
198
+ "postcss-loader": "~6.2.1",
198
199
  "postcss-preset-env": "~7.0.1",
199
- "prettier": "~2.4.1",
200
+ "prettier": "~2.5.0",
200
201
  "pug": "~3.0.2",
201
202
  "pug-loader": "~2.4.0",
202
203
  "raf": "~3.4.1",
@@ -211,6 +212,7 @@
211
212
  "semantic-release": "~18.0.1",
212
213
  "shelljs": "~0.8.4",
213
214
  "slackify-markdown": "~4.3.0",
215
+ "storybook-builder-vite": "~0.1.10",
214
216
  "storybook-react-router": "~1.0.8",
215
217
  "storybook-addon-turbo-build": "~1.0.1",
216
218
  "style-loader": "~3.3.1",
@@ -232,7 +234,8 @@
232
234
  "update-notifier": "~5.1.0",
233
235
  "url-loader": "~4.1.1",
234
236
  "uuid": "~8.3.2",
235
- "webpack": "~5.64.3",
237
+ "vite": "~2.6.14",
238
+ "webpack": "~5.64.4",
236
239
  "webpack-bundle-analyzer": "~4.5.0",
237
240
  "webpack-cli": "~4.9.1",
238
241
  "webpack-dev-middleware": "~5.2.2",