@elliemae/pui-cli 9.0.0-next.2 → 9.0.0-next.21

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.
Files changed (111) hide show
  1. package/dist/cjs/commands/lint.js +26 -7
  2. package/dist/cjs/commands/start.js +1 -1
  3. package/dist/cjs/commands/storybook.js +2 -2
  4. package/dist/cjs/commands/test.js +2 -2
  5. package/dist/cjs/commands/utils.js +3 -1
  6. package/dist/cjs/index.js +3 -1
  7. package/dist/cjs/lint-config/eslint/common.cjs +3 -2
  8. package/dist/cjs/lint-config/eslint/typescript/common.cjs +3 -3
  9. package/dist/cjs/lint-config/stylelint.config.cjs +14 -13
  10. package/dist/cjs/monorepo/delete-merged-tags.js +1 -1
  11. package/dist/cjs/monorepo/set-registry-version.js +1 -1
  12. package/dist/cjs/monorepo/set-workspace-version.js +1 -1
  13. package/dist/cjs/pui-config.js +2 -2
  14. package/dist/cjs/server/csp.js +1 -1
  15. package/dist/cjs/server/utils.js +2 -2
  16. package/dist/cjs/testing/ExtendedJSDomEnv.cjs +38 -0
  17. package/dist/cjs/testing/extended/axe-core/getMessageAndPass.js +37 -0
  18. package/dist/cjs/testing/extended/axe-core/index.js +24 -0
  19. package/dist/cjs/testing/extended/axe-core/reporter.js +51 -0
  20. package/dist/cjs/testing/extended/axe-core/shouldIgnoreNodeViolation.js +31 -0
  21. package/dist/cjs/testing/extended/axe-core/toHaveNoViolations.js +43 -0
  22. package/dist/cjs/testing/jest.config.cjs +3 -1
  23. package/dist/cjs/testing/setup-test-env.js +1 -1
  24. package/dist/cjs/testing/setup-tests.js +25 -4
  25. package/dist/cjs/transpile/esbuild.js +4 -2
  26. package/dist/cjs/update-notifier.js +1 -1
  27. package/dist/cjs/utils.js +1 -1
  28. package/dist/cjs/webpack/helpers.js +18 -6
  29. package/dist/cjs/webpack/webpack.base.babel.js +27 -5
  30. package/dist/cjs/webpack/webpack.dev.babel.js +4 -3
  31. package/dist/cjs/webpack/webpack.lib.base.babel.js +13 -5
  32. package/dist/cjs/webpack/webpack.lib.dev.babel.js +5 -11
  33. package/dist/cjs/webpack/webpack.lib.prod.babel.js +4 -5
  34. package/dist/cjs/webpack/webpack.prod.babel.js +3 -2
  35. package/dist/cjs/webpack/webpack.storybook.js +10 -11
  36. package/dist/esm/commands/lint.js +27 -7
  37. package/dist/esm/commands/start.js +1 -1
  38. package/dist/esm/commands/storybook.js +2 -2
  39. package/dist/esm/commands/test.js +2 -2
  40. package/dist/esm/commands/utils.js +3 -1
  41. package/dist/esm/index.js +3 -1
  42. package/dist/esm/lint-config/eslint/common.cjs +3 -2
  43. package/dist/esm/lint-config/eslint/typescript/common.cjs +3 -3
  44. package/dist/esm/lint-config/stylelint.config.cjs +14 -13
  45. package/dist/esm/monorepo/delete-merged-tags.js +1 -1
  46. package/dist/esm/monorepo/set-registry-version.js +1 -1
  47. package/dist/esm/monorepo/set-workspace-version.js +1 -1
  48. package/dist/esm/server/csp.js +1 -1
  49. package/dist/esm/server/utils.js +2 -2
  50. package/dist/esm/testing/ExtendedJSDomEnv.cjs +38 -0
  51. package/dist/esm/testing/extended/axe-core/getMessageAndPass.js +17 -0
  52. package/dist/esm/testing/extended/axe-core/index.js +4 -0
  53. package/dist/esm/testing/extended/axe-core/reporter.js +31 -0
  54. package/dist/esm/testing/extended/axe-core/shouldIgnoreNodeViolation.js +11 -0
  55. package/dist/esm/testing/extended/axe-core/toHaveNoViolations.js +23 -0
  56. package/dist/esm/testing/jest.config.cjs +3 -1
  57. package/dist/esm/testing/setup-test-env.js +1 -1
  58. package/dist/esm/testing/setup-tests.js +25 -4
  59. package/dist/esm/transpile/esbuild.js +4 -2
  60. package/dist/esm/update-notifier.js +1 -1
  61. package/dist/esm/utils.js +1 -1
  62. package/dist/esm/webpack/helpers.js +18 -6
  63. package/dist/esm/webpack/webpack.base.babel.js +27 -5
  64. package/dist/esm/webpack/webpack.dev.babel.js +4 -3
  65. package/dist/esm/webpack/webpack.lib.base.babel.js +13 -5
  66. package/dist/esm/webpack/webpack.lib.dev.babel.js +6 -12
  67. package/dist/esm/webpack/webpack.lib.prod.babel.js +9 -6
  68. package/dist/esm/webpack/webpack.prod.babel.js +3 -2
  69. package/dist/esm/webpack/webpack.storybook.js +11 -12
  70. package/dist/types/babel.config.d.cts +7 -7
  71. package/dist/types/commands/build.d.ts +2 -2
  72. package/dist/types/commands/codemod.d.ts +2 -2
  73. package/dist/types/commands/lint.d.ts +3 -2
  74. package/dist/types/commands/pack.d.ts +2 -2
  75. package/dist/types/commands/start.d.ts +2 -2
  76. package/dist/types/commands/storybook.d.ts +2 -2
  77. package/dist/types/commands/test.d.ts +2 -2
  78. package/dist/types/commands/tscheck.d.ts +2 -2
  79. package/dist/types/commands/utils.d.ts +2 -1
  80. package/dist/types/commands/version.d.ts +2 -2
  81. package/dist/types/commands/vitest.d.ts +2 -2
  82. package/dist/types/index.d.ts +1 -0
  83. package/dist/types/lint-config/commitlint.config.d.cts +1 -1
  84. package/dist/types/lint-config/eslint/common.d.cts +18 -12
  85. package/dist/types/lint-config/eslint/non-react.d.cts +8 -1
  86. package/dist/types/lint-config/eslint/react.d.cts +8 -1
  87. package/dist/types/lint-config/eslint/typescript/common.d.cts +6 -6
  88. package/dist/types/lint-config/eslint/typescript/non-react.d.cts +9 -2
  89. package/dist/types/lint-config/eslint/typescript/react.d.cts +9 -2
  90. package/dist/types/lint-config/lint-staged.config.d.ts +3 -3
  91. package/dist/types/lint-config/prettier.config.d.cts +6 -6
  92. package/dist/types/lint-config/stylelint.config.d.cts +6 -6
  93. package/dist/types/release.config.d.cts +2 -2
  94. package/dist/types/server/csp.d.ts +2 -2
  95. package/dist/types/testing/ExtendedJSDomEnv.d.cts +5 -0
  96. package/dist/types/testing/extended/axe-core/getMessageAndPass.d.ts +8 -0
  97. package/dist/types/testing/extended/axe-core/index.d.ts +1 -0
  98. package/dist/types/testing/extended/axe-core/reporter.d.ts +2 -0
  99. package/dist/types/testing/extended/axe-core/shouldIgnoreNodeViolation.d.ts +2 -0
  100. package/dist/types/testing/extended/axe-core/toHaveNoViolations.d.ts +12 -0
  101. package/dist/types/testing/jest.config.d.cts +24 -22
  102. package/dist/types/testing/jest.node.config.d.cts +2 -0
  103. package/dist/types/testing/mocks/axios.d.ts +7 -7
  104. package/dist/types/testing/mocks/pui-diagnostics.d.ts +13 -13
  105. package/dist/types/testing/vitest.config.d.ts +1 -1
  106. package/dist/types/tests/basic.test.d.ts +0 -0
  107. package/dist/types/transpile/esbuild.d.ts +3 -3
  108. package/dist/types/typedoc.d.cts +3 -3
  109. package/dist/types/webpack/helpers.d.ts +4 -1
  110. package/dist/types/webpack/webpack.storybook.d.ts +0 -1
  111. package/package.json +151 -140
package/dist/cjs/utils.js CHANGED
@@ -35,7 +35,7 @@ __export(utils_exports, {
35
35
  module.exports = __toCommonJS(utils_exports);
36
36
  var import_node_fs = __toESM(require("node:fs"), 1);
37
37
  var import_node_path = __toESM(require("node:path"), 1);
38
- const basePath = (process.env.BASE_PATH || "/").replace(/\/?$/, "/");
38
+ const basePath = (process.env.BASE_PATH ?? "/").replace(/\/?$/, "/");
39
39
  const isApp = () => import_node_fs.default.existsSync(import_node_path.default.join(process.cwd(), "app"));
40
40
  const getAppConfig = () => {
41
41
  const appConfigPath = import_node_path.default.join(
@@ -34,6 +34,7 @@ __export(helpers_exports, {
34
34
  getAlias: () => getAlias,
35
35
  getAppVersion: () => getAppVersion,
36
36
  getCompressionPlugins: () => getCompressionPlugins,
37
+ getLibraryAlias: () => getLibraryAlias,
37
38
  getLibraryName: () => getLibraryName,
38
39
  getLibraryVariableName: () => getLibraryVariableName,
39
40
  getMediaPath: () => getMediaPath,
@@ -48,9 +49,9 @@ __export(helpers_exports, {
48
49
  module.exports = __toCommonJS(helpers_exports);
49
50
  var import_node_path = __toESM(require("node:path"), 1);
50
51
  var import_node_fs = __toESM(require("node:fs"), 1);
52
+ var import_zlib = __toESM(require("zlib"), 1);
51
53
  var import_lodash = __toESM(require("lodash"), 1);
52
54
  var import_compression_webpack_plugin = __toESM(require("compression-webpack-plugin"), 1);
53
- var import_zlib = __toESM(require("zlib"), 1);
54
55
  var import_utils = require("../monorepo/utils.js");
55
56
  var import_utils2 = require("../utils.js");
56
57
  let pathSep = import_node_path.default.sep;
@@ -64,8 +65,8 @@ const excludeNodeModulesExcept = (modules) => {
64
65
  const moduleRegExps = getNodeModulesRegEx(modules);
65
66
  return function(modulePath) {
66
67
  if (/node_modules/.test(modulePath)) {
67
- for (let i = 0; i < moduleRegExps.length; i += 1)
68
- if (moduleRegExps[i].test(modulePath))
68
+ for (const moduleRegExp of moduleRegExps)
69
+ if (moduleRegExp.test(modulePath))
69
70
  return false;
70
71
  return true;
71
72
  }
@@ -80,7 +81,7 @@ const getLibraryName = () => {
80
81
  const modifiedLibName = `emui-${libraryName.replace("@elliemae/", "").replace("pui-", "")}`;
81
82
  return import_lodash.default.camelCase(modifiedLibName);
82
83
  };
83
- const getLibraryVariableName = () => (process.env.LIBRARY_VARIABLE_NAME || getLibraryName()).split(".");
84
+ const getLibraryVariableName = () => (process.env.LIBRARY_VARIABLE_NAME ?? getLibraryName()).split(".");
84
85
  const mapToFolder = (dependencies, folder) => dependencies.reduce(
85
86
  (acc, dependency) => ({
86
87
  [dependency]: import_node_path.default.resolve(`${folder}/${dependency.replace("$", "")}`),
@@ -89,7 +90,7 @@ const mapToFolder = (dependencies, folder) => dependencies.reduce(
89
90
  {}
90
91
  );
91
92
  const getAlias = () => {
92
- const monorepoRoot = (0, import_utils.findMonoRepoRoot)(process.cwd()) || "";
93
+ const monorepoRoot = (0, import_utils.findMonoRepoRoot)(process.cwd()) ?? "";
93
94
  return mapToFolder(
94
95
  [
95
96
  "@babel/runtime",
@@ -103,6 +104,8 @@ const getAlias = () => {
103
104
  "styled-components",
104
105
  "immer",
105
106
  "react-dates",
107
+ "react-select",
108
+ "react-spring",
106
109
  "react-transition-group",
107
110
  "@elliemae/pui-cli",
108
111
  "@elliemae/pui-app-sdk$",
@@ -111,6 +114,15 @@ const getAlias = () => {
111
114
  import_node_path.default.join(monorepoRoot, "./node_modules")
112
115
  );
113
116
  };
117
+ const getLibraryAlias = (name, alias) => {
118
+ const monorepoRoot = (0, import_utils.findMonoRepoRoot)(process.cwd()) ?? "";
119
+ const aliasPath = import_node_path.default.resolve(
120
+ `${import_node_path.default.join(monorepoRoot, "./node_modules")}/${alias}`
121
+ );
122
+ return {
123
+ [name]: aliasPath
124
+ };
125
+ };
114
126
  const modulesToTranspile = [
115
127
  "@elliemae/pui-*",
116
128
  "@elliemae/ds-*",
@@ -173,7 +185,7 @@ const getAppVersion = () => {
173
185
  if (!process.env.APP_VERSION)
174
186
  return LATEST_VERSION;
175
187
  const match = process.env.APP_VERSION.match(/^v?(\d+\.\d+)\..*$/);
176
- return match && match[1] || LATEST_VERSION;
188
+ return match?.[1] ?? LATEST_VERSION;
177
189
  };
178
190
  const getPaths = (latestVersion = true) => {
179
191
  const version = latestVersion ? LATEST_VERSION : getAppVersion();
@@ -284,15 +284,37 @@ const baseConfig = (options) => ({
284
284
  mainFields: ["browser", "module", "main"],
285
285
  alias: {
286
286
  ...(0, import_helpers.getAlias)(),
287
- ...(options.resolve || {}).alias || {}
287
+ ...options.resolve?.alias ?? {}
288
288
  }
289
289
  },
290
+ externalsPresets: {
291
+ web: true
292
+ },
290
293
  externals: {
291
294
  "@elliemae/pui-user-monitoring": "emuiUserMonitoring",
292
295
  "@elliemae/pui-app-loader": "emuiAppLoader",
293
- "@elliemae/pui-diagnostics": "emuiDiagnostics"
296
+ "@elliemae/pui-diagnostics": "emuiDiagnostics",
297
+ react: "emuiAppReactDependencies.react",
298
+ "react-dom": "emuiAppReactDependencies.reactDOM",
299
+ "@reduxjs/toolkit": "emuiAppReactDependencies.rtk",
300
+ axios: "emuiAppReactDependencies.axios.default",
301
+ dompurify: "emuiAppReactDependencies.dompurify",
302
+ history: "emuiAppReactDependencies.history",
303
+ immer: "emuiAppReactDependencies.immer",
304
+ invariant: "emuiAppReactDependencies.invariant",
305
+ "pubsub-js": "emuiAppReactDependencies.pubsubjs",
306
+ "react-aria-live": "emuiAppReactDependencies.reactAriaLive",
307
+ "react-helmet": "emuiAppReactDependencies.reactHelmet",
308
+ "react-hook-form": "emuiAppReactDependencies.reactHookForm",
309
+ "react-redux": "emuiAppReactDependencies.reactRedux",
310
+ "react-router-dom": "emuiAppReactDependencies.reactRouterDOM",
311
+ reduxInjectors: "emuiAppReactDependencies.reduxInjectors",
312
+ reselect: "emuiAppReactDependencies.reselect",
313
+ // "styled-components": "emuiAppReactDependencies.styledComponents",
314
+ "styled-system": "emuiAppReactDependencies.styledSystem"
315
+ // "@xstyled/styled-components": "emuiAppReactDependencies.xstyled",
294
316
  },
295
- devtool: options.devtool || "eval-source-map",
296
- performance: options.performance || {},
297
- devServer: options.devServer || {}
317
+ devtool: options.devtool ?? "eval-source-map",
318
+ performance: options.performance ?? {},
319
+ devServer: options.devServer ?? {}
298
320
  });
@@ -98,7 +98,7 @@ const devConfig = {
98
98
  // Add development plugins
99
99
  plugins: [
100
100
  new import_html_webpack_plugin.default({
101
- inject: !(0, import_helpers.isAppLoaderEnabled)(),
101
+ inject: !(0, import_helpers.isAppLoaderEnabled)() ? "head" : false,
102
102
  // Inject all files that are generated by webpack, e.g. bundle.js
103
103
  template: !(0, import_helpers.isAppLoaderEnabled)() ? "app/index.html" : "app/index-app-loader.html",
104
104
  emui: {
@@ -110,7 +110,8 @@ const devConfig = {
110
110
  diagnosticsScriptPath,
111
111
  encwLoaderScriptPath,
112
112
  googleTagManager: (0, import_helpers.isGoogleTagManagerEnabled)()
113
- }
113
+ },
114
+ scriptLoading: "defer"
114
115
  }),
115
116
  new import_circular_dependency_plugin.default({
116
117
  exclude: /a\.(js|ts|jsx|tsx)|node_modules/,
@@ -143,7 +144,7 @@ const devConfig = {
143
144
  },
144
145
  hot: true,
145
146
  open: [basePath],
146
- port: process.env.PORT || "auto",
147
+ port: process.env.PORT ?? "auto",
147
148
  setupMiddlewares: (middlewares, devServer) => {
148
149
  if (devServer.app) {
149
150
  (0, import_middlewares.setupDefaultMiddlewares)(devServer.app);
@@ -84,14 +84,22 @@ const baseConfig = (options) => ({
84
84
  output: {
85
85
  clean: true,
86
86
  path: import_node_path.default.resolve(process.cwd(), "dist/umd"),
87
+ filename: "[name].js",
88
+ chunkFilename: "[name].[chunkhash].chunk.js",
89
+ assetModuleFilename: "assets/[name].[hash][ext][query]",
87
90
  publicPath: "auto",
88
91
  library: {
89
92
  name: (0, import_helpers.getLibraryVariableName)(),
90
- type: "umd"
93
+ type: "var"
94
+ // type: 'module',
91
95
  },
96
+ // module: true,
92
97
  ...options.output
93
98
  },
94
99
  // Merge with env dependent settings
100
+ // experiments: {
101
+ // outputModule: true,
102
+ // },
95
103
  optimization: options.optimization,
96
104
  module: {
97
105
  rules: [
@@ -204,7 +212,7 @@ const baseConfig = (options) => ({
204
212
  mainFields: ["browser", "module", "main"],
205
213
  alias: {
206
214
  ...(0, import_helpers.getAlias)(),
207
- ...(options.resolve || {}).alias || {}
215
+ ...options.resolve?.alias ?? {}
208
216
  },
209
217
  plugins: [new import_resolve_typescript_plugin.default({})]
210
218
  },
@@ -213,7 +221,7 @@ const baseConfig = (options) => ({
213
221
  "@elliemae/pui-app-loader": "emuiAppLoader",
214
222
  "@elliemae/pui-diagnostics": "emuiDiagnostics"
215
223
  },
216
- devtool: options.devtool || "eval-source-map",
217
- performance: options.performance || {},
218
- devServer: options.devServer || {}
224
+ devtool: options.devtool ?? "eval-source-map",
225
+ performance: options.performance ?? {},
226
+ devServer: options.devServer ?? {}
219
227
  });
@@ -47,17 +47,14 @@ const getHtmlWebpackPlugins = () => {
47
47
  (htmlTemplateFile) => new import_html_webpack_plugin.default({
48
48
  template: htmlTemplateFile,
49
49
  filename: import_node_path.default.basename(htmlTemplateFile),
50
- inject: true
50
+ inject: "head",
51
+ scriptLoading: "defer",
52
+ library: (0, import_helpers.getLibraryVariableName)()
51
53
  })
52
54
  );
53
55
  };
54
56
  var webpack_lib_dev_babel_default = (0, import_webpack_lib_base_babel.baseConfig)({
55
57
  mode: "development",
56
- // output: {
57
- // filename: `js/${libraryName}.js`,
58
- // chunkFilename: `js/${libraryName}.chunk.js`,
59
- // assetModuleFilename: '[name][ext][query]',
60
- // },
61
58
  optimization: {
62
59
  splitChunks: {
63
60
  chunks: "all"
@@ -74,10 +71,7 @@ var webpack_lib_dev_babel_default = (0, import_webpack_lib_base_babel.baseConfig
74
71
  failOnError: false
75
72
  // show a warning when there is a circular dependency
76
73
  }),
77
- new import_mini_css_extract_plugin.default({
78
- // filename: `css/${libraryName}.css`,
79
- // chunkFilename: `css/${libraryName}.chunk.css`,
80
- }),
74
+ new import_mini_css_extract_plugin.default({}),
81
75
  new import_webpack.default.ProgressPlugin()
82
76
  ],
83
77
  devtool: "eval-source-map",
@@ -95,7 +89,7 @@ var webpack_lib_dev_babel_default = (0, import_webpack_lib_base_babel.baseConfig
95
89
  historyApiFallback: true,
96
90
  hot: true,
97
91
  open: [basePath],
98
- port: process.env.PORT || "auto",
92
+ port: process.env.PORT ?? "auto",
99
93
  headers: {
100
94
  "Access-Control-Allow-Origin": "*",
101
95
  "Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS"
@@ -46,7 +46,9 @@ const getHtmlWebpackPlugins = () => {
46
46
  (htmlTemplateFile) => new import_html_webpack_plugin.default({
47
47
  template: htmlTemplateFile,
48
48
  filename: import_node_path.default.basename(htmlTemplateFile),
49
- inject: true,
49
+ inject: "head",
50
+ scriptLoading: "defer",
51
+ library: (0, import_helpers.getLibraryVariableName)(),
50
52
  minify: {
51
53
  removeComments: true,
52
54
  collapseWhitespace: true,
@@ -82,10 +84,7 @@ const prodConfig = {
82
84
  },
83
85
  plugins: [
84
86
  ...getHtmlWebpackPlugins(),
85
- new import_mini_css_extract_plugin.default({
86
- // filename: `css/${libraryName}.[contenthash].css`,
87
- // chunkFilename: `css/${libraryName}.[contenthash].chunk.css`,
88
- }),
87
+ new import_mini_css_extract_plugin.default({}),
89
88
  ...(0, import_helpers.getCompressionPlugins)(true),
90
89
  new import_webpack_bundle_analyzer.BundleAnalyzerPlugin({
91
90
  analyzerMode: "static",
@@ -111,7 +111,7 @@ const {
111
111
  basePath
112
112
  } = (0, import_helpers.getPaths)();
113
113
  const htmlWebpackPlugin = new import_html_webpack_plugin.default({
114
- inject: !(0, import_helpers.isAppLoaderEnabled)(),
114
+ inject: !(0, import_helpers.isAppLoaderEnabled)() ? "head" : false,
115
115
  template: !(0, import_helpers.isAppLoaderEnabled)() ? "app/index.html" : "app/index-app-loader.html",
116
116
  minify: {
117
117
  removeComments: true,
@@ -134,7 +134,8 @@ const htmlWebpackPlugin = new import_html_webpack_plugin.default({
134
134
  diagnosticsScriptPath,
135
135
  encwLoaderScriptPath,
136
136
  googleTagManager: (0, import_helpers.isGoogleTagManagerEnabled)()
137
- }
137
+ },
138
+ scriptLoading: "defer"
138
139
  });
139
140
  const config = (0, import_webpack_base_babel.baseConfig)(getProdConfig());
140
141
  if (config.plugins)
@@ -28,7 +28,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
  var webpack_storybook_exports = {};
30
30
  __export(webpack_storybook_exports, {
31
- managerWebpack: () => managerWebpack,
32
31
  webpackFinal: () => webpackFinal
33
32
  });
34
33
  module.exports = __toCommonJS(webpack_storybook_exports);
@@ -97,15 +96,22 @@ const webpackFinal = (config, { configType }) => {
97
96
  config.plugins = config?.plugins?.concat((0, import_helpers.getCompressionPlugins)());
98
97
  }
99
98
  if (config.resolve) {
100
- config.resolve.alias = { ...config?.resolve?.alias, ...(0, import_helpers.getAlias)() };
99
+ config.resolve.alias = {
100
+ ...config?.resolve?.alias,
101
+ ...(0, import_helpers.getAlias)(),
102
+ ...(0, import_helpers.getLibraryAlias)(
103
+ "@reduxjs/toolkit/query/react",
104
+ "@reduxjs/toolkit/dist/query/react/rtk-query-react.esm.js"
105
+ )
106
+ };
101
107
  config.resolve.fallback = { ...config.resolve.fallback, crypto: false };
102
108
  config.resolve.extensions?.push(".svg");
103
109
  config.resolve.plugins = [
104
- ...config.resolve.plugins || [],
110
+ ...config.resolve.plugins ?? [],
105
111
  new import_resolve_typescript_plugin.default({})
106
112
  ];
107
113
  }
108
- config.externals = config.externals || {};
114
+ config.externals = config.externals ?? {};
109
115
  if (config.externals) {
110
116
  config.externals["@elliemae/pui-user-monitoring"] = "emuiUserMonitoring";
111
117
  config.externals["@elliemae/pui-app-loader"] = "emuiAppLoader";
@@ -113,10 +119,3 @@ const webpackFinal = (config, { configType }) => {
113
119
  }
114
120
  return config;
115
121
  };
116
- const managerWebpack = (config) => {
117
- if (config.plugins)
118
- config.plugins = config.plugins.concat((0, import_helpers.getCompressionPlugins)());
119
- if (config.resolve)
120
- config.resolve.alias = { ...config.resolve.alias, ...(0, import_helpers.getAlias)() };
121
- return config;
122
- };
@@ -1,14 +1,24 @@
1
1
  import path from "node:path";
2
+ import { inspect } from "node:util";
2
3
  import yargs from "yargs";
3
4
  import {
4
5
  exec,
6
+ logInfo,
5
7
  logError,
6
8
  logSuccess,
7
9
  getCIEnv,
8
10
  isTypeScriptEnabled
9
11
  } from "./utils.js";
10
- const lintCSS = async (fix = false) => {
11
- const fixIssues = fix ? "--fix" : "";
12
+ const lintCSS = async (args) => {
13
+ const fixIssues = args.fix ? "--fix" : "";
14
+ if (args.debug) {
15
+ const configPath = path.join(process.cwd(), "stylelint.config.cjs");
16
+ const config = await import(configPath);
17
+ logInfo("stylelint version:");
18
+ await exec(`stylelint ./{lib,app}/**/*.{js,jsx,ts,tsx} --version`);
19
+ logInfo("stylelint config:");
20
+ logInfo(inspect(config, { depth: null }));
21
+ }
12
22
  await exec(
13
23
  `stylelint ./{lib,app}/**/*.{js,jsx,ts,tsx} ${fixIssues} ${!getCIEnv() ? "--color" : "--no-color"} --allow-empty-input --config ${path.join(
14
24
  process.cwd(),
@@ -16,10 +26,11 @@ const lintCSS = async (fix = false) => {
16
26
  )}`
17
27
  );
18
28
  };
19
- const lintJS = async (fix = false) => {
20
- const fixIssues = fix ? "--fix" : "";
29
+ const lintJS = async (args) => {
30
+ const fixIssues = args.fix ? "--fix" : "";
31
+ const debugFlags = args.debug ? "--env-info --debug" : "";
21
32
  await exec(
22
- `eslint ${!getCIEnv() ? "--color" : "--no-color"} ${fixIssues} .`
33
+ `eslint ${!getCIEnv() ? "--color" : "--no-color"} ${fixIssues} ${debugFlags} .`
23
34
  );
24
35
  };
25
36
  const cmdArgs = {
@@ -37,6 +48,11 @@ const cmdArgs = {
37
48
  boolean: true,
38
49
  alias: "fix",
39
50
  default: false
51
+ },
52
+ debug: {
53
+ boolean: true,
54
+ alias: "debug",
55
+ default: false
40
56
  }
41
57
  };
42
58
  const lintCmd = {
@@ -46,10 +62,12 @@ const lintCmd = {
46
62
  await exec("tsc --noEmit --emitDeclarationOnly false");
47
63
  try {
48
64
  await exec("rimraf ./reports/eslint.json");
49
- await lintJS(argv.fix);
65
+ await lintJS({ ...argv });
50
66
  logSuccess("JS linting completed");
51
67
  } catch (err) {
52
68
  logError("JS linting failed");
69
+ if (argv.debug)
70
+ logError(err);
53
71
  yargs().exit(-1, err);
54
72
  return;
55
73
  }
@@ -57,10 +75,12 @@ const lintCmd = {
57
75
  if (argv.css) {
58
76
  try {
59
77
  await exec("rimraf ./reports/stylelint.json");
60
- await lintCSS(argv.fix);
78
+ await lintCSS({ ...argv });
61
79
  logSuccess("CSS linting completed");
62
80
  } catch (err) {
63
81
  logError("CSS linting failed");
82
+ if (argv.debug)
83
+ logError(err);
64
84
  yargs().exit(-1, err);
65
85
  }
66
86
  }
@@ -5,7 +5,7 @@ import { exec, logError, logSuccess, isApp } from "./utils.js";
5
5
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
6
6
  const startProdServer = async () => {
7
7
  await exec(
8
- `cross-env NODE_ENV=production ts-node --esm ${path.resolve(
8
+ `cross-env NODE_ENV=production tsx ${path.resolve(
9
9
  __dirname,
10
10
  "../server/index.js"
11
11
  )} --color always`
@@ -3,12 +3,12 @@ import { exec, logInfo, logError, logSuccess } from "./utils.js";
3
3
  const buildStoryBook = async (outputDir = "demo", isDoc = false) => {
4
4
  const additionalParams = isDoc ? `--docs -o ${outputDir}/docs` : `-o ${outputDir}`;
5
5
  await exec(
6
- `cross-env NODE_ENV=production build-storybook --quiet ${additionalParams}`
6
+ `cross-env NODE_ENV=production storybook build --quiet ${additionalParams}`
7
7
  );
8
8
  };
9
9
  const startStoryBook = async (isDoc = false) => {
10
10
  await exec(
11
- `cross-env NODE_ENV=development STORYBOOK_BUILD=true start-storybook ${isDoc ? "--docs" : ""} -p 11000 --quiet`
11
+ `cross-env STORYBOOK_BUILD=true storybook dev ${isDoc ? "--docs" : ""} -p 11000 --quiet`
12
12
  );
13
13
  };
14
14
  const cmdArgs = {
@@ -45,9 +45,9 @@ const testCmd = {
45
45
  handler: async (argv) => {
46
46
  let commandOptions = "--coverage --maxWorkers=50%";
47
47
  if (argv.fix)
48
- commandOptions = "-u";
48
+ commandOptions += " -u";
49
49
  else if (argv.watch)
50
- commandOptions = "--watchAll";
50
+ commandOptions += " --watchAll";
51
51
  if (getCIEnv())
52
52
  commandOptions += " --ci --no-colors";
53
53
  if (argv.passWithNoTests)
@@ -31,6 +31,7 @@ const browsersMapping = {
31
31
  };
32
32
  const exec = async (command, options = { stdio: "inherit" }) => execaCommand(command, options);
33
33
  const logInfo = console.log;
34
+ const logWarning = (...args) => console.log(chalk.yellow(...args));
34
35
  const logSuccess = (...args) => console.log(chalk.green(...args));
35
36
  const logError = console.error;
36
37
  const readPackageLock = async () => {
@@ -52,7 +53,7 @@ const getSupportedBrowsers = async () => {
52
53
  return browserVersions.reduce((acc, nameVersion) => {
53
54
  const [name, version] = nameVersion.split(" ");
54
55
  const versionRange = version.split("-");
55
- acc[browsersMapping[name]] = versionRange && versionRange[0] || version;
56
+ acc[browsersMapping[name]] = versionRange?.[0] ?? version;
56
57
  return acc;
57
58
  }, {});
58
59
  };
@@ -186,5 +187,6 @@ export {
186
187
  logError,
187
188
  logInfo,
188
189
  logSuccess,
190
+ logWarning,
189
191
  writeAppInfo
190
192
  };
package/dist/esm/index.js CHANGED
@@ -9,6 +9,7 @@ import { vitestConfig } from "./testing/vitest.config.js";
9
9
  import { jestNodeConfig } from "./testing/jest.node.config.cjs";
10
10
  import { lintStagedConfig } from "./lint-config/lint-staged.config.js";
11
11
  import { loadRoutes } from "./server/appRoutes.js";
12
+ import { webpackFinal } from "./webpack/webpack.storybook.js";
12
13
  export {
13
14
  babelConfig,
14
15
  commitlintConfig,
@@ -20,5 +21,6 @@ export {
20
21
  loadRoutes,
21
22
  prettierConfig,
22
23
  stylelintConfig,
23
- vitestConfig
24
+ vitestConfig,
25
+ webpackFinal
24
26
  };
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable max-lines */
2
- const prettierOptions = require("../prettier.config.cjs");
2
+ const { prettierConfig } = require("../prettier.config.cjs");
3
3
  // const webpackConfig = require('../../webpack/webpack.prod.babel');
4
4
 
5
5
  exports.baseExtends = [
@@ -26,7 +26,7 @@ exports.baseOverrides = [
26
26
  ];
27
27
 
28
28
  const baseRules = {
29
- "prettier/prettier": ["error", prettierOptions],
29
+ "prettier/prettier": ["error", prettierConfig],
30
30
  "arrow-body-style": [2, "as-needed"],
31
31
  "class-methods-use-this": 0,
32
32
  "import/imports-first": 0,
@@ -152,6 +152,7 @@ exports.baseConfig = {
152
152
  },
153
153
  ignorePatterns: [
154
154
  "/build/**/*",
155
+ "/node_modules/**/*",
155
156
  "/dist/**/*",
156
157
  "/reports/**/*",
157
158
  "/coverage/**/*",
@@ -1,9 +1,9 @@
1
1
  const { baseExtends, basePlugins } = require('../common.cjs');
2
2
 
3
3
  exports.tsBaseExtends = [
4
- 'plugin:@typescript-eslint/recommended',
5
4
  'plugin:import/typescript',
6
- 'plugin:@typescript-eslint/recommended-requiring-type-checking',
5
+ 'plugin:@typescript-eslint/recommended-type-checked',
6
+ 'plugin:@typescript-eslint/stylistic-type-checked',
7
7
  ].concat(baseExtends);
8
8
 
9
9
  exports.tsBaseRules = {
@@ -34,7 +34,7 @@ exports.tsBaseConfig = {
34
34
  plugins: ['@typescript-eslint'].concat(basePlugins),
35
35
  parserOptions: {
36
36
  tsconfigRootDir: process.cwd(),
37
- project: 'tsconfig.json',
37
+ project: true,
38
38
  },
39
39
  settings: {
40
40
  'import/resolver': {
@@ -1,19 +1,20 @@
1
1
  exports.stylelintConfig = {
2
2
  ignoreFiles: [
3
- '/dist/**/*',
4
- '/coverage/**/*',
5
- '/build/**/*',
6
- '/reports/**/*',
7
- '/temp/**/*',
8
- '/docs/**/*',
9
- '/demo/**/*',
10
- '/node_modules/**/*',
11
- '/vendor/**/*',
3
+ "/dist/**/*",
4
+ "/coverage/**/*",
5
+ "/build/**/*",
6
+ "/reports/**/*",
7
+ "/temp/**/*",
8
+ "/docs/**/*",
9
+ "/demo/**/*",
10
+ "/node_modules/**/*",
11
+ "/vendor/**/*",
12
12
  ],
13
- customSyntax: '@stylelint/postcss-css-in-js',
13
+ customSyntax: "@stylelint/postcss-css-in-js",
14
+ // customSyntax: "postcss-styled-components", // '@stylelint/postcss-css-in-js' is deprecated, this may be a replacement?
14
15
  extends: [
15
- 'stylelint-config-recommended',
16
- 'stylelint-config-styled-components',
16
+ "stylelint-config-recommended",
17
+ "stylelint-config-styled-components",
17
18
  ],
18
- rules: { 'selector-type-no-unknown': null, 'function-no-unknown': null },
19
+ rules: { "selector-type-no-unknown": null, "function-no-unknown": null },
19
20
  };
@@ -3,7 +3,7 @@ const cwd = process.cwd();
3
3
  const execaOptions = { cwd, stdio: "inherit" };
4
4
  const semVerRegEx = /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
5
5
  const isSemVersion = (tagName) => semVerRegEx.test(tagName);
6
- const branchName = (process.env.BRANCH_NAME || "master").toLowerCase();
6
+ const branchName = (process.env.BRANCH_NAME ?? "master").toLowerCase();
7
7
  const branchTags = {
8
8
  master: /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/,
9
9
  next: /^v.*-next\.(0|[1-9]\d*)/,
@@ -2,7 +2,7 @@ import { readFile, writeFile } from "node:fs/promises";
2
2
  import fg from "fast-glob";
3
3
  import normalizePath from "normalize-path";
4
4
  import { findMonoRepoRoot } from "./utils.js";
5
- const monorepoRoot = normalizePath(findMonoRepoRoot() || "");
5
+ const monorepoRoot = normalizePath(findMonoRepoRoot() ?? "");
6
6
  const setRegistryVersion = async () => {
7
7
  const files = await fg([
8
8
  `${monorepoRoot}/libs/*/package.json`,
@@ -2,7 +2,7 @@ import { readFile, writeFile } from "node:fs/promises";
2
2
  import fg from "fast-glob";
3
3
  import normalizePath from "normalize-path";
4
4
  import { findMonoRepoRoot } from "./utils.js";
5
- const monorepoRoot = normalizePath(findMonoRepoRoot() || "");
5
+ const monorepoRoot = normalizePath(findMonoRepoRoot() ?? "");
6
6
  const setWorkspaceVersion = async () => {
7
7
  const files = await fg([
8
8
  `${monorepoRoot}/libs/*/package.json`,
@@ -1,8 +1,8 @@
1
1
  import fs from "node:fs";
2
2
  import path from "node:path";
3
+ import crypto from "crypto";
3
4
  import express from "express";
4
5
  import cspPolicy from "helmet-csp";
5
- import crypto from "crypto";
6
6
  const CSP_REPORT_URI = "/diagnostics/v1/csp";
7
7
  const sources = [
8
8
  "'self'",
@@ -2,10 +2,10 @@ import minimist from "minimist";
2
2
  const argv = minimist(process.argv.slice(2));
3
3
  const getCWD = () => process.cwd();
4
4
  const port = parseInt(
5
- argv.port || process.env.port || process.env.PORT || "3000",
5
+ argv.port ?? process.env.port ?? process.env.PORT ?? "3000",
6
6
  10
7
7
  );
8
- const host = argv.host || process.env.HOST || "localhost";
8
+ const host = argv.host ?? process.env.HOST ?? "localhost";
9
9
  export {
10
10
  getCWD,
11
11
  host,