@elliemae/pui-cli 7.27.1 → 8.0.0-next.10

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 (128) hide show
  1. package/README.md +0 -1
  2. package/{dist/esm/typescript/app.tsconfig.json → app.tsconfig.json} +2 -2
  3. package/dist/cjs/cli.js +14 -12
  4. package/dist/cjs/commands/build.js +8 -7
  5. package/dist/cjs/commands/codemod.js +6 -8
  6. package/dist/cjs/commands/gendoc.js +1 -1
  7. package/dist/cjs/commands/lint.js +20 -22
  8. package/dist/cjs/commands/pack.js +24 -19
  9. package/dist/cjs/commands/start.js +10 -9
  10. package/dist/cjs/commands/storybook.js +18 -17
  11. package/dist/cjs/commands/test.js +36 -30
  12. package/dist/cjs/commands/tscheck.js +8 -7
  13. package/dist/cjs/commands/utils.js +11 -6
  14. package/dist/cjs/commands/version.js +20 -18
  15. package/dist/cjs/commands/vitest.js +31 -27
  16. package/dist/cjs/index.cjs +0 -2
  17. package/dist/cjs/index.js +2 -2
  18. package/dist/cjs/lint-config/eslint/common.cjs +88 -85
  19. package/dist/cjs/lint-config/stylelint.config.cjs +1 -1
  20. package/dist/cjs/monorepo/delete-merged-tags.js +1 -1
  21. package/dist/cjs/monorepo/set-registry-version.js +2 -2
  22. package/dist/cjs/monorepo/set-workspace-version.js +2 -2
  23. package/dist/cjs/monorepo/utils.js +54 -0
  24. package/dist/cjs/release.config.cjs +0 -7
  25. package/dist/cjs/server/appRoutes.js +75 -0
  26. package/dist/cjs/server/csp.js +3 -4
  27. package/dist/cjs/server/index.js +13 -11
  28. package/dist/cjs/server/middlewares.js +7 -4
  29. package/dist/cjs/server/utils.js +1 -1
  30. package/dist/cjs/testing/setup-test-env.js +5 -24
  31. package/dist/cjs/testing/vitest.config.js +1 -1
  32. package/dist/cjs/transpile/esbuild.js +1 -1
  33. package/dist/cjs/utils.js +50 -0
  34. package/dist/cjs/webpack/helpers.js +3 -3
  35. package/dist/cjs/webpack/webpack.base.babel.js +3 -12
  36. package/dist/cjs/webpack/webpack.dev.babel.js +10 -7
  37. package/dist/cjs/webpack/webpack.lib.base.babel.js +4 -7
  38. package/dist/cjs/webpack/webpack.lib.dev.babel.js +1 -0
  39. package/dist/cjs/webpack/webpack.lib.prod.babel.js +1 -1
  40. package/dist/cjs/webpack/webpack.prod.babel.js +8 -16
  41. package/dist/cjs/webpack/webpack.storybook.js +27 -20
  42. package/dist/esm/cli.js +14 -12
  43. package/dist/esm/commands/build.js +8 -7
  44. package/dist/esm/commands/codemod.js +6 -8
  45. package/dist/esm/commands/gendoc.js +1 -1
  46. package/dist/esm/commands/lint.js +26 -22
  47. package/dist/esm/commands/pack.js +31 -19
  48. package/dist/esm/commands/start.js +10 -9
  49. package/dist/esm/commands/storybook.js +18 -17
  50. package/dist/esm/commands/test.js +36 -30
  51. package/dist/esm/commands/tscheck.js +8 -7
  52. package/dist/esm/commands/utils.js +10 -5
  53. package/dist/esm/commands/version.js +20 -18
  54. package/dist/esm/commands/vitest.js +31 -27
  55. package/dist/esm/index.cjs +0 -2
  56. package/dist/esm/index.js +1 -1
  57. package/dist/esm/lint-config/eslint/common.cjs +88 -85
  58. package/dist/esm/lint-config/stylelint.config.cjs +1 -1
  59. package/dist/esm/monorepo/delete-merged-tags.js +1 -1
  60. package/dist/esm/monorepo/set-registry-version.js +2 -2
  61. package/dist/esm/monorepo/set-workspace-version.js +2 -2
  62. package/dist/esm/monorepo/utils.js +24 -0
  63. package/dist/esm/release.config.cjs +0 -7
  64. package/dist/{cjs/server/app-routes.cjs → esm/server/appRoutes.js} +26 -23
  65. package/dist/esm/server/csp.js +3 -4
  66. package/dist/esm/server/index.js +13 -11
  67. package/dist/esm/server/middlewares.js +7 -4
  68. package/dist/esm/server/utils.js +1 -1
  69. package/dist/esm/testing/setup-test-env.js +5 -2
  70. package/dist/esm/testing/vitest.config.js +1 -1
  71. package/dist/esm/transpile/esbuild.js +1 -1
  72. package/dist/esm/utils.js +20 -0
  73. package/dist/esm/webpack/helpers.js +3 -3
  74. package/dist/esm/webpack/webpack.base.babel.js +3 -12
  75. package/dist/esm/webpack/webpack.dev.babel.js +10 -7
  76. package/dist/esm/webpack/webpack.lib.base.babel.js +4 -7
  77. package/dist/esm/webpack/webpack.lib.dev.babel.js +1 -0
  78. package/dist/esm/webpack/webpack.lib.prod.babel.js +2 -2
  79. package/dist/esm/webpack/webpack.prod.babel.js +9 -17
  80. package/dist/esm/webpack/webpack.storybook.js +27 -20
  81. package/dist/types/commands/build.d.ts +6 -14
  82. package/dist/types/commands/codemod.d.ts +6 -6
  83. package/dist/types/commands/gendoc.d.ts +2 -6
  84. package/dist/types/commands/lint.d.ts +8 -29
  85. package/dist/types/commands/pack.d.ts +8 -26
  86. package/dist/types/commands/start.d.ts +6 -13
  87. package/dist/types/commands/storybook.d.ts +8 -27
  88. package/dist/types/commands/test.d.ts +11 -39
  89. package/dist/types/commands/tscheck.d.ts +5 -14
  90. package/dist/types/commands/utils.d.ts +11 -11
  91. package/dist/types/commands/version.d.ts +9 -28
  92. package/dist/types/commands/vitest.d.ts +10 -35
  93. package/dist/types/index.d.cts +1 -2
  94. package/dist/types/index.d.ts +11 -11
  95. package/dist/types/lint-config/eslint/common.d.cts +58 -55
  96. package/dist/types/lint-config/eslint/non-react.d.cts +34 -31
  97. package/dist/types/lint-config/eslint/react.d.cts +58 -55
  98. package/dist/types/lint-config/eslint/typescript/non-react.d.cts +28 -28
  99. package/dist/types/lint-config/eslint/typescript/react.d.cts +52 -52
  100. package/dist/types/lint-config/stylelint.config.d.cts +0 -1
  101. package/dist/types/monorepo/delete-merged-tags.d.ts +1 -1
  102. package/dist/types/monorepo/set-registry-version.d.ts +1 -1
  103. package/dist/types/monorepo/set-workspace-version.d.ts +1 -1
  104. package/dist/types/monorepo/utils.d.ts +1 -0
  105. package/dist/types/release.config.d.cts +0 -2
  106. package/dist/types/server/appRoutes.d.ts +2 -0
  107. package/dist/types/server/csp.d.ts +12 -9
  108. package/dist/types/server/logger.d.ts +7 -4
  109. package/dist/types/server/middlewares.d.ts +6 -2
  110. package/dist/types/server/utils.d.ts +3 -3
  111. package/dist/types/testing/jest.config.d.cts +10 -10
  112. package/dist/types/testing/jest.node.config.d.cts +10 -10
  113. package/dist/types/testing/vitest.config.d.ts +1 -1
  114. package/dist/types/utils.d.ts +4 -0
  115. package/dist/types/webpack/helpers.d.ts +19 -18
  116. package/dist/types/webpack/webpack.base.babel.d.ts +3 -106
  117. package/dist/types/webpack/webpack.dev.babel.d.ts +2 -1
  118. package/dist/types/webpack/webpack.lib.base.babel.d.ts +3 -102
  119. package/dist/types/webpack/webpack.lib.dev.babel.d.ts +3 -101
  120. package/dist/types/webpack/webpack.lib.prod.babel.d.ts +2 -101
  121. package/dist/types/webpack/webpack.prod.babel.d.ts +3 -2
  122. package/dist/types/webpack/webpack.storybook.d.ts +5 -4
  123. package/{dist/cjs/typescript/library.tsconfig.json → library.tsconfig.json} +3 -3
  124. package/package.json +74 -51
  125. package/dist/cjs/typescript/app.tsconfig.json +0 -23
  126. package/dist/esm/server/app-routes.cjs +0 -42
  127. package/dist/esm/typescript/library.tsconfig.json +0 -23
  128. package/dist/types/server/app-routes.d.cts +0 -1
@@ -1,7 +1,7 @@
1
1
  import { readFile, writeFile } from "node:fs/promises";
2
2
  import fg from "fast-glob";
3
3
  import normalizePath from "normalize-path";
4
- import { findMonoRepoRoot } from "./utils.cjs";
4
+ import { findMonoRepoRoot } from "./utils.js";
5
5
  const monorepoRoot = normalizePath(findMonoRepoRoot() || "");
6
6
  const setRegistryVersion = async () => {
7
7
  const files = await fg([
@@ -9,7 +9,7 @@ const setRegistryVersion = async () => {
9
9
  `${monorepoRoot}/apps/*/package.json`,
10
10
  `${monorepoRoot}/package.json`
11
11
  ]);
12
- Promise.all(
12
+ await Promise.all(
13
13
  files.map(async (file) => {
14
14
  let pkgJSONData = await readFile(file, "utf8");
15
15
  const pkgVersion = JSON.parse(pkgJSONData).version;
@@ -1,7 +1,7 @@
1
1
  import { readFile, writeFile } from "node:fs/promises";
2
2
  import fg from "fast-glob";
3
3
  import normalizePath from "normalize-path";
4
- import { findMonoRepoRoot } from "./utils.cjs";
4
+ import { findMonoRepoRoot } from "./utils.js";
5
5
  const monorepoRoot = normalizePath(findMonoRepoRoot() || "");
6
6
  const setWorkspaceVersion = async () => {
7
7
  const files = await fg([
@@ -9,7 +9,7 @@ const setWorkspaceVersion = async () => {
9
9
  `${monorepoRoot}/apps/*/package.json`,
10
10
  `${monorepoRoot}/package.json`
11
11
  ]);
12
- Promise.all(
12
+ await Promise.all(
13
13
  files.map(async (file) => {
14
14
  let pkgJSONData = await readFile(file, "utf8");
15
15
  const pkgVersion = JSON.parse(pkgJSONData).version;
@@ -0,0 +1,24 @@
1
+ import path from "node:path";
2
+ import { execSync } from "child_process";
3
+ const WORKSPACE_DIR_ENV_VAR = "NPM_CONFIG_WORKSPACE_DIR";
4
+ const WORKSPACE_MANIFEST_FILENAME = "pnpm-workspace.yaml";
5
+ const getPNPMWorkspaceLocation = (cwd) => {
6
+ let location = null;
7
+ for (const fileName of [WORKSPACE_MANIFEST_FILENAME, "pnpm-workspace.yml"]) {
8
+ try {
9
+ const result = execSync(`npx find-up ${fileName}`, { cwd });
10
+ location = result.toString().trim();
11
+ break;
12
+ } catch (err) {
13
+ }
14
+ }
15
+ return location;
16
+ };
17
+ const findMonoRepoRoot = (cwd = process.cwd()) => {
18
+ const workspaceManifestDirEnvVar = process.env[WORKSPACE_DIR_ENV_VAR] ?? process.env[WORKSPACE_DIR_ENV_VAR.toLowerCase()];
19
+ const workspaceManifestLocation = workspaceManifestDirEnvVar ? path.join(workspaceManifestDirEnvVar, "pnpm-workspace.yaml") : getPNPMWorkspaceLocation(cwd);
20
+ return workspaceManifestLocation && path.dirname(workspaceManifestLocation);
21
+ };
22
+ export {
23
+ findMonoRepoRoot
24
+ };
@@ -20,12 +20,5 @@ module.exports = {
20
20
  ],
21
21
  '@semantic-release/npm',
22
22
  '@semantic-release/github',
23
- [
24
- '@semantic-release/exec',
25
- {
26
- successCmd:
27
- 'scmutil get slack-release-notes && scmutil get contributors',
28
- },
29
- ],
30
23
  ],
31
24
  };
@@ -1,42 +1,45 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
-
1
+ import fs from "node:fs";
2
+ import path from "node:path";
4
3
  const allJS = /\.js$/;
5
-
6
4
  const serviceEndpoints = /\.endpoint\.js$/;
7
-
8
5
  const getFilesMatching = (filePattern) => {
9
6
  const getFiles = (dir) => {
10
7
  let routeFiles = [];
11
- if (!fs.existsSync(dir)) return routeFiles;
8
+ if (!fs.existsSync(dir))
9
+ return routeFiles;
12
10
  fs.readdirSync(dir).forEach((file) => {
13
11
  const fullPath = path.join(dir, file);
14
12
  if (fs.lstatSync(fullPath).isDirectory()) {
15
13
  routeFiles = routeFiles.concat(getFiles(fullPath));
16
- } else if (filePattern.test(fullPath)) routeFiles.push(fullPath);
14
+ } else if (filePattern.test(fullPath))
15
+ routeFiles.push(fullPath);
17
16
  });
18
17
  return routeFiles;
19
18
  };
20
19
  return getFiles;
21
20
  };
22
-
23
21
  const getServerRouteFiles = getFilesMatching(allJS);
24
22
  const getServiceEndpoints = getFilesMatching(serviceEndpoints);
25
-
26
- exports.loadRoutes = (app) => {
23
+ const loadRoutes = async (app) => {
27
24
  const routeFiles = getServerRouteFiles(
28
- path.join(process.cwd(), 'server/routes'),
25
+ path.join(process.cwd(), "server/routes")
29
26
  );
30
- routeFiles.push(...getServiceEndpoints(path.join(process.cwd(), 'app')));
31
- routeFiles.push(...getServiceEndpoints(path.join(process.cwd(), 'lib')));
32
- routeFiles.forEach((routeFile) => {
33
- // eslint-disable-next-line global-require
34
- const init = require(routeFile);
35
- try {
36
- init(app);
37
- } catch (err) {
38
- // eslint-disable-next-line no-console
39
- console.error(`unable to load routes from ${routeFile}. ${err.message}`);
40
- }
41
- });
27
+ routeFiles.push(...getServiceEndpoints(path.join(process.cwd(), "app")));
28
+ routeFiles.push(...getServiceEndpoints(path.join(process.cwd(), "lib")));
29
+ await Promise.all(
30
+ routeFiles.map(async (routeFile) => {
31
+ const { default: init } = await import(routeFile);
32
+ try {
33
+ if (typeof init === "function")
34
+ init(app);
35
+ } catch (err) {
36
+ console.error(
37
+ `unable to load routes from ${routeFile}. ${err.message}`
38
+ );
39
+ }
40
+ })
41
+ );
42
+ };
43
+ export {
44
+ loadRoutes
42
45
  };
@@ -28,14 +28,13 @@ const sendFileWithCSPNonce = ({
28
28
  res.sendStatus(404);
29
29
  } else {
30
30
  res.set("Content-Type", "text/html");
31
- res.send(html.replace(nonceRegex, (res.locals || {}).cspNonce));
31
+ res.send(html.replace(nonceRegex, res.locals.cspNonce));
32
32
  }
33
33
  });
34
34
  };
35
35
  const getScriptSrc = () => {
36
- const scriptSrc = sources.concat([
37
- (req, res) => `'nonce-${res.locals.cspNonce}'`
38
- ]);
36
+ const source = (req, res) => `'nonce-${res.locals.cspNonce}'`;
37
+ const scriptSrc = sources.concat([source]);
39
38
  return true ? scriptSrc.concat(["'unsafe-eval'"]) : scriptSrc;
40
39
  };
41
40
  const csp = (app) => {
@@ -5,14 +5,16 @@ import {
5
5
  setupAdditionalMiddlewars
6
6
  } from "./middlewares.js";
7
7
  import { port, host } from "./utils.js";
8
- import { loadRoutes } from "./app-routes.cjs";
9
- const app = express();
10
- setupDefaultMiddlewares(app);
11
- loadRoutes(app);
12
- setupAdditionalMiddlewars(app);
13
- app.listen(port, host, async (err) => {
14
- if (err) {
15
- return logger.error(err.message);
16
- }
17
- logger.appStarted(port, host || "localhost");
18
- });
8
+ import { loadRoutes } from "./appRoutes.js";
9
+ (async function startServer() {
10
+ const app = express();
11
+ setupDefaultMiddlewares(app);
12
+ await loadRoutes(app);
13
+ setupAdditionalMiddlewars(app);
14
+ app.listen(port, host, () => {
15
+ logger.appStarted(port.toString(), host || "localhost");
16
+ }).on("error", (err) => {
17
+ logger.error(err);
18
+ process.exit(1);
19
+ });
20
+ })();
@@ -2,12 +2,12 @@ import express from "express";
2
2
  import cors from "cors";
3
3
  import compression from "compression";
4
4
  import expressStaticGzip from "express-static-gzip";
5
- import expressPinoLogger from "express-pino-logger";
5
+ import pinoLogger from "pino-http";
6
6
  import { csp, sendFileWithCSPNonce } from "./csp.js";
7
7
  import { getPaths } from "../webpack/helpers.js";
8
8
  const paths = getPaths();
9
9
  const setupDefaultMiddlewares = (app) => {
10
- const pino = expressPinoLogger({
10
+ const pino = pinoLogger({
11
11
  transport: {
12
12
  target: "pino-pretty",
13
13
  options: {
@@ -38,8 +38,11 @@ const setupAdditionalMiddlewars = (app, options = {}) => {
38
38
  orderPreference: ["br"]
39
39
  })
40
40
  );
41
- app.use(expressStaticGzip("cdn"));
42
- app.get("*", (req, res) => sendFileWithCSPNonce({ buildPath, res }));
41
+ app.use(expressStaticGzip("cdn", {}));
42
+ app.get(
43
+ "*",
44
+ (req, res) => sendFileWithCSPNonce({ buildPath, res })
45
+ );
43
46
  return app;
44
47
  };
45
48
  export {
@@ -5,7 +5,7 @@ const port = parseInt(
5
5
  argv.port || process.env.port || process.env.PORT || "3000",
6
6
  10
7
7
  );
8
- const host = argv.host || process.env.HOST;
8
+ const host = argv.host || process.env.HOST || "localhost";
9
9
  export {
10
10
  getCWD,
11
11
  host,
@@ -1,4 +1,7 @@
1
- import * as React from "react";
1
+ import { afterEach } from "vitest";
2
2
  import "jest-styled-components";
3
+ import { cleanup } from "@testing-library/react";
3
4
  import "@testing-library/jest-dom/extend-expect";
4
- global.React = React;
5
+ afterEach(() => {
6
+ cleanup();
7
+ });
@@ -8,7 +8,7 @@ const vitestConfig = defineConfig({
8
8
  test: {
9
9
  globals: true,
10
10
  root: process.cwd(),
11
- environment: "happy-dom",
11
+ environment: "jsdom",
12
12
  setupFiles: [path.resolve(__dirname, "./setup-test-env.js")],
13
13
  include: ["./{app,lib}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
14
14
  exclude: [...configDefaults.exclude, ".idea", ".git", ".cache", "e2e"],
@@ -8,7 +8,7 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
8
8
  const TARGETS = {
9
9
  browserslist: browserslistToEsbuild(),
10
10
  web: "es2020",
11
- node: "node16"
11
+ node: "node18"
12
12
  };
13
13
  const ESBUILD_FORMAT = {
14
14
  CJS: "cjs",
@@ -0,0 +1,20 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ const basePath = (process.env.BASE_PATH || "/").replace(/\/?$/, "/");
4
+ const isApp = () => fs.existsSync(path.join(process.cwd(), "app"));
5
+ const getAppConfig = () => {
6
+ const appConfigPath = path.join(
7
+ process.cwd(),
8
+ isApp() ? "app" : "lib",
9
+ "app.config.json"
10
+ );
11
+ if (!fs.existsSync(appConfigPath))
12
+ return "{}";
13
+ const appConfig = fs.readFileSync(appConfigPath);
14
+ return appConfig || "{}";
15
+ };
16
+ export {
17
+ basePath,
18
+ getAppConfig,
19
+ isApp
20
+ };
@@ -3,8 +3,8 @@ import fs from "node:fs";
3
3
  import _ from "lodash";
4
4
  import CompressionPlugin from "compression-webpack-plugin";
5
5
  import zlib from "zlib";
6
- import { findMonoRepoRoot } from "../monorepo/utils.cjs";
7
- import { basePath, getAppConfig } from "../utils.cjs";
6
+ import { findMonoRepoRoot } from "../monorepo/utils.js";
7
+ import { basePath, getAppConfig } from "../utils.js";
8
8
  let pathSep = path.sep;
9
9
  if (pathSep === "\\")
10
10
  pathSep = "\\\\";
@@ -26,7 +26,7 @@ const excludeNodeModulesExcept = (modules) => {
26
26
  };
27
27
  const getLibraryName = () => {
28
28
  const packageJson = JSON.parse(
29
- fs.readFileSync(path.join(process.cwd(), "package.json"))
29
+ fs.readFileSync(path.join(process.cwd(), "package.json")).toString()
30
30
  );
31
31
  const libraryName = packageJson ? packageJson.name : process.env.LIBRARY_NAME || "mylibrary";
32
32
  const modifiedLibName = `emui-${libraryName.replace("@elliemae/", "").replace("pui-", "")}`;
@@ -1,9 +1,9 @@
1
1
  import path from "node:path";
2
2
  import webpack from "webpack";
3
+ import "webpack-dev-server";
3
4
  import MiniCssExtractPlugin from "mini-css-extract-plugin";
4
5
  import PostcssPresetEnv from "postcss-preset-env";
5
6
  import CopyWebpackPlugin from "copy-webpack-plugin";
6
- import DuplicatePackageCheckerPlugin from "duplicate-package-checker-webpack-plugin";
7
7
  import MomentLocalesPlugin from "moment-locales-webpack-plugin";
8
8
  import { WebpackManifestPlugin } from "webpack-manifest-plugin";
9
9
  import FaviconsWebpackPlugin from "favicons-webpack-plugin";
@@ -113,7 +113,6 @@ const plugins = [
113
113
  }
114
114
  ])
115
115
  }),
116
- new DuplicatePackageCheckerPlugin(),
117
116
  new MomentLocalesPlugin({ localesToKeep: ["es-us"] }),
118
117
  new WebpackManifestPlugin({
119
118
  fileName: "./latest/manifest.json",
@@ -127,13 +126,7 @@ const plugins = [
127
126
  outputPath: "./latest/assets",
128
127
  logo: "./app/view/images/favicon.png",
129
128
  favicons: {
130
- developerName: "ICE MT",
131
- developerURL: null,
132
- // prevent retrieving from the nearest package.json
133
- icons: {
134
- coast: false,
135
- yandex: false
136
- }
129
+ developerName: "ICE MT"
137
130
  }
138
131
  })
139
132
  ];
@@ -159,7 +152,6 @@ const baseConfig = (options) => ({
159
152
  use: {
160
153
  loader: "esbuild-loader",
161
154
  options: {
162
- loader: "jsx",
163
155
  target: browserslistToEsbuild()
164
156
  }
165
157
  }
@@ -173,7 +165,6 @@ const baseConfig = (options) => ({
173
165
  use: {
174
166
  loader: "esbuild-loader",
175
167
  options: {
176
- loader: "tsx",
177
168
  target: browserslistToEsbuild()
178
169
  }
179
170
  }
@@ -239,7 +230,7 @@ const baseConfig = (options) => ({
239
230
  }
240
231
  ]
241
232
  },
242
- plugins: plugins.concat(options.plugins),
233
+ plugins: options.plugins ? plugins.concat(options.plugins) : plugins,
243
234
  resolve: {
244
235
  modules: [
245
236
  "node_modules",
@@ -5,9 +5,8 @@ import HtmlWebpackPlugin from "html-webpack-plugin";
5
5
  import CircularDependencyPlugin from "circular-dependency-plugin";
6
6
  import MiniCssExtractPlugin from "mini-css-extract-plugin";
7
7
  import ReactRefreshWebpackPlugin from "@pmmmwh/react-refresh-webpack-plugin";
8
- import SpeedMeasurePlugin from "speed-measure-webpack-plugin";
9
8
  import { setupDefaultMiddlewares } from "../server/middlewares.js";
10
- import { loadRoutes } from "../server/app-routes.cjs";
9
+ import { loadRoutes } from "../server/appRoutes.js";
11
10
  import {
12
11
  isAppLoaderEnabled,
13
12
  getPaths,
@@ -15,7 +14,6 @@ import {
15
14
  } from "./helpers.js";
16
15
  import { baseConfig } from "./webpack.base.babel.js";
17
16
  const __filename = fileURLToPath(import.meta.url);
18
- const smp = new SpeedMeasurePlugin({ disable: !process.env.MEASURE });
19
17
  const {
20
18
  appVersion,
21
19
  buildPath,
@@ -116,14 +114,19 @@ const devConfig = {
116
114
  open: [basePath],
117
115
  port: process.env.PORT || "auto",
118
116
  setupMiddlewares: (middlewares, devServer) => {
119
- setupDefaultMiddlewares(devServer.app);
120
- loadRoutes(devServer.app);
117
+ if (devServer.app) {
118
+ setupDefaultMiddlewares(devServer.app);
119
+ loadRoutes(devServer.app).then(() => {
120
+ }).catch((err) => {
121
+ console.error(err);
122
+ });
123
+ }
121
124
  return middlewares;
122
125
  }
123
126
  }
124
127
  };
125
- const config = smp.wrap(baseConfig(devConfig));
126
- config.plugins = config.plugins.concat([new ReactRefreshWebpackPlugin({})]);
128
+ const config = baseConfig(devConfig);
129
+ config.plugins = config.plugins ? config.plugins.concat([new ReactRefreshWebpackPlugin({})]) : [];
127
130
  var webpack_dev_babel_default = config;
128
131
  export {
129
132
  webpack_dev_babel_default as default
@@ -1,9 +1,9 @@
1
1
  import path from "node:path";
2
2
  import webpack from "webpack";
3
+ import "webpack-dev-server";
3
4
  import MiniCssExtractPlugin from "mini-css-extract-plugin";
4
5
  import CopyWebpackPlugin from "copy-webpack-plugin";
5
6
  import PostcssPresetEnv from "postcss-preset-env";
6
- import DuplicatePackageCheckerPlugin from "duplicate-package-checker-webpack-plugin";
7
7
  import MomentLocalesPlugin from "moment-locales-webpack-plugin";
8
8
  import ResolveTypeScriptPlugin from "resolve-typescript-plugin";
9
9
  import browserslistToEsbuild from "browserslist-to-esbuild";
@@ -14,7 +14,7 @@ import {
14
14
  getAlias,
15
15
  filterByFilePresence
16
16
  } from "./helpers.js";
17
- import { getAppConfig } from "../utils.cjs";
17
+ import { getAppConfig } from "../utils.js";
18
18
  const minicssLoader = {
19
19
  loader: MiniCssExtractPlugin.loader,
20
20
  options: {}
@@ -37,7 +37,7 @@ const plugins = [
37
37
  CI: "false"
38
38
  }),
39
39
  new webpack.DefinePlugin({
40
- APP_CONFIG: getAppConfig(true)
40
+ APP_CONFIG: getAppConfig()
41
41
  }),
42
42
  /* eslint-disable indent */
43
43
  ...copyPluginPatterns.length > 0 ? [
@@ -46,7 +46,6 @@ const plugins = [
46
46
  })
47
47
  ] : [],
48
48
  /* eslint-enable indent */
49
- new DuplicatePackageCheckerPlugin(),
50
49
  new webpack.optimize.LimitChunkCountPlugin({
51
50
  maxChunks: 1
52
51
  }),
@@ -77,7 +76,6 @@ const baseConfig = (options) => ({
77
76
  use: {
78
77
  loader: "esbuild-loader",
79
78
  options: {
80
- loader: "jsx",
81
79
  target: browserslistToEsbuild()
82
80
  }
83
81
  }
@@ -92,7 +90,6 @@ const baseConfig = (options) => ({
92
90
  use: {
93
91
  loader: "esbuild-loader",
94
92
  options: {
95
- loader: "tsx",
96
93
  target: browserslistToEsbuild()
97
94
  }
98
95
  }
@@ -164,7 +161,7 @@ const baseConfig = (options) => ({
164
161
  }
165
162
  ]
166
163
  },
167
- plugins: plugins.concat(options.plugins || []),
164
+ plugins: options.plugins ? plugins.concat(options.plugins || []) : plugins,
168
165
  resolve: {
169
166
  modules: [
170
167
  "node_modules",
@@ -1,5 +1,6 @@
1
1
  import path from "node:path";
2
2
  import webpack from "webpack";
3
+ import "webpack-dev-server";
3
4
  import fg from "fast-glob";
4
5
  import CircularDependencyPlugin from "circular-dependency-plugin";
5
6
  import MiniCssExtractPlugin from "mini-css-extract-plugin";
@@ -3,7 +3,7 @@ import fg from "fast-glob";
3
3
  import MiniCssExtractPlugin from "mini-css-extract-plugin";
4
4
  import HtmlWebpackPlugin from "html-webpack-plugin";
5
5
  import { BundleAnalyzerPlugin } from "webpack-bundle-analyzer";
6
- import { ESBuildMinifyPlugin } from "esbuild-loader";
6
+ import { EsbuildPlugin } from "esbuild-loader";
7
7
  import browserslistToEsbuild from "browserslist-to-esbuild";
8
8
  import {
9
9
  getLibraryVariableName,
@@ -40,7 +40,7 @@ const prodConfig = {
40
40
  moduleIds: "deterministic",
41
41
  minimize: true,
42
42
  minimizer: [
43
- new ESBuildMinifyPlugin({
43
+ new EsbuildPlugin({
44
44
  target: browserslistToEsbuild(),
45
45
  css: true
46
46
  })
@@ -3,8 +3,7 @@ import HtmlWebpackPlugin from "html-webpack-plugin";
3
3
  import { GenerateSW } from "workbox-webpack-plugin";
4
4
  import MiniCssExtractPlugin from "mini-css-extract-plugin";
5
5
  import { BundleAnalyzerPlugin } from "webpack-bundle-analyzer";
6
- import { ESBuildMinifyPlugin } from "esbuild-loader";
7
- import SpeedMeasurePlugin from "speed-measure-webpack-plugin";
6
+ import { EsbuildPlugin } from "esbuild-loader";
8
7
  import browserslistToEsbuild from "browserslist-to-esbuild";
9
8
  import { baseConfig } from "./webpack.base.babel.js";
10
9
  import {
@@ -31,7 +30,7 @@ const getProdConfig = ({ latestVersion = true } = {}) => {
31
30
  optimization: {
32
31
  moduleIds: "deterministic",
33
32
  minimizer: [
34
- new ESBuildMinifyPlugin({
33
+ new EsbuildPlugin({
35
34
  target: browserslistToEsbuild(),
36
35
  css: true
37
36
  })
@@ -54,6 +53,10 @@ const getProdConfig = ({ latestVersion = true } = {}) => {
54
53
  },
55
54
  plugins: [
56
55
  ...getCompressionPlugins(),
56
+ new MiniCssExtractPlugin({
57
+ filename: "latest/css/[name].[contenthash].css",
58
+ chunkFilename: "latest/css/[name].[contenthash].chunk.css"
59
+ }),
57
60
  new BundleAnalyzerPlugin({
58
61
  analyzerMode: "static",
59
62
  reportFilename: path.join(process.cwd(), "reports/bundle-stats.html"),
@@ -106,20 +109,9 @@ const htmlWebpackPlugin = new HtmlWebpackPlugin({
106
109
  }
107
110
  });
108
111
  const config = baseConfig(getProdConfig());
109
- config.plugins.push(htmlWebpackPlugin);
110
- const addSMPPlugin = (webpackConfig) => {
111
- const smpConfig = new SpeedMeasurePlugin({
112
- disable: !process.env.MEASURE
113
- }).wrap(webpackConfig);
114
- smpConfig.plugins.push(
115
- new MiniCssExtractPlugin({
116
- filename: "latest/css/[name].[contenthash].css",
117
- chunkFilename: "latest/css/[name].[contenthash].chunk.css"
118
- })
119
- );
120
- return smpConfig;
121
- };
122
- var webpack_prod_babel_default = addSMPPlugin(config);
112
+ if (config.plugins)
113
+ config.plugins.push(htmlWebpackPlugin);
114
+ var webpack_prod_babel_default = config;
123
115
  export {
124
116
  webpack_prod_babel_default as default
125
117
  };
@@ -3,7 +3,7 @@ import MiniCssExtractPlugin from "mini-css-extract-plugin";
3
3
  import CopyWebpackPlugin from "copy-webpack-plugin";
4
4
  import ResolveTypeScriptPlugin from "resolve-typescript-plugin";
5
5
  import { getAlias, getCompressionPlugins } from "./helpers.js";
6
- import { isApp } from "../utils.cjs";
6
+ import { isApp } from "../utils.js";
7
7
  const IS_APP = isApp();
8
8
  const CWD = process.cwd();
9
9
  const getAdditionalPlugins = () => [
@@ -50,33 +50,40 @@ const getModuleRules = () => [
50
50
  type: "asset/resource"
51
51
  }
52
52
  ];
53
- const webpackFinal = async (config, { configType }) => {
53
+ const webpackFinal = (config, { configType }) => {
54
54
  const isProd = configType === "PRODUCTION";
55
- const fileLoaderRule = config.module.rules.find(
55
+ const fileLoaderRule = config?.module?.rules?.find?.(
56
56
  (rule) => rule.test?.test?.(".svg")
57
57
  );
58
- fileLoaderRule.exclude = /\.svg$/i;
59
- config.module.rules.unshift(...getModuleRules());
60
- config.plugins.push(...getAdditionalPlugins());
58
+ if (fileLoaderRule)
59
+ fileLoaderRule.exclude = /\.svg$/i;
60
+ config?.module?.rules?.unshift(...getModuleRules());
61
+ config?.plugins?.push(...getAdditionalPlugins());
61
62
  if (isProd) {
62
- config.plugins = config.plugins.concat(getCompressionPlugins());
63
+ config.plugins = config?.plugins?.concat(getCompressionPlugins());
64
+ }
65
+ if (config.resolve) {
66
+ config.resolve.alias = { ...config?.resolve?.alias, ...getAlias() };
67
+ config.resolve.fallback = { ...config.resolve.fallback, crypto: false };
68
+ config.resolve.extensions?.push(".svg");
69
+ config.resolve.plugins = [
70
+ ...config.resolve.plugins || [],
71
+ new ResolveTypeScriptPlugin({})
72
+ ];
63
73
  }
64
- config.resolve.alias = { ...config.resolve.alias, ...getAlias() };
65
- config.resolve.fallback = { ...config.resolve.fallback, crypto: false };
66
- config.resolve.extensions.push(".svg");
67
- config.resolve.plugins = [
68
- ...config.resolve.plugins || [],
69
- new ResolveTypeScriptPlugin({})
70
- ];
71
74
  config.externals = config.externals || {};
72
- config.externals["@elliemae/pui-user-monitoring"] = "emuiUserMonitoring";
73
- config.externals["@elliemae/pui-app-loader"] = "emuiAppLoader";
74
- config.externals["@elliemae/pui-diagnostics"] = "emuiDiagnostics";
75
+ if (config.externals) {
76
+ config.externals["@elliemae/pui-user-monitoring"] = "emuiUserMonitoring";
77
+ config.externals["@elliemae/pui-app-loader"] = "emuiAppLoader";
78
+ config.externals["@elliemae/pui-diagnostics"] = "emuiDiagnostics";
79
+ }
75
80
  return config;
76
81
  };
77
- const managerWebpack = async (config) => {
78
- config.plugins = config.plugins.concat(getCompressionPlugins());
79
- config.resolve.alias = { ...config.resolve.alias, ...getAlias() };
82
+ const managerWebpack = (config) => {
83
+ if (config.plugins)
84
+ config.plugins = config.plugins.concat(getCompressionPlugins());
85
+ if (config.resolve)
86
+ config.resolve.alias = { ...config.resolve.alias, ...getAlias() };
80
87
  return config;
81
88
  };
82
89
  export {
@@ -1,14 +1,6 @@
1
- export namespace buildCmd {
2
- function handler({ service }: {
3
- service?: boolean | undefined;
4
- }): Promise<void>;
5
- const command: string;
6
- const describe: string;
7
- namespace builder {
8
- namespace service {
9
- export const type: string;
10
- const _default: boolean;
11
- export { _default as default };
12
- }
13
- }
14
- }
1
+ import { CommandModule } from 'yargs';
2
+ type Arguments = {
3
+ service: boolean;
4
+ };
5
+ export declare const buildCmd: CommandModule<Record<string, never>, Arguments>;
6
+ export {};
@@ -1,6 +1,6 @@
1
- export namespace codemodCmd {
2
- function handler(argv: any): Promise<void>;
3
- const command: string;
4
- const describe: string;
5
- function builder(yargsRef: any): void;
6
- }
1
+ import { CommandModule } from 'yargs';
2
+ type Arguments = {
3
+ transform: string;
4
+ };
5
+ export declare const codemodCmd: CommandModule<Record<string, never>, Arguments>;
6
+ export {};