@elliemae/pui-cli 7.27.0-beta.1 → 7.27.0-beta.2

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 (102) hide show
  1. package/dist/cjs/cli.js +14 -12
  2. package/dist/cjs/commands/build.js +9 -8
  3. package/dist/cjs/commands/codemod.js +7 -9
  4. package/dist/cjs/commands/gendoc.js +2 -2
  5. package/dist/cjs/commands/lint.js +21 -23
  6. package/dist/cjs/commands/pack.js +25 -20
  7. package/dist/cjs/commands/start.js +11 -10
  8. package/dist/cjs/commands/storybook.js +19 -18
  9. package/dist/cjs/commands/test.js +37 -31
  10. package/dist/cjs/commands/tscheck.js +9 -8
  11. package/dist/cjs/commands/utils.js +12 -7
  12. package/dist/cjs/commands/version.js +21 -19
  13. package/dist/cjs/commands/vitest.js +32 -28
  14. package/dist/cjs/index.cjs +0 -2
  15. package/dist/cjs/index.js +2 -2
  16. package/dist/cjs/monorepo/delete-merged-tags.js +1 -1
  17. package/dist/cjs/monorepo/set-registry-version.js +2 -2
  18. package/dist/cjs/monorepo/set-workspace-version.js +2 -2
  19. package/dist/cjs/monorepo/utils.js +54 -0
  20. package/dist/cjs/server/appRoutes.js +74 -0
  21. package/dist/cjs/server/csp.js +3 -4
  22. package/dist/cjs/server/index.js +13 -11
  23. package/dist/cjs/server/middlewares.js +7 -4
  24. package/dist/cjs/server/utils.js +1 -1
  25. package/dist/cjs/utils.js +50 -0
  26. package/dist/cjs/webpack/helpers.js +3 -3
  27. package/dist/cjs/webpack/webpack.base.babel.js +3 -10
  28. package/dist/cjs/webpack/webpack.dev.babel.js +11 -8
  29. package/dist/cjs/webpack/webpack.lib.base.babel.js +4 -5
  30. package/dist/cjs/webpack/webpack.lib.dev.babel.js +1 -0
  31. package/dist/cjs/webpack/webpack.prod.babel.js +7 -15
  32. package/dist/cjs/webpack/webpack.storybook.js +27 -20
  33. package/dist/esm/cli.js +14 -12
  34. package/dist/esm/commands/build.js +9 -8
  35. package/dist/esm/commands/codemod.js +7 -9
  36. package/dist/esm/commands/gendoc.js +2 -2
  37. package/dist/esm/commands/lint.js +27 -23
  38. package/dist/esm/commands/pack.js +32 -20
  39. package/dist/esm/commands/start.js +11 -10
  40. package/dist/esm/commands/storybook.js +19 -18
  41. package/dist/esm/commands/test.js +37 -31
  42. package/dist/esm/commands/tscheck.js +9 -8
  43. package/dist/esm/commands/utils.js +11 -6
  44. package/dist/esm/commands/version.js +21 -19
  45. package/dist/esm/commands/vitest.js +32 -28
  46. package/dist/esm/index.cjs +0 -2
  47. package/dist/esm/index.js +1 -1
  48. package/dist/esm/monorepo/delete-merged-tags.js +1 -1
  49. package/dist/esm/monorepo/set-registry-version.js +2 -2
  50. package/dist/esm/monorepo/set-workspace-version.js +2 -2
  51. package/dist/esm/monorepo/utils.js +24 -0
  52. package/dist/esm/server/appRoutes.js +44 -0
  53. package/dist/esm/server/csp.js +3 -4
  54. package/dist/esm/server/index.js +13 -11
  55. package/dist/esm/server/middlewares.js +7 -4
  56. package/dist/esm/server/utils.js +1 -1
  57. package/dist/esm/utils.js +20 -0
  58. package/dist/esm/webpack/helpers.js +3 -3
  59. package/dist/esm/webpack/webpack.base.babel.js +3 -10
  60. package/dist/esm/webpack/webpack.dev.babel.js +11 -8
  61. package/dist/esm/webpack/webpack.lib.base.babel.js +4 -5
  62. package/dist/esm/webpack/webpack.lib.dev.babel.js +1 -0
  63. package/dist/esm/webpack/webpack.prod.babel.js +7 -15
  64. package/dist/esm/webpack/webpack.storybook.js +27 -20
  65. package/dist/types/commands/build.d.ts +13 -13
  66. package/dist/types/commands/codemod.d.ts +13 -6
  67. package/dist/types/commands/gendoc.d.ts +7 -6
  68. package/dist/types/commands/lint.d.ts +29 -29
  69. package/dist/types/commands/pack.d.ts +29 -26
  70. package/dist/types/commands/start.d.ts +17 -13
  71. package/dist/types/commands/storybook.d.ts +28 -27
  72. package/dist/types/commands/test.d.ts +47 -39
  73. package/dist/types/commands/tscheck.d.ts +16 -14
  74. package/dist/types/commands/utils.d.ts +11 -11
  75. package/dist/types/commands/version.d.ts +31 -28
  76. package/dist/types/commands/vitest.d.ts +41 -35
  77. package/dist/types/index.d.cts +1 -2
  78. package/dist/types/index.d.ts +11 -11
  79. package/dist/types/monorepo/delete-merged-tags.d.ts +1 -1
  80. package/dist/types/monorepo/set-registry-version.d.ts +1 -1
  81. package/dist/types/monorepo/set-workspace-version.d.ts +1 -1
  82. package/dist/types/monorepo/utils.d.ts +1 -0
  83. package/dist/types/server/appRoutes.d.ts +2 -0
  84. package/dist/types/server/csp.d.ts +12 -9
  85. package/dist/types/server/logger.d.ts +7 -4
  86. package/dist/types/server/middlewares.d.ts +6 -2
  87. package/dist/types/server/utils.d.ts +3 -3
  88. package/dist/types/testing/jest.config.d.cts +10 -10
  89. package/dist/types/testing/jest.node.config.d.cts +10 -10
  90. package/dist/types/utils.d.ts +4 -0
  91. package/dist/types/webpack/helpers.d.ts +19 -18
  92. package/dist/types/webpack/webpack.base.babel.d.ts +3 -106
  93. package/dist/types/webpack/webpack.dev.babel.d.ts +2 -1
  94. package/dist/types/webpack/webpack.lib.base.babel.d.ts +3 -102
  95. package/dist/types/webpack/webpack.lib.dev.babel.d.ts +3 -101
  96. package/dist/types/webpack/webpack.lib.prod.babel.d.ts +2 -101
  97. package/dist/types/webpack/webpack.prod.babel.d.ts +3 -2
  98. package/dist/types/webpack/webpack.storybook.d.ts +5 -4
  99. package/package.json +38 -24
  100. package/dist/cjs/server/app-routes.cjs +0 -42
  101. package/dist/esm/server/app-routes.cjs +0 -42
  102. package/dist/types/server/app-routes.d.cts +0 -1
@@ -17,7 +17,7 @@ const deleteTags = (cmd, filter) => {
17
17
  const tags = result.toString().split("\n").join(" ");
18
18
  execSync(`git tag -d ${filter ? filter(tags) : tags}`, { cwd });
19
19
  };
20
- const tagsFromOtherBranches = (tags = []) => {
20
+ const tagsFromOtherBranches = (tags) => {
21
21
  const regex = branchTags[branchName] || branchTags.master;
22
22
  return tags.split(" ").filter((tagName) => isSemVersion(tagName) && !regex.test(tagName)).join(" ");
23
23
  };
@@ -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
+ };
@@ -0,0 +1,44 @@
1
+ import fs from "node:fs";
2
+ import path from "node:path";
3
+ const allJS = /\.(js|ts)$/;
4
+ const serviceEndpoints = /\.endpoint\.(ts|js)$/;
5
+ const getFilesMatching = (filePattern) => {
6
+ const getFiles = (dir) => {
7
+ let routeFiles = [];
8
+ if (!fs.existsSync(dir))
9
+ return routeFiles;
10
+ fs.readdirSync(dir).forEach((file) => {
11
+ const fullPath = path.join(dir, file);
12
+ if (fs.lstatSync(fullPath).isDirectory()) {
13
+ routeFiles = routeFiles.concat(getFiles(fullPath));
14
+ } else if (filePattern.test(fullPath))
15
+ routeFiles.push(fullPath);
16
+ });
17
+ return routeFiles;
18
+ };
19
+ return getFiles;
20
+ };
21
+ const getServerRouteFiles = getFilesMatching(allJS);
22
+ const getServiceEndpoints = getFilesMatching(serviceEndpoints);
23
+ const loadRoutes = async (app) => {
24
+ const routeFiles = getServerRouteFiles(
25
+ path.join(process.cwd(), "server/routes")
26
+ );
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 init = await import(routeFile);
32
+ try {
33
+ init(app);
34
+ } catch (err) {
35
+ console.error(
36
+ `unable to load routes from ${routeFile}. ${err.message}`
37
+ );
38
+ }
39
+ })
40
+ );
41
+ };
42
+ export {
43
+ loadRoutes
44
+ };
@@ -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,
@@ -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
  ];
@@ -239,7 +232,7 @@ const baseConfig = (options) => ({
239
232
  }
240
233
  ]
241
234
  },
242
- plugins: plugins.concat(options.plugins),
235
+ plugins: options.plugins ? plugins.concat(options.plugins) : plugins,
243
236
  resolve: {
244
237
  modules: [
245
238
  "node_modules",
@@ -5,10 +5,9 @@ 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 expressStaticGzip from "express-static-gzip";
10
9
  import { setupDefaultMiddlewares } from "../server/middlewares.js";
11
- import { loadRoutes } from "../server/app-routes.cjs";
10
+ import { loadRoutes } from "../server/appRoutes.js";
12
11
  import {
13
12
  isAppLoaderEnabled,
14
13
  getPaths,
@@ -16,7 +15,6 @@ import {
16
15
  } from "./helpers.js";
17
16
  import { baseConfig } from "./webpack.base.babel.js";
18
17
  const __filename = fileURLToPath(import.meta.url);
19
- const smp = new SpeedMeasurePlugin({ disable: !process.env.MEASURE });
20
18
  const {
21
19
  appVersion,
22
20
  buildPath,
@@ -115,15 +113,20 @@ const devConfig = {
115
113
  open: [basePath],
116
114
  port: process.env.PORT || "auto",
117
115
  setupMiddlewares: (middlewares, devServer) => {
118
- setupDefaultMiddlewares(devServer.app);
119
- devServer.app.use(expressStaticGzip("cdn"));
120
- loadRoutes(devServer.app);
116
+ if (devServer.app) {
117
+ setupDefaultMiddlewares(devServer.app);
118
+ devServer.app.use(expressStaticGzip("cdn", {}));
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
  }),
@@ -164,7 +163,7 @@ const baseConfig = (options) => ({
164
163
  }
165
164
  ]
166
165
  },
167
- plugins: plugins.concat(options.plugins || []),
166
+ plugins: options.plugins ? plugins.concat(options.plugins || []) : plugins,
168
167
  resolve: {
169
168
  modules: [
170
169
  "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";
@@ -4,7 +4,6 @@ import { GenerateSW } from "workbox-webpack-plugin";
4
4
  import MiniCssExtractPlugin from "mini-css-extract-plugin";
5
5
  import { BundleAnalyzerPlugin } from "webpack-bundle-analyzer";
6
6
  import { ESBuildMinifyPlugin } from "esbuild-loader";
7
- import SpeedMeasurePlugin from "speed-measure-webpack-plugin";
8
7
  import browserslistToEsbuild from "browserslist-to-esbuild";
9
8
  import { baseConfig } from "./webpack.base.babel.js";
10
9
  import {
@@ -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,14 @@
1
- export namespace buildCmd {
2
- function handler({ service }: {
1
+ import yargs, { Argv } from 'yargs';
2
+ export declare const buildCmd: {
3
+ handler: ({ service }: {
3
4
  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
- }
5
+ }) => Promise<void>;
6
+ command: string;
7
+ desc: string;
8
+ builder: (yargsRef: Argv) => yargs.Argv<yargs.Omit<{}, "service"> & yargs.InferredOptionTypes<{
9
+ service: {
10
+ boolean: boolean;
11
+ default: boolean;
12
+ };
13
+ }>>;
14
+ };
@@ -1,6 +1,13 @@
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 yargs, { Argv } from 'yargs';
2
+ type Arguments = {
3
+ transform: string;
4
+ };
5
+ export declare const codemodCmd: {
6
+ handler: (argv: Arguments) => Promise<void>;
7
+ command: string;
8
+ desc: string;
9
+ builder: (yargsRef: Argv) => yargs.Argv<{
10
+ transform: string;
11
+ }>;
12
+ };
13
+ export {};
@@ -1,6 +1,7 @@
1
- export namespace gendocCmd {
2
- function handler(): Promise<void>;
3
- const command: string;
4
- const describe: string;
5
- const builder: {};
6
- }
1
+ import yargs, { Argv } from 'yargs';
2
+ export declare const gendocCmd: {
3
+ handler: () => Promise<void>;
4
+ command: string;
5
+ desc: string;
6
+ builder: (yargsRef: Argv) => yargs.Argv<yargs.Omit<{}, never> & yargs.InferredOptionTypes<{}>>;
7
+ };
@@ -1,29 +1,29 @@
1
- export namespace lintCmd {
2
- function handler(argv: any): Promise<0 | -1>;
3
- const command: string;
4
- const describe: string;
5
- namespace builder {
6
- namespace css {
7
- export const alias: string;
8
- export const type: string;
9
- const _default: boolean;
10
- export { _default as default };
11
- }
12
- namespace js {
13
- const alias_1: string;
14
- export { alias_1 as alias };
15
- const type_1: string;
16
- export { type_1 as type };
17
- const _default_1: boolean;
18
- export { _default_1 as default };
19
- }
20
- namespace fix {
21
- const alias_2: string;
22
- export { alias_2 as alias };
23
- const type_2: string;
24
- export { type_2 as type };
25
- const _default_2: boolean;
26
- export { _default_2 as default };
27
- }
28
- }
29
- }
1
+ import yargs, { Argv } from 'yargs';
2
+ type Arguments = {
3
+ css: boolean;
4
+ js: boolean;
5
+ fix: boolean;
6
+ };
7
+ export declare const lintCmd: {
8
+ handler: (argv: Arguments) => Promise<void>;
9
+ command: string;
10
+ desc: string;
11
+ builder: (yargsRef: Argv) => yargs.Argv<yargs.Omit<{}, "css" | "js" | "fix"> & yargs.InferredOptionTypes<{
12
+ css: {
13
+ boolean: boolean;
14
+ alias: string;
15
+ default: boolean;
16
+ };
17
+ js: {
18
+ boolean: boolean;
19
+ alias: string;
20
+ default: boolean;
21
+ };
22
+ fix: {
23
+ boolean: boolean;
24
+ alias: string;
25
+ default: boolean;
26
+ };
27
+ }>>;
28
+ };
29
+ export {};