@elliemae/pui-cli 8.32.0 → 8.34.0

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.
@@ -71,10 +71,8 @@ const buildCmd = {
71
71
  handler: async ({ service = false }) => {
72
72
  try {
73
73
  (0, import_utils.logInfo)("Build in progress...");
74
- if (service)
75
- await buildService();
76
- else
77
- await buildWebApp();
74
+ if (service) await buildService();
75
+ else await buildWebApp();
78
76
  (0, import_utils.logSuccess)("Build completed");
79
77
  } catch (err) {
80
78
  (0, import_utils.logError)("Build failed", err);
@@ -49,14 +49,14 @@ const lintCSS = async (args) => {
49
49
  `stylelint ./{lib,app}/**/*.{js,jsx,ts,tsx} ${fixIssues} ${!(0, import_utils.getCIEnv)() ? "--color" : "--no-color"} --allow-empty-input --config ${import_node_path.default.join(
50
50
  process.cwd(),
51
51
  "stylelint.config.cjs"
52
- )}`
52
+ )} -o ./reports/stylelint.json`
53
53
  );
54
54
  };
55
55
  const lintJS = async (args) => {
56
56
  const fixIssues = args.fix ? "--fix" : "";
57
57
  const debugFlags = args.debug ? "--env-info --debug" : "";
58
58
  await (0, import_utils.exec)(
59
- `eslint ${!(0, import_utils.getCIEnv)() ? "--color" : "--no-color"} ${fixIssues} ${debugFlags} .`
59
+ `eslint -o ./reports/eslint.json ${!(0, import_utils.getCIEnv)() ? "--color" : "--no-color"} ${fixIssues} ${debugFlags} .`
60
60
  );
61
61
  };
62
62
  const cmdArgs = {
@@ -92,8 +92,7 @@ const lintCmd = {
92
92
  (0, import_utils.logSuccess)("JS linting completed");
93
93
  } catch (err) {
94
94
  (0, import_utils.logError)("JS linting failed");
95
- if (argv.debug)
96
- (0, import_utils.logError)(err);
95
+ if (argv.debug) (0, import_utils.logError)(err);
97
96
  (0, import_yargs.default)().exit(-1, err);
98
97
  return;
99
98
  }
@@ -105,8 +104,7 @@ const lintCmd = {
105
104
  (0, import_utils.logSuccess)("CSS linting completed");
106
105
  } catch (err) {
107
106
  (0, import_utils.logError)("CSS linting failed");
108
- if (argv.debug)
109
- (0, import_utils.logError)(err);
107
+ if (argv.debug) (0, import_utils.logError)(err);
110
108
  (0, import_yargs.default)().exit(-1, err);
111
109
  }
112
110
  }
@@ -69,8 +69,7 @@ const pack = async ({
69
69
  if ((0, import_utils.isTypeScriptEnabled)()) {
70
70
  await compileTypeScript();
71
71
  }
72
- if (target !== "node")
73
- await webBuild(production);
72
+ if (target !== "node") await webBuild(production);
74
73
  if (target !== "web") {
75
74
  (0, import_utils.logInfo)("Building source files for nodejs environment...");
76
75
  await (0, import_esbuild.esBuild)({ srcdir: srcPath });
@@ -77,18 +77,12 @@ const testCmd = {
77
77
  // eslint-disable-next-line max-statements
78
78
  handler: async (argv) => {
79
79
  let commandOptions = "--coverage --maxWorkers=50%";
80
- if (argv.fix)
81
- commandOptions += " -u";
82
- else if (argv.watch)
83
- commandOptions += " --watchAll";
84
- if ((0, import_utils.getCIEnv)())
85
- commandOptions += " --ci --no-colors";
86
- if (argv.passWithNoTests)
87
- commandOptions += " --passWithNoTests";
88
- if (argv.findReleatedTests)
89
- commandOptions += " --bail --findRelatedTests";
90
- if (argv.silent)
91
- commandOptions += " --silent";
80
+ if (argv.fix) commandOptions += " -u";
81
+ else if (argv.watch) commandOptions += " --watchAll";
82
+ if ((0, import_utils.getCIEnv)()) commandOptions += " --ci --no-colors";
83
+ if (argv.passWithNoTests) commandOptions += " --passWithNoTests";
84
+ if (argv.findReleatedTests) commandOptions += " --bail --findRelatedTests";
85
+ if (argv.silent) commandOptions += " --silent";
92
86
  try {
93
87
  if ((0, import_utils.getCIEnv)()) {
94
88
  await (0, import_utils.exec)("rimraf ./reports");
@@ -157,8 +157,7 @@ const updateRuntimeFile = async (src, dest, version) => {
157
157
  const results = await (0, import_fast_glob.default)([
158
158
  import_node_path.default.join(src, "runtime~app.*.js").replace(/\\/g, "/")
159
159
  ]);
160
- if (!results?.length)
161
- throw new Error("Runtime file not found");
160
+ if (!results?.length) throw new Error("Runtime file not found");
162
161
  const runtimeFilePath = results[0];
163
162
  const runtimeFileName = import_node_path.default.basename(runtimeFilePath);
164
163
  const destRuntimeFilePath = import_node_path.default.join(dest, runtimeFileName);
@@ -187,8 +186,7 @@ const updateRuntimeFile = async (src, dest, version) => {
187
186
  const copyBuildAssetsToVersionedFolder = async () => {
188
187
  const appVersion = (0, import_helpers.getAppVersion)();
189
188
  const isVersionedApp = (0, import_helpers.isAppLoaderEnabled)() && appVersion !== import_helpers.LATEST_VERSION;
190
- if (!isVersionedApp)
191
- return;
189
+ if (!isVersionedApp) return;
192
190
  const src = import_node_path.default.resolve(process.cwd(), "build/public/latest");
193
191
  const dest = import_node_path.default.resolve(process.cwd(), `build/public/${appVersion}`);
194
192
  await copyDir(src, dest);
@@ -67,16 +67,11 @@ const vitestCmd = {
67
67
  // eslint-disable-next-line max-statements
68
68
  handler: async (argv) => {
69
69
  let commandOptions = "--coverage";
70
- if (argv.fix)
71
- commandOptions = "-u";
72
- else if (argv.watch)
73
- commandOptions = "--watch";
74
- if (argv.passWithNoTests)
75
- commandOptions += " --passWithNoTests";
76
- if (argv.findReleatedTests)
77
- commandOptions += " --related";
78
- if (argv.silent)
79
- commandOptions += " --silent";
70
+ if (argv.fix) commandOptions = "-u";
71
+ else if (argv.watch) commandOptions = "--watch";
72
+ if (argv.passWithNoTests) commandOptions += " --passWithNoTests";
73
+ if (argv.findReleatedTests) commandOptions += " --related";
74
+ if (argv.silent) commandOptions += " --silent";
80
75
  try {
81
76
  if ((0, import_utils.getCIEnv)()) {
82
77
  await (0, import_utils.exec)("rimraf ./reports");
@@ -35,8 +35,7 @@ const branchTags = {
35
35
  };
36
36
  const deleteTags = (cmd, filter) => {
37
37
  const result = (0, import_child_process.execSync)(cmd, { cwd });
38
- if (!result)
39
- return;
38
+ if (!result) return;
40
39
  const tags = result.toString().split("\n").join(" ");
41
40
  (0, import_child_process.execSync)(`git tag -d ${filter ? filter(tags) : tags}`, { cwd });
42
41
  };
@@ -41,8 +41,7 @@ const baseConfig = {
41
41
  };
42
42
  const getPUIConfig = () => {
43
43
  const configPath = import_node_path.default.resolve(process.cwd(), "./pui.config.js");
44
- if (!import_node_fs.default.existsSync(configPath))
45
- return baseConfig;
44
+ if (!import_node_fs.default.existsSync(configPath)) return baseConfig;
46
45
  const config = JSON.parse(import_node_fs.default.readFileSync(configPath, "utf8"));
47
46
  return (0, import_lodash.merge)(baseConfig, config);
48
47
  };
@@ -39,14 +39,12 @@ const serviceEndpoints = /\.endpoint\.js$/;
39
39
  const getFilesMatching = (filePattern) => {
40
40
  const getFiles = (dir) => {
41
41
  let routeFiles = [];
42
- if (!import_node_fs.default.existsSync(dir))
43
- return routeFiles;
42
+ if (!import_node_fs.default.existsSync(dir)) return routeFiles;
44
43
  import_node_fs.default.readdirSync(dir).forEach((file) => {
45
44
  const fullPath = import_node_path.default.join(dir, file);
46
45
  if (import_node_fs.default.lstatSync(fullPath).isDirectory()) {
47
46
  routeFiles = routeFiles.concat(getFiles(fullPath));
48
- } else if (filePattern.test(fullPath))
49
- routeFiles.push(fullPath);
47
+ } else if (filePattern.test(fullPath)) routeFiles.push(fullPath);
50
48
  });
51
49
  return routeFiles;
52
50
  };
@@ -65,8 +63,7 @@ const loadRoutes = async (app) => {
65
63
  const routeFileURL = (0, import_node_url.pathToFileURL)(routeFile).href;
66
64
  const { default: init } = await import(routeFileURL);
67
65
  try {
68
- if (typeof init === "function")
69
- init(app);
66
+ if (typeof init === "function") init(app);
70
67
  } catch (err) {
71
68
  console.error(
72
69
  `unable to load routes from ${routeFile}. ${err.message}`
@@ -39,17 +39,14 @@ const onSocketError = (err) => {
39
39
  console.error(err);
40
40
  };
41
41
  const authenticate = (token, cb) => {
42
- if (!token)
43
- cb(4401);
44
- else
45
- cb();
42
+ if (!token) cb(4401);
43
+ else cb();
46
44
  };
47
45
  const getAuthToken = (protocols) => {
48
46
  const authProtocol = protocols.find(
49
47
  (protocol) => protocol.startsWith("auth--")
50
48
  );
51
- if (!authProtocol)
52
- return "";
49
+ if (!authProtocol) return "";
53
50
  return authProtocol.split("--")[1]?.trim?.();
54
51
  };
55
52
  const createWSServer = ({
@@ -111,8 +108,7 @@ const createWSServer = ({
111
108
  });
112
109
  const interval = setInterval(() => {
113
110
  wsServer.clients.forEach((ws) => {
114
- if (isAlive === false)
115
- ws.terminate();
111
+ if (isAlive === false) ws.terminate();
116
112
  isAlive = false;
117
113
  ws.ping();
118
114
  });
@@ -46,23 +46,19 @@ console.error = (...args) => {
46
46
  return false;
47
47
  return originalError(...args);
48
48
  };
49
- if (expect)
50
- expect.extend(import_jest_axe.default.toHaveNoViolations);
49
+ if (expect) expect.extend(import_jest_axe.default.toHaveNoViolations);
51
50
  const addElementToBody = (element) => {
52
51
  const documentEle = (window || {}).document;
53
- if (!documentEle)
54
- return null;
52
+ if (!documentEle) return null;
55
53
  const bodyEle = documentEle.body;
56
54
  const newEle = documentEle.createElement(...element);
57
- if (!newEle)
58
- return null;
55
+ if (!newEle) return null;
59
56
  bodyEle.appendChild(newEle);
60
57
  return newEle;
61
58
  };
62
59
  const addRootElement = (id) => {
63
60
  const rootEle = addElementToBody("div");
64
- if (rootEle)
65
- rootEle.id = id;
61
+ if (rootEle) rootEle.id = id;
66
62
  };
67
63
  addRootElement("root");
68
64
  (0, import_matchMedia.addMatchMedia)();
package/dist/cjs/utils.js CHANGED
@@ -43,8 +43,7 @@ const getAppConfig = () => {
43
43
  isApp() ? "app" : "lib",
44
44
  "app.config.json"
45
45
  );
46
- if (!import_node_fs.default.existsSync(appConfigPath))
47
- return "{}";
46
+ if (!import_node_fs.default.existsSync(appConfigPath)) return "{}";
48
47
  const appConfig = import_node_fs.default.readFileSync(appConfigPath);
49
48
  return appConfig || "{}";
50
49
  };
@@ -66,8 +66,7 @@ const excludeNodeModulesExcept = (modules) => {
66
66
  return function(modulePath) {
67
67
  if (/node_modules/.test(modulePath)) {
68
68
  for (let i = 0; i < moduleRegExps.length; i += 1)
69
- if (moduleRegExps[i].test(modulePath))
70
- return false;
69
+ if (moduleRegExps[i].test(modulePath)) return false;
71
70
  return true;
72
71
  }
73
72
  return false;
@@ -135,8 +134,7 @@ const getUserMonitoringFileName = () => {
135
134
  process.cwd(),
136
135
  "node_modules/@elliemae/pui-user-monitoring/dist/public/js"
137
136
  );
138
- if (!import_node_fs.default.existsSync(userMonLibPath))
139
- return `${libName}.js`;
137
+ if (!import_node_fs.default.existsSync(userMonLibPath)) return `${libName}.js`;
140
138
  const distJSFiles = import_node_fs.default.readdirSync(userMonLibPath);
141
139
  return distJSFiles.filter(
142
140
  (fName) => fName.match(/emuiUserMonitoring+((?!chunk).)*\.js$/)
@@ -148,8 +146,7 @@ const getAppLoaderFileName = () => {
148
146
  process.cwd(),
149
147
  "node_modules/@elliemae/pui-app-loader/dist/public/js"
150
148
  );
151
- if (!import_node_fs.default.existsSync(appLoaderLibPath))
152
- return `${libName}.js`;
149
+ if (!import_node_fs.default.existsSync(appLoaderLibPath)) return `${libName}.js`;
153
150
  const distJSFiles = import_node_fs.default.readdirSync(appLoaderLibPath);
154
151
  return distJSFiles.filter(
155
152
  (fName) => fName.match(/emuiAppLoader+((?!chunk).)*\.js$/)
@@ -161,8 +158,7 @@ const getDiagnosticsFileName = () => {
161
158
  process.cwd(),
162
159
  "node_modules/@elliemae/pui-diagnostics/dist/public/js"
163
160
  );
164
- if (!import_node_fs.default.existsSync(libPath))
165
- return `${libName}.js`;
161
+ if (!import_node_fs.default.existsSync(libPath)) return `${libName}.js`;
166
162
  const distJSFiles = import_node_fs.default.readdirSync(libPath);
167
163
  return distJSFiles.filter(
168
164
  (fName) => fName.match(/emuiDiagnostics+((?!chunk).)*\.js$/)
@@ -174,16 +170,14 @@ const getENCWLoaderFileName = () => {
174
170
  process.cwd(),
175
171
  "node_modules/@elliemae/encw-loader/dist/public/js"
176
172
  );
177
- if (!import_node_fs.default.existsSync(appLoaderLibPath))
178
- return `${libName}.js`;
173
+ if (!import_node_fs.default.existsSync(appLoaderLibPath)) return `${libName}.js`;
179
174
  const distJSFiles = import_node_fs.default.readdirSync(appLoaderLibPath);
180
175
  return distJSFiles.filter(
181
176
  (fName) => fName.match(/emuiEncwLoader+((?!chunk).)*\.js$/)
182
177
  )[0];
183
178
  };
184
179
  const getAppVersion = () => {
185
- if (!process.env.APP_VERSION)
186
- return LATEST_VERSION;
180
+ if (!process.env.APP_VERSION) return LATEST_VERSION;
187
181
  const match = process.env.APP_VERSION.match(/^v?(\d+\.\d+)\..*$/);
188
182
  return match && match[1] || LATEST_VERSION;
189
183
  };
@@ -165,8 +165,7 @@ const devConfig = {
165
165
  (0, import_wsServer.createWSServer)({
166
166
  port: import_utils.wsPort
167
167
  }).then(({ wsServer }) => {
168
- if (devServer.app)
169
- devServer.app.locals.wsServer = wsServer;
168
+ if (devServer.app) devServer.app.locals.wsServer = wsServer;
170
169
  }).catch((err) => {
171
170
  console.error(err);
172
171
  });
@@ -137,6 +137,5 @@ const htmlWebpackPlugin = new import_html_webpack_plugin.default({
137
137
  }
138
138
  });
139
139
  const config = (0, import_webpack_base_babel.baseConfig)(getProdConfig());
140
- if (config.plugins)
141
- config.plugins.push(htmlWebpackPlugin);
140
+ if (config.plugins) config.plugins.push(htmlWebpackPlugin);
142
141
  var webpack_prod_babel_default = config;
@@ -89,8 +89,7 @@ const webpackFinal = (config, { configType }) => {
89
89
  const fileLoaderRule = config?.module?.rules?.find?.(
90
90
  (rule) => rule.test?.test?.(".svg")
91
91
  );
92
- if (fileLoaderRule)
93
- fileLoaderRule.exclude = /\.svg$/i;
92
+ if (fileLoaderRule) fileLoaderRule.exclude = /\.svg$/i;
94
93
  config?.module?.rules?.unshift(...getModuleRules());
95
94
  config?.plugins?.push(...getAdditionalPlugins());
96
95
  if (isProd) {
@@ -45,10 +45,8 @@ const buildCmd = {
45
45
  handler: async ({ service = false }) => {
46
46
  try {
47
47
  logInfo("Build in progress...");
48
- if (service)
49
- await buildService();
50
- else
51
- await buildWebApp();
48
+ if (service) await buildService();
49
+ else await buildWebApp();
52
50
  logSuccess("Build completed");
53
51
  } catch (err) {
54
52
  logError("Build failed", err);
@@ -23,14 +23,14 @@ const lintCSS = async (args) => {
23
23
  `stylelint ./{lib,app}/**/*.{js,jsx,ts,tsx} ${fixIssues} ${!getCIEnv() ? "--color" : "--no-color"} --allow-empty-input --config ${path.join(
24
24
  process.cwd(),
25
25
  "stylelint.config.cjs"
26
- )}`
26
+ )} -o ./reports/stylelint.json`
27
27
  );
28
28
  };
29
29
  const lintJS = async (args) => {
30
30
  const fixIssues = args.fix ? "--fix" : "";
31
31
  const debugFlags = args.debug ? "--env-info --debug" : "";
32
32
  await exec(
33
- `eslint ${!getCIEnv() ? "--color" : "--no-color"} ${fixIssues} ${debugFlags} .`
33
+ `eslint -o ./reports/eslint.json ${!getCIEnv() ? "--color" : "--no-color"} ${fixIssues} ${debugFlags} .`
34
34
  );
35
35
  };
36
36
  const cmdArgs = {
@@ -66,8 +66,7 @@ const lintCmd = {
66
66
  logSuccess("JS linting completed");
67
67
  } catch (err) {
68
68
  logError("JS linting failed");
69
- if (argv.debug)
70
- logError(err);
69
+ if (argv.debug) logError(err);
71
70
  yargs().exit(-1, err);
72
71
  return;
73
72
  }
@@ -79,8 +78,7 @@ const lintCmd = {
79
78
  logSuccess("CSS linting completed");
80
79
  } catch (err) {
81
80
  logError("CSS linting failed");
82
- if (argv.debug)
83
- logError(err);
81
+ if (argv.debug) logError(err);
84
82
  yargs().exit(-1, err);
85
83
  }
86
84
  }
@@ -42,8 +42,7 @@ const pack = async ({
42
42
  if (isTypeScriptEnabled()) {
43
43
  await compileTypeScript();
44
44
  }
45
- if (target !== "node")
46
- await webBuild(production);
45
+ if (target !== "node") await webBuild(production);
47
46
  if (target !== "web") {
48
47
  logInfo("Building source files for nodejs environment...");
49
48
  await esBuild({ srcdir: srcPath });
@@ -44,18 +44,12 @@ const testCmd = {
44
44
  // eslint-disable-next-line max-statements
45
45
  handler: async (argv) => {
46
46
  let commandOptions = "--coverage --maxWorkers=50%";
47
- if (argv.fix)
48
- commandOptions += " -u";
49
- else if (argv.watch)
50
- commandOptions += " --watchAll";
51
- if (getCIEnv())
52
- commandOptions += " --ci --no-colors";
53
- if (argv.passWithNoTests)
54
- commandOptions += " --passWithNoTests";
55
- if (argv.findReleatedTests)
56
- commandOptions += " --bail --findRelatedTests";
57
- if (argv.silent)
58
- commandOptions += " --silent";
47
+ if (argv.fix) commandOptions += " -u";
48
+ else if (argv.watch) commandOptions += " --watchAll";
49
+ if (getCIEnv()) commandOptions += " --ci --no-colors";
50
+ if (argv.passWithNoTests) commandOptions += " --passWithNoTests";
51
+ if (argv.findReleatedTests) commandOptions += " --bail --findRelatedTests";
52
+ if (argv.silent) commandOptions += " --silent";
59
53
  try {
60
54
  if (getCIEnv()) {
61
55
  await exec("rimraf ./reports");
@@ -126,8 +126,7 @@ const updateRuntimeFile = async (src, dest, version) => {
126
126
  const results = await fg([
127
127
  path.join(src, "runtime~app.*.js").replace(/\\/g, "/")
128
128
  ]);
129
- if (!results?.length)
130
- throw new Error("Runtime file not found");
129
+ if (!results?.length) throw new Error("Runtime file not found");
131
130
  const runtimeFilePath = results[0];
132
131
  const runtimeFileName = path.basename(runtimeFilePath);
133
132
  const destRuntimeFilePath = path.join(dest, runtimeFileName);
@@ -156,8 +155,7 @@ const updateRuntimeFile = async (src, dest, version) => {
156
155
  const copyBuildAssetsToVersionedFolder = async () => {
157
156
  const appVersion = getAppVersion();
158
157
  const isVersionedApp = isAppLoaderEnabled() && appVersion !== LATEST_VERSION;
159
- if (!isVersionedApp)
160
- return;
158
+ if (!isVersionedApp) return;
161
159
  const src = path.resolve(process.cwd(), "build/public/latest");
162
160
  const dest = path.resolve(process.cwd(), `build/public/${appVersion}`);
163
161
  await copyDir(src, dest);
@@ -34,16 +34,11 @@ const vitestCmd = {
34
34
  // eslint-disable-next-line max-statements
35
35
  handler: async (argv) => {
36
36
  let commandOptions = "--coverage";
37
- if (argv.fix)
38
- commandOptions = "-u";
39
- else if (argv.watch)
40
- commandOptions = "--watch";
41
- if (argv.passWithNoTests)
42
- commandOptions += " --passWithNoTests";
43
- if (argv.findReleatedTests)
44
- commandOptions += " --related";
45
- if (argv.silent)
46
- commandOptions += " --silent";
37
+ if (argv.fix) commandOptions = "-u";
38
+ else if (argv.watch) commandOptions = "--watch";
39
+ if (argv.passWithNoTests) commandOptions += " --passWithNoTests";
40
+ if (argv.findReleatedTests) commandOptions += " --related";
41
+ if (argv.silent) commandOptions += " --silent";
47
42
  try {
48
43
  if (getCIEnv()) {
49
44
  await exec("rimraf ./reports");
@@ -12,8 +12,7 @@ const branchTags = {
12
12
  };
13
13
  const deleteTags = (cmd, filter) => {
14
14
  const result = execSync(cmd, { cwd });
15
- if (!result)
16
- return;
15
+ if (!result) return;
17
16
  const tags = result.toString().split("\n").join(" ");
18
17
  execSync(`git tag -d ${filter ? filter(tags) : tags}`, { cwd });
19
18
  };
@@ -8,8 +8,7 @@ const baseConfig = {
8
8
  };
9
9
  const getPUIConfig = () => {
10
10
  const configPath = path.resolve(process.cwd(), "./pui.config.js");
11
- if (!fs.existsSync(configPath))
12
- return baseConfig;
11
+ if (!fs.existsSync(configPath)) return baseConfig;
13
12
  const config = JSON.parse(fs.readFileSync(configPath, "utf8"));
14
13
  return merge(baseConfig, config);
15
14
  };
@@ -6,14 +6,12 @@ const serviceEndpoints = /\.endpoint\.js$/;
6
6
  const getFilesMatching = (filePattern) => {
7
7
  const getFiles = (dir) => {
8
8
  let routeFiles = [];
9
- if (!fs.existsSync(dir))
10
- return routeFiles;
9
+ if (!fs.existsSync(dir)) return routeFiles;
11
10
  fs.readdirSync(dir).forEach((file) => {
12
11
  const fullPath = path.join(dir, file);
13
12
  if (fs.lstatSync(fullPath).isDirectory()) {
14
13
  routeFiles = routeFiles.concat(getFiles(fullPath));
15
- } else if (filePattern.test(fullPath))
16
- routeFiles.push(fullPath);
14
+ } else if (filePattern.test(fullPath)) routeFiles.push(fullPath);
17
15
  });
18
16
  return routeFiles;
19
17
  };
@@ -32,8 +30,7 @@ const loadRoutes = async (app) => {
32
30
  const routeFileURL = pathToFileURL(routeFile).href;
33
31
  const { default: init } = await import(routeFileURL);
34
32
  try {
35
- if (typeof init === "function")
36
- init(app);
33
+ if (typeof init === "function") init(app);
37
34
  } catch (err) {
38
35
  console.error(
39
36
  `unable to load routes from ${routeFile}. ${err.message}`
@@ -6,17 +6,14 @@ const onSocketError = (err) => {
6
6
  console.error(err);
7
7
  };
8
8
  const authenticate = (token, cb) => {
9
- if (!token)
10
- cb(4401);
11
- else
12
- cb();
9
+ if (!token) cb(4401);
10
+ else cb();
13
11
  };
14
12
  const getAuthToken = (protocols) => {
15
13
  const authProtocol = protocols.find(
16
14
  (protocol) => protocol.startsWith("auth--")
17
15
  );
18
- if (!authProtocol)
19
- return "";
16
+ if (!authProtocol) return "";
20
17
  return authProtocol.split("--")[1]?.trim?.();
21
18
  };
22
19
  const createWSServer = ({
@@ -78,8 +75,7 @@ const createWSServer = ({
78
75
  });
79
76
  const interval = setInterval(() => {
80
77
  wsServer.clients.forEach((ws) => {
81
- if (isAlive === false)
82
- ws.terminate();
78
+ if (isAlive === false) ws.terminate();
83
79
  isAlive = false;
84
80
  ws.ping();
85
81
  });
@@ -23,23 +23,19 @@ console.error = (...args) => {
23
23
  return false;
24
24
  return originalError(...args);
25
25
  };
26
- if (expect)
27
- expect.extend(jestAxe.toHaveNoViolations);
26
+ if (expect) expect.extend(jestAxe.toHaveNoViolations);
28
27
  const addElementToBody = (element) => {
29
28
  const documentEle = (window || {}).document;
30
- if (!documentEle)
31
- return null;
29
+ if (!documentEle) return null;
32
30
  const bodyEle = documentEle.body;
33
31
  const newEle = documentEle.createElement(...element);
34
- if (!newEle)
35
- return null;
32
+ if (!newEle) return null;
36
33
  bodyEle.appendChild(newEle);
37
34
  return newEle;
38
35
  };
39
36
  const addRootElement = (id) => {
40
37
  const rootEle = addElementToBody("div");
41
- if (rootEle)
42
- rootEle.id = id;
38
+ if (rootEle) rootEle.id = id;
43
39
  };
44
40
  addRootElement("root");
45
41
  addMatchMedia();
package/dist/esm/utils.js CHANGED
@@ -8,8 +8,7 @@ const getAppConfig = () => {
8
8
  isApp() ? "app" : "lib",
9
9
  "app.config.json"
10
10
  );
11
- if (!fs.existsSync(appConfigPath))
12
- return "{}";
11
+ if (!fs.existsSync(appConfigPath)) return "{}";
13
12
  const appConfig = fs.readFileSync(appConfigPath);
14
13
  return appConfig || "{}";
15
14
  };
@@ -17,8 +17,7 @@ const excludeNodeModulesExcept = (modules) => {
17
17
  return function(modulePath) {
18
18
  if (/node_modules/.test(modulePath)) {
19
19
  for (let i = 0; i < moduleRegExps.length; i += 1)
20
- if (moduleRegExps[i].test(modulePath))
21
- return false;
20
+ if (moduleRegExps[i].test(modulePath)) return false;
22
21
  return true;
23
22
  }
24
23
  return false;
@@ -86,8 +85,7 @@ const getUserMonitoringFileName = () => {
86
85
  process.cwd(),
87
86
  "node_modules/@elliemae/pui-user-monitoring/dist/public/js"
88
87
  );
89
- if (!fs.existsSync(userMonLibPath))
90
- return `${libName}.js`;
88
+ if (!fs.existsSync(userMonLibPath)) return `${libName}.js`;
91
89
  const distJSFiles = fs.readdirSync(userMonLibPath);
92
90
  return distJSFiles.filter(
93
91
  (fName) => fName.match(/emuiUserMonitoring+((?!chunk).)*\.js$/)
@@ -99,8 +97,7 @@ const getAppLoaderFileName = () => {
99
97
  process.cwd(),
100
98
  "node_modules/@elliemae/pui-app-loader/dist/public/js"
101
99
  );
102
- if (!fs.existsSync(appLoaderLibPath))
103
- return `${libName}.js`;
100
+ if (!fs.existsSync(appLoaderLibPath)) return `${libName}.js`;
104
101
  const distJSFiles = fs.readdirSync(appLoaderLibPath);
105
102
  return distJSFiles.filter(
106
103
  (fName) => fName.match(/emuiAppLoader+((?!chunk).)*\.js$/)
@@ -112,8 +109,7 @@ const getDiagnosticsFileName = () => {
112
109
  process.cwd(),
113
110
  "node_modules/@elliemae/pui-diagnostics/dist/public/js"
114
111
  );
115
- if (!fs.existsSync(libPath))
116
- return `${libName}.js`;
112
+ if (!fs.existsSync(libPath)) return `${libName}.js`;
117
113
  const distJSFiles = fs.readdirSync(libPath);
118
114
  return distJSFiles.filter(
119
115
  (fName) => fName.match(/emuiDiagnostics+((?!chunk).)*\.js$/)
@@ -125,16 +121,14 @@ const getENCWLoaderFileName = () => {
125
121
  process.cwd(),
126
122
  "node_modules/@elliemae/encw-loader/dist/public/js"
127
123
  );
128
- if (!fs.existsSync(appLoaderLibPath))
129
- return `${libName}.js`;
124
+ if (!fs.existsSync(appLoaderLibPath)) return `${libName}.js`;
130
125
  const distJSFiles = fs.readdirSync(appLoaderLibPath);
131
126
  return distJSFiles.filter(
132
127
  (fName) => fName.match(/emuiEncwLoader+((?!chunk).)*\.js$/)
133
128
  )[0];
134
129
  };
135
130
  const getAppVersion = () => {
136
- if (!process.env.APP_VERSION)
137
- return LATEST_VERSION;
131
+ if (!process.env.APP_VERSION) return LATEST_VERSION;
138
132
  const match = process.env.APP_VERSION.match(/^v?(\d+\.\d+)\..*$/);
139
133
  return match && match[1] || LATEST_VERSION;
140
134
  };
@@ -135,8 +135,7 @@ const devConfig = {
135
135
  createWSServer({
136
136
  port: wsPort
137
137
  }).then(({ wsServer }) => {
138
- if (devServer.app)
139
- devServer.app.locals.wsServer = wsServer;
138
+ if (devServer.app) devServer.app.locals.wsServer = wsServer;
140
139
  }).catch((err) => {
141
140
  console.error(err);
142
141
  });
@@ -109,8 +109,7 @@ const htmlWebpackPlugin = new HtmlWebpackPlugin({
109
109
  }
110
110
  });
111
111
  const config = baseConfig(getProdConfig());
112
- if (config.plugins)
113
- config.plugins.push(htmlWebpackPlugin);
112
+ if (config.plugins) config.plugins.push(htmlWebpackPlugin);
114
113
  var webpack_prod_babel_default = config;
115
114
  export {
116
115
  webpack_prod_babel_default as default
@@ -55,8 +55,7 @@ const webpackFinal = (config, { configType }) => {
55
55
  const fileLoaderRule = config?.module?.rules?.find?.(
56
56
  (rule) => rule.test?.test?.(".svg")
57
57
  );
58
- if (fileLoaderRule)
59
- fileLoaderRule.exclude = /\.svg$/i;
58
+ if (fileLoaderRule) fileLoaderRule.exclude = /\.svg$/i;
60
59
  config?.module?.rules?.unshift(...getModuleRules());
61
60
  config?.plugins?.push(...getAdditionalPlugins());
62
61
  if (isProd) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/pui-cli",
3
- "version": "8.32.0",
3
+ "version": "8.34.0",
4
4
  "description": "ICE MT UI Platform CLI",
5
5
  "sideEffects": false,
6
6
  "main": "./dist/cjs/index.cjs",
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "engines": {
45
45
  "pnpm": ">=8",
46
- "node": ">=18"
46
+ "node": ">=20"
47
47
  },
48
48
  "author": "ICE MT",
49
49
  "license": "MIT",
@@ -70,14 +70,13 @@
70
70
  "jestSonar": {
71
71
  "reportPath": "reports",
72
72
  "reportFile": "tests.xml",
73
- "indent": 4,
74
- "sonar56x": true
73
+ "indent": 4
75
74
  },
76
75
  "dependencies": {
77
- "@axe-core/react": "~4.8.5",
78
- "@babel/cli": "~7.24.1",
79
- "@babel/core": "~7.24.3",
80
- "@babel/eslint-parser": "~7.24.1",
76
+ "@axe-core/react": "~4.9.0",
77
+ "@babel/cli": "~7.24.5",
78
+ "@babel/core": "~7.24.5",
79
+ "@babel/eslint-parser": "~7.24.5",
81
80
  "@babel/node": "~7.23.9",
82
81
  "@babel/plugin-proposal-class-properties": "~7.18.6",
83
82
  "@babel/plugin-proposal-export-default-from": "~7.24.1",
@@ -88,10 +87,10 @@
88
87
  "@babel/plugin-transform-react-inline-elements": "~7.24.1",
89
88
  "@babel/plugin-transform-react-jsx-source": "~7.24.1",
90
89
  "@babel/plugin-transform-runtime": "~7.24.3",
91
- "@babel/preset-env": "~7.24.3",
90
+ "@babel/preset-env": "~7.24.5",
92
91
  "@babel/preset-react": "~7.24.1",
93
92
  "@babel/preset-typescript": "~7.24.1",
94
- "@babel/runtime": "~7.24.1",
93
+ "@babel/runtime": "~7.24.5",
95
94
  "@commitlint/cli": "~17.8.1",
96
95
  "@commitlint/config-conventional": "~17.8.1",
97
96
  "@elliemae/browserslist-config-elliemae-latest-browsers": "~1.9.0",
@@ -99,7 +98,7 @@
99
98
  "@nrwl/cli": "~15.9.7",
100
99
  "@nrwl/tao": "~15.9.7",
101
100
  "@nrwl/workspace": "~15.9.7",
102
- "@pmmmwh/react-refresh-webpack-plugin": "~0.5.11",
101
+ "@pmmmwh/react-refresh-webpack-plugin": "~0.5.13",
103
102
  "@semantic-release/changelog": "~6.0.3",
104
103
  "@semantic-release/exec": "~6.0.3",
105
104
  "@semantic-release/git": "~10.0.1",
@@ -116,11 +115,11 @@
116
115
  "@storybook/theming": "~6.5.16",
117
116
  "@stylelint/postcss-css-in-js": "~0.38.0",
118
117
  "@svgr/webpack": "~7.0.0",
119
- "@swc/cli": "~0.3.10",
120
- "@swc/core": "~1.4.8",
118
+ "@swc/cli": "~0.3.12",
119
+ "@swc/core": "~1.5.3",
121
120
  "@swc/jest": "~0.2.36",
122
121
  "@testing-library/jest-dom": "~5.17.0",
123
- "@testing-library/react": "~14.2.2",
122
+ "@testing-library/react": "~14.3.1",
124
123
  "@testing-library/react-hooks": "~8.0.1",
125
124
  "@testing-library/user-event": "~14.5.2",
126
125
  "@types/circular-dependency-plugin": "~5.0.8",
@@ -131,7 +130,7 @@
131
130
  "@types/jest": "~29.5.12",
132
131
  "@types/jest-axe": "~3.5.9",
133
132
  "@types/moment-locales-webpack-plugin": "~1.2.6",
134
- "@types/node": "~18.19.26",
133
+ "@types/node": "~18.19.32",
135
134
  "@types/normalize-path": "~3.0.2",
136
135
  "@types/postcss-preset-env": "~7.7.0",
137
136
  "@types/rimraf": "~3.0.2",
@@ -146,12 +145,12 @@
146
145
  "@vitest/coverage-c8": "~0.33.0",
147
146
  "@vitest/coverage-v8": "~0.34.6",
148
147
  "autoprefixer": "~10.4.19",
149
- "axe-core": "~4.8.4",
148
+ "axe-core": "~4.9.1",
150
149
  "babel-plugin-date-fns": "~2.0.0",
151
150
  "babel-plugin-dynamic-import-node": "~2.3.3",
152
151
  "babel-plugin-import-remove-resource-query": "~1.0.0",
153
152
  "babel-plugin-lodash": "~3.3.4",
154
- "babel-plugin-module-resolver": "~5.0.0",
153
+ "babel-plugin-module-resolver": "~5.0.2",
155
154
  "babel-plugin-source-map-support": "~2.2.0",
156
155
  "babel-plugin-styled-components": "~2.1.4",
157
156
  "babel-plugin-transform-react-remove-prop-types": "~0.4.24",
@@ -167,15 +166,15 @@
167
166
  "copy-webpack-plugin": "~11.0.0",
168
167
  "cors": "~2.8.5",
169
168
  "cross-env": "~7.0.3",
170
- "css-loader": "~6.10.0",
169
+ "css-loader": "~6.11.0",
171
170
  "css-minimizer-webpack-plugin": "~5.0.1",
172
171
  "depcheck": "~1.4.7",
173
172
  "docdash": "~2.0.2",
174
173
  "dotenv": "~16.4.5",
175
174
  "dotenv-webpack": "~8.1.0",
176
175
  "duplicate-package-checker-webpack-plugin": "~3.0.0",
177
- "enhanced-resolve": "5.16.0",
178
- "esbuild": "~0.20.2",
176
+ "enhanced-resolve": "~5.16.1",
177
+ "esbuild": "~0.21.1",
179
178
  "esbuild-loader": "~3.2.0",
180
179
  "esbuild-plugin-svgr": "~1.1.0",
181
180
  "eslint": "~8.57.0",
@@ -196,13 +195,13 @@
196
195
  "eslint-plugin-mdx": "~2.3.4",
197
196
  "eslint-plugin-prettier": "~4.2.1",
198
197
  "eslint-plugin-react": "~7.34.1",
199
- "eslint-plugin-react-hooks": "~4.6.0",
198
+ "eslint-plugin-react-hooks": "~4.6.2",
200
199
  "eslint-plugin-redux-saga": "~1.3.2",
201
200
  "eslint-plugin-storybook": "~0.8.0",
202
201
  "eslint-plugin-testing-library": "~5.11.1",
203
202
  "eslint-plugin-wdio": "~8.24.12",
204
203
  "execa": "~7.2.0",
205
- "express": "~4.19.1",
204
+ "express": "~4.19.2",
206
205
  "express-static-gzip": "~2.1.7",
207
206
  "fast-glob": "~3.3.2",
208
207
  "favicons": "~7.2.0",
@@ -225,10 +224,10 @@
225
224
  "jest-styled-components": "~7.2.0",
226
225
  "jest-watch-typeahead": "~2.2.2",
227
226
  "jscodeshift": "~0.15.2",
228
- "jsdoc": "~4.0.2",
227
+ "jsdoc": "~4.0.3",
229
228
  "lerna": "~6.6.2",
230
229
  "lint-staged": "~13.3.0",
231
- "mini-css-extract-plugin": "~2.8.1",
230
+ "mini-css-extract-plugin": "~2.9.0",
232
231
  "minimist": "~1.2.8",
233
232
  "moment": "~2.30.1",
234
233
  "moment-locales-webpack-plugin": "~1.2.0",
@@ -237,9 +236,9 @@
237
236
  "node-plop": "~0.32.0",
238
237
  "nodemon": "~2.0.22",
239
238
  "normalize-path": "~3.0.0",
240
- "npm-check-updates": "16.14.17",
239
+ "npm-check-updates": "~16.14.20",
241
240
  "npm-run-all": "~4.1.5",
242
- "pino": "~8.19.0",
241
+ "pino": "~8.21.0",
243
242
  "pino-http": "~8.6.1",
244
243
  "pino-pretty": "~10.3.1",
245
244
  "plop": "~3.1.2",
@@ -256,8 +255,8 @@
256
255
  "pug-loader": "~2.4.0",
257
256
  "raf": "~3.4.1",
258
257
  "react-docgen": "~5.4.3",
259
- "react-refresh": "~0.14.0",
260
- "react-test-renderer": "~18.2.0",
258
+ "react-refresh": "~0.14.2",
259
+ "react-test-renderer": "~18.3.1",
261
260
  "resize-observer-polyfill": "~1.5.1",
262
261
  "resolve-typescript-plugin": "~2.0.1",
263
262
  "rimraf": "5.0.5",
@@ -275,30 +274,30 @@
275
274
  "tsconfig-paths-webpack-plugin": "~3.5.2",
276
275
  "ts-node": "~10.9.2",
277
276
  "tsc-alias": "~1.8.8",
278
- "tsx": "~3.13.0",
279
- "typedoc": "~0.25.12",
280
- "typescript": "~5.4.3",
277
+ "tsx": "~3.14.0",
278
+ "typedoc": "~0.25.13",
279
+ "typescript": "~5.4.5",
281
280
  "update-notifier": "~6.0.2",
282
281
  "url-loader": "~4.1.1",
283
282
  "uuid": "~9.0.1",
284
- "vite": "~5.2.3",
283
+ "vite": "~5.2.11",
285
284
  "vite-tsconfig-paths": "~4.3.2",
286
- "vitest": "~1.4.0",
285
+ "vitest": "~1.6.0",
287
286
  "webpack": "~5.91.0",
288
- "webpack-bundle-analyzer": "~4.10.1",
287
+ "webpack-bundle-analyzer": "~4.10.2",
289
288
  "webpack-cli": "~5.1.4",
290
289
  "webpack-dev-server": "~4.15.2",
291
290
  "webpack-manifest-plugin": "~5.0.0",
292
291
  "webpack-merge": "~5.10.0",
293
292
  "whatwg-fetch": "~3.6.20",
294
293
  "workbox-webpack-plugin": "~6.6.0",
295
- "ws": "~8.16.0",
294
+ "ws": "~8.17.0",
296
295
  "yargs": "~17.7.2"
297
296
  },
298
297
  "devDependencies": {
299
298
  "@elliemae/pui-doc-gen": "~2.0.1",
300
- "react": "~18.2.0",
301
- "react-dom": "~18.2.0",
299
+ "react": "~18.3.1",
300
+ "react-dom": "~18.3.1",
302
301
  "redux": "~4.2.1",
303
302
  "redux-saga": "~1.3.0",
304
303
  "styled-components": "~5.3.11"