@elliemae/pui-cli 7.0.0-alpha.4 → 7.0.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +19 -0
- package/dist/cjs/monorepo/set-registry-version.js +1 -1
- package/dist/cjs/monorepo/set-workspace-version.js +1 -1
- package/dist/cjs/monorepo/utils.cjs +30 -0
- package/dist/cjs/server/index.js +1 -1
- package/dist/cjs/server/{middlewares/index.js → middlewares.js} +18 -7
- package/dist/cjs/server/util/app-routes.cjs +10 -0
- package/dist/cjs/server/util/index.js +2 -8
- package/dist/cjs/testing/jest.config.cjs +10 -13
- package/dist/cjs/testing/mocks/axios.js +37 -0
- package/dist/cjs/testing/mocks/cssModule.js +23 -0
- package/dist/cjs/testing/mocks/html.js +23 -0
- package/dist/cjs/testing/mocks/image.js +23 -0
- package/dist/cjs/testing/mocks/matchMedia.js +43 -0
- package/dist/cjs/testing/mocks/pui-app-loader.js +24 -0
- package/dist/cjs/testing/mocks/pui-diagnostics.js +68 -0
- package/dist/cjs/testing/mocks/pui-user-monitoring.js +30 -0
- package/dist/cjs/testing/mocks/retry-axios.js +27 -0
- package/dist/cjs/{monorepo/utils.js → testing/mocks/svg.js} +8 -13
- package/dist/cjs/testing/mocks/webpack-hmr.js +24 -0
- package/dist/cjs/testing/setup-tests.js +3 -3
- package/dist/cjs/transpile/.swcrc +11 -0
- package/dist/cjs/transpile/esbuild.js +1 -0
- package/dist/cjs/webpack/helpers.js +1 -1
- package/dist/cjs/webpack/webpack.base.babel.js +2 -2
- package/dist/cjs/webpack/webpack.dev.babel.js +8 -4
- package/dist/cjs/webpack/webpack.prod.babel.js +2 -2
- package/dist/esm/index.cjs +19 -0
- package/dist/esm/monorepo/set-registry-version.js +1 -1
- package/dist/esm/monorepo/set-workspace-version.js +1 -1
- package/dist/esm/monorepo/utils.cjs +30 -0
- package/dist/esm/server/index.js +1 -1
- package/dist/esm/server/middlewares.js +46 -0
- package/dist/esm/server/util/app-routes.cjs +10 -0
- package/dist/esm/server/util/index.js +2 -8
- package/dist/esm/testing/jest.config.cjs +10 -13
- package/dist/esm/testing/mocks/{axios.cjs → axios.js} +8 -5
- package/dist/esm/testing/mocks/cssModule.js +4 -0
- package/dist/esm/testing/mocks/html.js +4 -0
- package/dist/esm/testing/mocks/image.js +4 -0
- package/dist/esm/testing/mocks/matchMedia.js +24 -0
- package/dist/esm/testing/mocks/pui-app-loader.js +5 -0
- package/dist/esm/testing/mocks/pui-diagnostics.js +49 -0
- package/dist/esm/testing/mocks/pui-user-monitoring.js +11 -0
- package/dist/esm/testing/mocks/retry-axios.js +8 -0
- package/dist/esm/testing/mocks/svg.js +7 -0
- package/dist/esm/testing/mocks/webpack-hmr.js +5 -0
- package/dist/esm/testing/setup-tests.js +2 -2
- package/dist/esm/transpile/.swcrc +11 -0
- package/dist/esm/transpile/esbuild.js +1 -0
- package/dist/esm/webpack/helpers.js +1 -1
- package/dist/esm/webpack/webpack.base.babel.js +3 -3
- package/dist/esm/webpack/webpack.dev.babel.js +7 -4
- package/dist/esm/webpack/webpack.prod.babel.js +2 -2
- package/dist/types/index.d.cts +9 -0
- package/dist/types/monorepo/utils.d.cts +1 -0
- package/dist/types/server/{middlewares/index.d.ts → middlewares.d.ts} +1 -1
- package/dist/types/server/util/app-routes.d.cts +1 -0
- package/dist/types/testing/jest.config.d.cts +1 -1
- package/dist/types/testing/jest.node.config.d.cts +1 -1
- package/dist/types/testing/mocks/axios.d.ts +17 -0
- package/dist/types/testing/mocks/cssModule.d.ts +2 -0
- package/dist/types/testing/mocks/html.d.ts +2 -0
- package/dist/types/testing/mocks/image.d.ts +2 -0
- package/dist/types/testing/mocks/matchMedia.d.ts +1 -0
- package/dist/types/testing/mocks/{pui-app-loader.d.cts → pui-app-loader.d.ts} +0 -0
- package/dist/types/testing/mocks/{pui-diagnostics.d.cts → pui-diagnostics.d.ts} +0 -0
- package/dist/types/testing/mocks/{pui-user-monitoring.d.cts → pui-user-monitoring.d.ts} +0 -0
- package/dist/types/testing/mocks/{retry-axios.d.cts → retry-axios.d.ts} +0 -0
- package/dist/types/testing/mocks/{svg.d.cts → svg.d.ts} +0 -0
- package/dist/types/testing/mocks/{webpack-hmr.d.cts → webpack-hmr.d.ts} +0 -0
- package/dist/types/webpack/webpack.dev.babel.d.ts +2 -1
- package/package.json +9 -8
- package/dist/cjs/server/middlewares/addProdMiddlewares.js +0 -44
- package/dist/cjs/testing/mocks/axios.cjs +0 -15
- package/dist/cjs/testing/mocks/cssModule.cjs +0 -1
- package/dist/cjs/testing/mocks/html.cjs +0 -1
- package/dist/cjs/testing/mocks/image.cjs +0 -1
- package/dist/cjs/testing/mocks/matchMedia.cjs +0 -24
- package/dist/cjs/testing/mocks/pui-app-loader.cjs +0 -1
- package/dist/cjs/testing/mocks/pui-diagnostics.cjs +0 -28
- package/dist/cjs/testing/mocks/pui-user-monitoring.cjs +0 -3
- package/dist/cjs/testing/mocks/retry-axios.cjs +0 -3
- package/dist/cjs/testing/mocks/svg.cjs +0 -5
- package/dist/cjs/testing/mocks/webpack-hmr.cjs +0 -1
- package/dist/esm/monorepo/utils.js +0 -12
- package/dist/esm/server/middlewares/addProdMiddlewares.js +0 -22
- package/dist/esm/server/middlewares/index.js +0 -35
- package/dist/esm/testing/mocks/cssModule.cjs +0 -1
- package/dist/esm/testing/mocks/html.cjs +0 -1
- package/dist/esm/testing/mocks/image.cjs +0 -1
- package/dist/esm/testing/mocks/matchMedia.cjs +0 -24
- package/dist/esm/testing/mocks/pui-app-loader.cjs +0 -1
- package/dist/esm/testing/mocks/pui-diagnostics.cjs +0 -28
- package/dist/esm/testing/mocks/pui-user-monitoring.cjs +0 -3
- package/dist/esm/testing/mocks/retry-axios.cjs +0 -3
- package/dist/esm/testing/mocks/svg.cjs +0 -5
- package/dist/esm/testing/mocks/webpack-hmr.cjs +0 -1
- package/dist/types/monorepo/utils.d.ts +0 -1
- package/dist/types/server/middlewares/addProdMiddlewares.d.ts +0 -1
- package/dist/types/testing/mocks/axios.d.cts +0 -14
- package/dist/types/testing/mocks/cssModule.d.cts +0 -2
- package/dist/types/testing/mocks/html.d.cts +0 -2
- package/dist/types/testing/mocks/image.d.cts +0 -2
- package/dist/types/testing/mocks/matchMedia.d.cts +0 -2
|
@@ -20,20 +20,23 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
20
20
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
21
|
var webpack_dev_babel_exports = {};
|
|
22
22
|
__export(webpack_dev_babel_exports, {
|
|
23
|
-
|
|
23
|
+
default: () => webpack_dev_babel_default
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(webpack_dev_babel_exports);
|
|
26
26
|
var import_node_path = __toESM(require("node:path"), 1);
|
|
27
|
+
var import_node_url = require("node:url");
|
|
27
28
|
var import_html_webpack_plugin = __toESM(require("html-webpack-plugin"), 1);
|
|
28
29
|
var import_circular_dependency_plugin = __toESM(require("circular-dependency-plugin"), 1);
|
|
29
30
|
var import_mini_css_extract_plugin = __toESM(require("mini-css-extract-plugin"), 1);
|
|
30
31
|
var import_react_refresh_webpack_plugin = __toESM(require("@pmmmwh/react-refresh-webpack-plugin"), 1);
|
|
31
32
|
var import_speed_measure_webpack_plugin = __toESM(require("speed-measure-webpack-plugin"), 1);
|
|
32
33
|
var import_express_static_gzip = __toESM(require("express-static-gzip"), 1);
|
|
33
|
-
var import_middlewares = require("../server/middlewares
|
|
34
|
+
var import_middlewares = require("../server/middlewares.js");
|
|
34
35
|
var import_util = require("../server/util/index.js");
|
|
35
36
|
var import_helpers = require("./helpers.js");
|
|
36
|
-
var import_webpack_base_babel =
|
|
37
|
+
var import_webpack_base_babel = require("./webpack.base.babel.js");
|
|
38
|
+
const import_meta = {};
|
|
39
|
+
const __filename = (0, import_node_url.fileURLToPath)(import_meta.url);
|
|
37
40
|
const smp = new import_speed_measure_webpack_plugin.default({ disable: !process.env.MEASURE });
|
|
38
41
|
const {
|
|
39
42
|
appVersion,
|
|
@@ -132,5 +135,6 @@ const devConfig = {
|
|
|
132
135
|
}
|
|
133
136
|
}
|
|
134
137
|
};
|
|
135
|
-
const config = smp.wrap((0, import_webpack_base_babel.
|
|
138
|
+
const config = smp.wrap((0, import_webpack_base_babel.baseConfig)(devConfig));
|
|
136
139
|
config.plugins = config.plugins.concat([new import_react_refresh_webpack_plugin.default({})]);
|
|
140
|
+
var webpack_dev_babel_default = config;
|
|
@@ -31,7 +31,7 @@ var import_webpack_bundle_analyzer = require("webpack-bundle-analyzer");
|
|
|
31
31
|
var import_esbuild_loader = require("esbuild-loader");
|
|
32
32
|
var import_speed_measure_webpack_plugin = __toESM(require("speed-measure-webpack-plugin"), 1);
|
|
33
33
|
var import_browserslist_to_esbuild = __toESM(require("browserslist-to-esbuild"), 1);
|
|
34
|
-
var import_webpack_base_babel =
|
|
34
|
+
var import_webpack_base_babel = require("./webpack.base.babel.js");
|
|
35
35
|
var import_helpers = require("./helpers.js");
|
|
36
36
|
const getProdConfig = ({ latestVersion = true } = {}) => {
|
|
37
37
|
const { buildPath } = (0, import_helpers.getPaths)(latestVersion);
|
|
@@ -124,7 +124,7 @@ const htmlWebpackPlugin = new import_html_webpack_plugin.default({
|
|
|
124
124
|
googleTagManager: (0, import_helpers.isGoogleTagManagerEnabled)()
|
|
125
125
|
}
|
|
126
126
|
});
|
|
127
|
-
const config = (0, import_webpack_base_babel.
|
|
127
|
+
const config = (0, import_webpack_base_babel.baseConfig)(getProdConfig());
|
|
128
128
|
config.plugins.push(htmlWebpackPlugin);
|
|
129
129
|
const addSMPPlugin = (webpackConfig) => {
|
|
130
130
|
const smpConfig = new import_speed_measure_webpack_plugin.default({
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const { babelConfig } = require('./babel/babel.config.cjs');
|
|
2
|
+
const { esConfig: eslintBaseConfig } = require('./lint/eslint/non-react.cjs');
|
|
3
|
+
const { esReactConfig: eslintConfig } = require('./lint/eslint/react.cjs');
|
|
4
|
+
const { stylelintConfig } = require('./lint/stylelint.config.cjs');
|
|
5
|
+
const { prettierConfig } = require('./lint/prettier.config.cjs');
|
|
6
|
+
const { commitlintConfig } = require('./lint/commitlint.config.cjs');
|
|
7
|
+
const { jestConfig } = require('./testing/jest.config.cjs');
|
|
8
|
+
const { jestNodeConfig } = require('./testing/jest.node.config.cjs');
|
|
9
|
+
|
|
10
|
+
module.exports = {
|
|
11
|
+
babelConfig,
|
|
12
|
+
eslintBaseConfig,
|
|
13
|
+
eslintConfig,
|
|
14
|
+
stylelintConfig,
|
|
15
|
+
prettierConfig,
|
|
16
|
+
commitlintConfig,
|
|
17
|
+
jestConfig,
|
|
18
|
+
jestNodeConfig,
|
|
19
|
+
};
|
|
@@ -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.
|
|
4
|
+
import { findMonoRepoRoot } from "./utils.cjs";
|
|
5
5
|
const monorepoRoot = normalizePath(findMonoRepoRoot() || "");
|
|
6
6
|
const setRegistryVersion = async () => {
|
|
7
7
|
const files = await fg([
|
|
@@ -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.
|
|
4
|
+
import { findMonoRepoRoot } from "./utils.cjs";
|
|
5
5
|
const monorepoRoot = normalizePath(findMonoRepoRoot() || "");
|
|
6
6
|
const setWorkspaceVersion = async () => {
|
|
7
7
|
const files = await fg([
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
const path = require('path');
|
|
2
|
+
const { execSync } = require('child_process');
|
|
3
|
+
|
|
4
|
+
const WORKSPACE_DIR_ENV_VAR = 'NPM_CONFIG_WORKSPACE_DIR';
|
|
5
|
+
const WORKSPACE_MANIFEST_FILENAME = 'pnpm-workspace.yaml';
|
|
6
|
+
|
|
7
|
+
const getPNPMWorkspaceLocation = (cwd) => {
|
|
8
|
+
let location = null;
|
|
9
|
+
const findUpExec = path.resolve(process.cwd(), path.join('node_modules', '.bin', `find-up${process.platform === 'win32' ? '.cmd' : ''}`));
|
|
10
|
+
for (const fileName of [WORKSPACE_MANIFEST_FILENAME, 'pnpm-workspace.yml']){
|
|
11
|
+
try {
|
|
12
|
+
const result = execSync(`${findUpExec} ${fileName}`, { cwd });
|
|
13
|
+
location = result.toString().trim();
|
|
14
|
+
break;
|
|
15
|
+
} catch (err) {
|
|
16
|
+
// ignore
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
return location;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
exports.findMonoRepoRoot = (cwd = process.cwd()) => {
|
|
23
|
+
const workspaceManifestDirEnvVar =
|
|
24
|
+
process.env[WORKSPACE_DIR_ENV_VAR] ??
|
|
25
|
+
process.env[WORKSPACE_DIR_ENV_VAR.toLowerCase()];
|
|
26
|
+
const workspaceManifestLocation = workspaceManifestDirEnvVar
|
|
27
|
+
? path.join(workspaceManifestDirEnvVar, 'pnpm-workspace.yaml')
|
|
28
|
+
: getPNPMWorkspaceLocation(cwd);
|
|
29
|
+
return workspaceManifestLocation && path.dirname(workspaceManifestLocation);
|
|
30
|
+
};
|
package/dist/esm/server/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { logger } from "./logger.js";
|
|
|
3
3
|
import {
|
|
4
4
|
setupDefaultMiddlewares,
|
|
5
5
|
setupAdditionalMiddlewars
|
|
6
|
-
} from "./middlewares
|
|
6
|
+
} from "./middlewares.js";
|
|
7
7
|
import { loadRoutes, port, host } from "./util/index.js";
|
|
8
8
|
const app = express();
|
|
9
9
|
setupDefaultMiddlewares(app);
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import express from "express";
|
|
2
|
+
import cors from "cors";
|
|
3
|
+
import compression from "compression";
|
|
4
|
+
import expressStaticGzip from "express-static-gzip";
|
|
5
|
+
import expressPinoLogger from "express-pino-logger";
|
|
6
|
+
import { csp, sendFileWithCSPNonce } from "./csp.js";
|
|
7
|
+
import { getPaths } from "../webpack/helpers.js";
|
|
8
|
+
const paths = getPaths();
|
|
9
|
+
const setupDefaultMiddlewares = (app) => {
|
|
10
|
+
const pino = expressPinoLogger({
|
|
11
|
+
transport: {
|
|
12
|
+
target: "pino-pretty",
|
|
13
|
+
options: {
|
|
14
|
+
colorize: true
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
pino.logger.level = "warn";
|
|
19
|
+
app.use(pino);
|
|
20
|
+
app.use(cors());
|
|
21
|
+
app.options("*", cors());
|
|
22
|
+
csp(app);
|
|
23
|
+
app.use(express.urlencoded({ extended: false }));
|
|
24
|
+
app.use(express.text({ type: "text/plain" }));
|
|
25
|
+
app.use(express.json({ type: "application/json" }));
|
|
26
|
+
app.use(express.json({ type: "application/csp-report" }));
|
|
27
|
+
};
|
|
28
|
+
const setupAdditionalMiddlewars = (app, options = {}) => {
|
|
29
|
+
const { buildPath = paths.buildPath, basePath = paths.basePath } = options;
|
|
30
|
+
app.use(compression());
|
|
31
|
+
app.get(basePath, (req, res) => {
|
|
32
|
+
sendFileWithCSPNonce({ buildPath, res });
|
|
33
|
+
});
|
|
34
|
+
app.use(basePath, expressStaticGzip(buildPath, {
|
|
35
|
+
index: false,
|
|
36
|
+
enableBrotli: true,
|
|
37
|
+
orderPreference: ["br"]
|
|
38
|
+
}));
|
|
39
|
+
app.use(expressStaticGzip("cdn"));
|
|
40
|
+
app.get("*", (req, res) => sendFileWithCSPNonce({ buildPath, res }));
|
|
41
|
+
return app;
|
|
42
|
+
};
|
|
43
|
+
export {
|
|
44
|
+
setupAdditionalMiddlewars,
|
|
45
|
+
setupDefaultMiddlewares
|
|
46
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
exports.initRoute = (routeFile, app) => {
|
|
2
|
+
// eslint-disable-next-line global-require
|
|
3
|
+
const init = require(routeFile);
|
|
4
|
+
try {
|
|
5
|
+
init(app);
|
|
6
|
+
} catch (err) {
|
|
7
|
+
// eslint-disable-next-line no-console
|
|
8
|
+
console.error(`unable to load routes from ${routeFile}. ${err.message}`);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import minimist from "minimist";
|
|
4
|
+
import { initRoute } from "./app-routes.cjs";
|
|
4
5
|
const argv = minimist(process.argv.slice(2));
|
|
5
6
|
const getCWD = () => process.cwd();
|
|
6
7
|
const allJS = /\.js$/;
|
|
@@ -27,14 +28,7 @@ const loadRoutes = (app) => {
|
|
|
27
28
|
const routeFiles = getServerRouteFiles(path.join(getCWD(), "server/routes"));
|
|
28
29
|
routeFiles.push(...getServiceEndpoints(path.join(getCWD(), "app")));
|
|
29
30
|
routeFiles.push(...getServiceEndpoints(path.join(getCWD(), "lib")));
|
|
30
|
-
routeFiles.forEach(
|
|
31
|
-
const init = await import(routeFile);
|
|
32
|
-
try {
|
|
33
|
-
init(app);
|
|
34
|
-
} catch (err) {
|
|
35
|
-
console.error(`unable to load routes from ${routeFile}. ${err.message}`);
|
|
36
|
-
}
|
|
37
|
-
});
|
|
31
|
+
routeFiles.forEach((routeFile) => initRoute(routeFile, app));
|
|
38
32
|
};
|
|
39
33
|
const port = parseInt(argv.port || process.env.port || process.env.PORT || "3000", 10);
|
|
40
34
|
const host = argv.host || process.env.HOST;
|
|
@@ -2,11 +2,7 @@ const path = require('path');
|
|
|
2
2
|
const normalizePath = require('normalize-path');
|
|
3
3
|
const { getAppConfig, basePath } = require('../utils.cjs');
|
|
4
4
|
const { swcrcConfig } = require('../transpile/swcrc.config.cjs');
|
|
5
|
-
|
|
6
|
-
let monorepoRoot = null;
|
|
7
|
-
import('../monorepo/utils.js').then(({ findMonoRepoRoot }) => {
|
|
8
|
-
monorepoRoot = findMonoRepoRoot(process.cwd());
|
|
9
|
-
}).catch((ex) => console.error('Error loading monorepo utils:', ex));
|
|
5
|
+
const { findMonoRepoRoot } = require('../monorepo/utils.cjs');
|
|
10
6
|
|
|
11
7
|
let isReactModule = true;
|
|
12
8
|
try {
|
|
@@ -22,6 +18,7 @@ const getMockFilePath = (fileName) =>
|
|
|
22
18
|
normalizePath(path.resolve(__dirname, './mocks', fileName));
|
|
23
19
|
|
|
24
20
|
const getNodeModulesPath = (fileName) => {
|
|
21
|
+
const monorepoRoot = findMonoRepoRoot(process.cwd());
|
|
25
22
|
return normalizePath(
|
|
26
23
|
monorepoRoot
|
|
27
24
|
? path.join(monorepoRoot, 'node_modules', fileName)
|
|
@@ -60,15 +57,15 @@ const jestConfig = {
|
|
|
60
57
|
coverageReporters: ['lcov', 'html', 'text-summary'],
|
|
61
58
|
moduleDirectories: ['node_modules', 'app', 'lib'],
|
|
62
59
|
moduleNameMapper: {
|
|
63
|
-
'.*\\webpack-hmr(.[t|j]s)?$': getMockFilePath('webpack-hmr.
|
|
64
|
-
'.*\\.(css|scss)$': getMockFilePath('cssModule.
|
|
60
|
+
'.*\\webpack-hmr(.[t|j]s)?$': getMockFilePath('webpack-hmr.js'),
|
|
61
|
+
'.*\\.(css|scss)$': getMockFilePath('cssModule.js'),
|
|
65
62
|
'.*\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|ico)$':
|
|
66
|
-
getMockFilePath('image.
|
|
67
|
-
'.*\\.svg(?:\\?[a-zA-Z]+)?$': getMockFilePath('svg.
|
|
68
|
-
'.*\\.html
|
|
69
|
-
'@elliemae/pui-user-monitoring': getMockFilePath('pui-user-monitoring.
|
|
70
|
-
'@elliemae/pui-app-loader': getMockFilePath('pui-app-loader.
|
|
71
|
-
'@elliemae/pui-diagnostics': getMockFilePath('pui-diagnostics.
|
|
63
|
+
getMockFilePath('image.js'),
|
|
64
|
+
'.*\\.svg(?:\\?[a-zA-Z]+)?$': getMockFilePath('svg.js'),
|
|
65
|
+
'.*\\.html(?:\\?[a-zA-Z]+)?$': getMockFilePath('html.js'),
|
|
66
|
+
'@elliemae/pui-user-monitoring': getMockFilePath('pui-user-monitoring.js'),
|
|
67
|
+
'@elliemae/pui-app-loader': getMockFilePath('pui-app-loader.js'),
|
|
68
|
+
'@elliemae/pui-diagnostics': getMockFilePath('pui-diagnostics.js'),
|
|
72
69
|
'react-spring/web': getNodeModulesPath('react-spring/web.cjs.js'),
|
|
73
70
|
'react-spring/renderprops': getNodeModulesPath(
|
|
74
71
|
'react-spring/renderprops.cjs.js',
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
var axios_default = {
|
|
2
2
|
defaults: {},
|
|
3
3
|
interceptors: {
|
|
4
4
|
request: {
|
|
5
|
-
use: jest.fn()
|
|
5
|
+
use: jest.fn()
|
|
6
6
|
},
|
|
7
7
|
response: {
|
|
8
|
-
use: jest.fn()
|
|
9
|
-
}
|
|
8
|
+
use: jest.fn()
|
|
9
|
+
}
|
|
10
10
|
},
|
|
11
11
|
create: jest.fn().mockReturnThis(),
|
|
12
12
|
get: jest.fn().mockResolvedValue({ data: {} }),
|
|
13
13
|
post: jest.fn().mockResolvedValue({ data: {} }),
|
|
14
|
-
put: jest.fn().mockResolvedValue({ data: {} })
|
|
14
|
+
put: jest.fn().mockResolvedValue({ data: {} })
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
axios_default as default
|
|
15
18
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const addMatchMedia = () => {
|
|
2
|
+
Object.defineProperty(window, "matchMedia", {
|
|
3
|
+
writable: true,
|
|
4
|
+
value: jest.fn().mockImplementation((query) => ({
|
|
5
|
+
matches: false,
|
|
6
|
+
media: query,
|
|
7
|
+
onchange: null,
|
|
8
|
+
addListener: jest.fn(),
|
|
9
|
+
removeListener: jest.fn(),
|
|
10
|
+
addEventListener: jest.fn(),
|
|
11
|
+
removeEventListener: jest.fn(),
|
|
12
|
+
dispatchEvent: jest.fn()
|
|
13
|
+
}))
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(window, "getComputedStyle", {
|
|
16
|
+
value: () => ({
|
|
17
|
+
getPropertyValue: () => {
|
|
18
|
+
}
|
|
19
|
+
})
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
addMatchMedia
|
|
24
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const logger = () => ({
|
|
2
|
+
setLogLevel() {
|
|
3
|
+
},
|
|
4
|
+
setOptions() {
|
|
5
|
+
},
|
|
6
|
+
info() {
|
|
7
|
+
},
|
|
8
|
+
warn() {
|
|
9
|
+
},
|
|
10
|
+
error() {
|
|
11
|
+
},
|
|
12
|
+
trace() {
|
|
13
|
+
},
|
|
14
|
+
debug() {
|
|
15
|
+
},
|
|
16
|
+
audit() {
|
|
17
|
+
},
|
|
18
|
+
fatal() {
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
const LogLevel = {
|
|
22
|
+
info: "info",
|
|
23
|
+
debug: "debug",
|
|
24
|
+
trace: "trace",
|
|
25
|
+
warn: "warn",
|
|
26
|
+
error: "error",
|
|
27
|
+
audit: "audit",
|
|
28
|
+
fatal: "fatal"
|
|
29
|
+
};
|
|
30
|
+
const Console = () => ({
|
|
31
|
+
log: () => {
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
const http = () => ({
|
|
35
|
+
log() {
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
const webvitals = () => {
|
|
39
|
+
};
|
|
40
|
+
const logUnhandledErrors = () => {
|
|
41
|
+
};
|
|
42
|
+
export {
|
|
43
|
+
Console,
|
|
44
|
+
LogLevel,
|
|
45
|
+
http,
|
|
46
|
+
logUnhandledErrors,
|
|
47
|
+
logger,
|
|
48
|
+
webvitals
|
|
49
|
+
};
|
|
@@ -3,8 +3,8 @@ import "regenerator-runtime/runtime";
|
|
|
3
3
|
import "@testing-library/jest-dom/extend-expect";
|
|
4
4
|
import jestAxe from "jest-axe";
|
|
5
5
|
import ResizeObserver from "resize-observer-polyfill";
|
|
6
|
-
import addMatchMedia from "./mocks/matchMedia.
|
|
7
|
-
import { logger } from "./mocks/pui-diagnostics.
|
|
6
|
+
import { addMatchMedia } from "./mocks/matchMedia.js";
|
|
7
|
+
import { logger } from "./mocks/pui-diagnostics.js";
|
|
8
8
|
const originalError = console.error;
|
|
9
9
|
console.error = (...args) => {
|
|
10
10
|
const ignoreList = [
|
|
@@ -48,6 +48,7 @@ const getCommonConfig = ({ injectReactShim }) => ({
|
|
|
48
48
|
const copyFiles = async ({ srcdir, outdir }) => {
|
|
49
49
|
const files = await fg([
|
|
50
50
|
`${srcdir}/**/*.*`,
|
|
51
|
+
`${srcdir}/**/.swcrc`,
|
|
51
52
|
`!${srcdir}/**/*.{js,jsx,ts,tsx,mjs}`
|
|
52
53
|
]);
|
|
53
54
|
await Promise.all(files.map(async (srcFilePath) => {
|
|
@@ -22,7 +22,7 @@ import fs from "node:fs";
|
|
|
22
22
|
import _ from "lodash";
|
|
23
23
|
import CompressionPlugin from "compression-webpack-plugin";
|
|
24
24
|
import zlib from "zlib";
|
|
25
|
-
import { findMonoRepoRoot } from "../monorepo/utils.
|
|
25
|
+
import { findMonoRepoRoot } from "../monorepo/utils.cjs";
|
|
26
26
|
import { basePath, getAppConfig } from "../utils.cjs";
|
|
27
27
|
let pathSep = path.sep;
|
|
28
28
|
if (pathSep === "\\")
|
|
@@ -15,7 +15,7 @@ var __spreadValues = (a, b) => {
|
|
|
15
15
|
return a;
|
|
16
16
|
};
|
|
17
17
|
import path from "node:path";
|
|
18
|
-
import webpack
|
|
18
|
+
import webpack from "webpack";
|
|
19
19
|
import MiniCssExtractPlugin from "mini-css-extract-plugin";
|
|
20
20
|
import PostcssPresetEnv from "postcss-preset-env";
|
|
21
21
|
import CopyWebpackPlugin from "copy-webpack-plugin";
|
|
@@ -43,7 +43,7 @@ const plugins = [
|
|
|
43
43
|
NODE_ENV: "development",
|
|
44
44
|
CI: "false"
|
|
45
45
|
}),
|
|
46
|
-
new ProvidePlugin({
|
|
46
|
+
new webpack.ProvidePlugin({
|
|
47
47
|
React: "react"
|
|
48
48
|
}),
|
|
49
49
|
new CopyWebpackPlugin({
|
|
@@ -127,7 +127,7 @@ const plugins = [
|
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
}),
|
|
130
|
-
new ProgressPlugin()
|
|
130
|
+
new webpack.ProgressPlugin()
|
|
131
131
|
];
|
|
132
132
|
const baseConfig = (options) => ({
|
|
133
133
|
mode: options.mode,
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
2
3
|
import HtmlWebpackPlugin from "html-webpack-plugin";
|
|
3
4
|
import CircularDependencyPlugin from "circular-dependency-plugin";
|
|
4
5
|
import MiniCssExtractPlugin from "mini-css-extract-plugin";
|
|
5
6
|
import ReactRefreshWebpackPlugin from "@pmmmwh/react-refresh-webpack-plugin";
|
|
6
7
|
import SpeedMeasurePlugin from "speed-measure-webpack-plugin";
|
|
7
8
|
import expressStaticGzip from "express-static-gzip";
|
|
8
|
-
import { setupDefaultMiddlewares } from "../server/middlewares
|
|
9
|
+
import { setupDefaultMiddlewares } from "../server/middlewares.js";
|
|
9
10
|
import { loadRoutes } from "../server/util/index.js";
|
|
10
11
|
import {
|
|
11
12
|
isAppLoaderEnabled,
|
|
12
13
|
getPaths,
|
|
13
14
|
isGoogleTagManagerEnabled
|
|
14
15
|
} from "./helpers.js";
|
|
15
|
-
import
|
|
16
|
+
import { baseConfig } from "./webpack.base.babel.js";
|
|
17
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
16
18
|
const smp = new SpeedMeasurePlugin({ disable: !process.env.MEASURE });
|
|
17
19
|
const {
|
|
18
20
|
appVersion,
|
|
@@ -111,8 +113,9 @@ const devConfig = {
|
|
|
111
113
|
}
|
|
112
114
|
}
|
|
113
115
|
};
|
|
114
|
-
const config = smp.wrap(
|
|
116
|
+
const config = smp.wrap(baseConfig(devConfig));
|
|
115
117
|
config.plugins = config.plugins.concat([new ReactRefreshWebpackPlugin({})]);
|
|
118
|
+
var webpack_dev_babel_default = config;
|
|
116
119
|
export {
|
|
117
|
-
|
|
120
|
+
webpack_dev_babel_default as default
|
|
118
121
|
};
|
|
@@ -6,7 +6,7 @@ import { BundleAnalyzerPlugin } from "webpack-bundle-analyzer";
|
|
|
6
6
|
import { ESBuildMinifyPlugin } from "esbuild-loader";
|
|
7
7
|
import SpeedMeasurePlugin from "speed-measure-webpack-plugin";
|
|
8
8
|
import browserslistToEsbuild from "browserslist-to-esbuild";
|
|
9
|
-
import
|
|
9
|
+
import { baseConfig } from "./webpack.base.babel.js";
|
|
10
10
|
import {
|
|
11
11
|
isAppLoaderEnabled,
|
|
12
12
|
getPaths,
|
|
@@ -104,7 +104,7 @@ const htmlWebpackPlugin = new HtmlWebpackPlugin({
|
|
|
104
104
|
googleTagManager: isGoogleTagManagerEnabled()
|
|
105
105
|
}
|
|
106
106
|
});
|
|
107
|
-
const config =
|
|
107
|
+
const config = baseConfig(getProdConfig());
|
|
108
108
|
config.plugins.push(htmlWebpackPlugin);
|
|
109
109
|
const addSMPPlugin = (webpackConfig) => {
|
|
110
110
|
const smpConfig = new SpeedMeasurePlugin({
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { babelConfig } from "./babel/babel.config.cjs";
|
|
2
|
+
import { esConfig as eslintBaseConfig } from "./lint/eslint/non-react.cjs";
|
|
3
|
+
import { esReactConfig as eslintConfig } from "./lint/eslint/react.cjs";
|
|
4
|
+
import { stylelintConfig } from "./lint/stylelint.config.cjs";
|
|
5
|
+
import { prettierConfig } from "./lint/prettier.config.cjs";
|
|
6
|
+
import { commitlintConfig } from "./lint/commitlint.config.cjs";
|
|
7
|
+
import { jestConfig } from "./testing/jest.config.cjs";
|
|
8
|
+
import { jestNodeConfig } from "./testing/jest.node.config.cjs";
|
|
9
|
+
export { babelConfig, eslintBaseConfig, eslintConfig, stylelintConfig, prettierConfig, commitlintConfig, jestConfig, jestNodeConfig };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function findMonoRepoRoot(cwd?: string): string | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export function setupDefaultMiddlewares(app: any): void;
|
|
2
|
-
export function setupAdditionalMiddlewars(app: any, options
|
|
2
|
+
export function setupAdditionalMiddlewars(app: any, options?: {}): any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function initRoute(routeFile: any, app: any): void;
|
|
@@ -9,7 +9,7 @@ export namespace jestConfig {
|
|
|
9
9
|
'.*\\.(css|scss)$': any;
|
|
10
10
|
'.*\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|ico)$': any;
|
|
11
11
|
'.*\\.svg(?:\\?[a-zA-Z]+)?$': any;
|
|
12
|
-
'.*\\.html
|
|
12
|
+
'.*\\.html(?:\\?[a-zA-Z]+)?$': any;
|
|
13
13
|
'@elliemae/pui-user-monitoring': any;
|
|
14
14
|
'@elliemae/pui-app-loader': any;
|
|
15
15
|
'@elliemae/pui-diagnostics': any;
|
|
@@ -13,7 +13,7 @@ export var jestNodeConfig: {
|
|
|
13
13
|
'.*\\.(css|scss)$': any;
|
|
14
14
|
'.*\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|ico)$': any;
|
|
15
15
|
'.*\\.svg(?:\\?[a-zA-Z]+)?$': any;
|
|
16
|
-
'.*\\.html
|
|
16
|
+
'.*\\.html(?:\\?[a-zA-Z]+)?$': any;
|
|
17
17
|
'@elliemae/pui-user-monitoring': any;
|
|
18
18
|
'@elliemae/pui-app-loader': any;
|
|
19
19
|
'@elliemae/pui-diagnostics': any;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
declare namespace _default {
|
|
2
|
+
const defaults: {};
|
|
3
|
+
namespace interceptors {
|
|
4
|
+
namespace request {
|
|
5
|
+
const use: jest.Mock<any, any>;
|
|
6
|
+
}
|
|
7
|
+
namespace response {
|
|
8
|
+
const use_1: jest.Mock<any, any>;
|
|
9
|
+
export { use_1 as use };
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
const create: jest.Mock<any, any>;
|
|
13
|
+
const get: jest.Mock<any, any>;
|
|
14
|
+
const post: jest.Mock<any, any>;
|
|
15
|
+
const put: jest.Mock<any, any>;
|
|
16
|
+
}
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function addMatchMedia(): void;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|