@elliemae/pui-cli 7.27.0-beta.1 → 8.0.0-next.1
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/cli.js +14 -12
- package/dist/cjs/commands/build.js +8 -7
- package/dist/cjs/commands/codemod.js +6 -8
- package/dist/cjs/commands/gendoc.js +1 -1
- package/dist/cjs/commands/lint.js +20 -22
- package/dist/cjs/commands/pack.js +24 -19
- package/dist/cjs/commands/start.js +10 -9
- package/dist/cjs/commands/storybook.js +18 -17
- package/dist/cjs/commands/test.js +36 -30
- package/dist/cjs/commands/tscheck.js +8 -7
- package/dist/cjs/commands/utils.js +12 -7
- package/dist/cjs/commands/version.js +20 -18
- package/dist/cjs/commands/vitest.js +31 -27
- package/dist/cjs/index.cjs +0 -2
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/lint-config/eslint/common.cjs +88 -85
- package/dist/cjs/monorepo/delete-merged-tags.js +1 -1
- package/dist/cjs/monorepo/set-registry-version.js +2 -2
- package/dist/cjs/monorepo/set-workspace-version.js +2 -2
- package/dist/cjs/monorepo/utils.js +54 -0
- package/dist/cjs/release.config.cjs +0 -7
- package/dist/cjs/server/appRoutes.js +74 -0
- package/dist/cjs/server/csp.js +3 -4
- package/dist/cjs/server/index.js +13 -11
- package/dist/cjs/server/middlewares.js +7 -4
- package/dist/cjs/server/utils.js +1 -1
- package/dist/cjs/utils.js +50 -0
- package/dist/cjs/webpack/helpers.js +3 -3
- package/dist/cjs/webpack/webpack.base.babel.js +3 -10
- package/dist/cjs/webpack/webpack.dev.babel.js +12 -9
- package/dist/cjs/webpack/webpack.lib.base.babel.js +4 -5
- package/dist/cjs/webpack/webpack.lib.dev.babel.js +1 -0
- package/dist/cjs/webpack/webpack.prod.babel.js +7 -15
- package/dist/cjs/webpack/webpack.storybook.js +27 -20
- package/dist/esm/cli.js +14 -12
- package/dist/esm/commands/build.js +8 -7
- package/dist/esm/commands/codemod.js +6 -8
- package/dist/esm/commands/gendoc.js +1 -1
- package/dist/esm/commands/lint.js +26 -22
- package/dist/esm/commands/pack.js +31 -19
- package/dist/esm/commands/start.js +10 -9
- package/dist/esm/commands/storybook.js +18 -17
- package/dist/esm/commands/test.js +36 -30
- package/dist/esm/commands/tscheck.js +8 -7
- package/dist/esm/commands/utils.js +11 -6
- package/dist/esm/commands/version.js +20 -18
- package/dist/esm/commands/vitest.js +31 -27
- package/dist/esm/index.cjs +0 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/lint-config/eslint/common.cjs +88 -85
- package/dist/esm/monorepo/delete-merged-tags.js +1 -1
- package/dist/esm/monorepo/set-registry-version.js +2 -2
- package/dist/esm/monorepo/set-workspace-version.js +2 -2
- package/dist/esm/monorepo/utils.js +24 -0
- package/dist/esm/release.config.cjs +0 -7
- package/dist/{cjs/server/app-routes.cjs → esm/server/appRoutes.js} +25 -23
- package/dist/esm/server/csp.js +3 -4
- package/dist/esm/server/index.js +13 -11
- package/dist/esm/server/middlewares.js +7 -4
- package/dist/esm/server/utils.js +1 -1
- package/dist/esm/utils.js +20 -0
- package/dist/esm/webpack/helpers.js +3 -3
- package/dist/esm/webpack/webpack.base.babel.js +3 -10
- package/dist/esm/webpack/webpack.dev.babel.js +16 -10
- package/dist/esm/webpack/webpack.lib.base.babel.js +4 -5
- package/dist/esm/webpack/webpack.lib.dev.babel.js +1 -0
- package/dist/esm/webpack/webpack.prod.babel.js +7 -15
- package/dist/esm/webpack/webpack.storybook.js +27 -20
- package/dist/types/commands/build.d.ts +6 -14
- package/dist/types/commands/codemod.d.ts +6 -6
- package/dist/types/commands/gendoc.d.ts +2 -6
- package/dist/types/commands/lint.d.ts +8 -29
- package/dist/types/commands/pack.d.ts +8 -26
- package/dist/types/commands/start.d.ts +6 -13
- package/dist/types/commands/storybook.d.ts +8 -27
- package/dist/types/commands/test.d.ts +11 -39
- package/dist/types/commands/tscheck.d.ts +5 -14
- package/dist/types/commands/utils.d.ts +11 -11
- package/dist/types/commands/version.d.ts +9 -28
- package/dist/types/commands/vitest.d.ts +10 -35
- package/dist/types/index.d.cts +1 -2
- package/dist/types/index.d.ts +11 -11
- package/dist/types/lint-config/eslint/common.d.cts +58 -55
- package/dist/types/lint-config/eslint/non-react.d.cts +34 -31
- package/dist/types/lint-config/eslint/react.d.cts +58 -55
- package/dist/types/lint-config/eslint/typescript/non-react.d.cts +28 -28
- package/dist/types/lint-config/eslint/typescript/react.d.cts +52 -52
- package/dist/types/monorepo/delete-merged-tags.d.ts +1 -1
- package/dist/types/monorepo/set-registry-version.d.ts +1 -1
- package/dist/types/monorepo/set-workspace-version.d.ts +1 -1
- package/dist/types/monorepo/utils.d.ts +1 -0
- package/dist/types/release.config.d.cts +0 -2
- package/dist/types/server/appRoutes.d.ts +2 -0
- package/dist/types/server/csp.d.ts +12 -9
- package/dist/types/server/logger.d.ts +7 -4
- package/dist/types/server/middlewares.d.ts +6 -2
- package/dist/types/server/utils.d.ts +3 -3
- package/dist/types/testing/jest.config.d.cts +10 -10
- package/dist/types/testing/jest.node.config.d.cts +10 -10
- package/dist/types/utils.d.ts +4 -0
- package/dist/types/webpack/helpers.d.ts +19 -18
- package/dist/types/webpack/webpack.base.babel.d.ts +3 -106
- package/dist/types/webpack/webpack.dev.babel.d.ts +2 -1
- package/dist/types/webpack/webpack.lib.base.babel.d.ts +3 -102
- package/dist/types/webpack/webpack.lib.dev.babel.d.ts +3 -101
- package/dist/types/webpack/webpack.lib.prod.babel.d.ts +2 -101
- package/dist/types/webpack/webpack.prod.babel.d.ts +3 -2
- package/dist/types/webpack/webpack.storybook.d.ts +5 -4
- package/package.json +45 -30
- package/dist/cjs/typescript/app.tsconfig.json +0 -23
- package/dist/cjs/typescript/library.tsconfig.json +0 -23
- package/dist/esm/server/app-routes.cjs +0 -42
- package/dist/esm/typescript/app.tsconfig.json +0 -23
- package/dist/esm/typescript/library.tsconfig.json +0 -23
- package/dist/types/server/app-routes.d.cts +0 -1
|
@@ -1,42 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
4
3
|
const allJS = /\.js$/;
|
|
5
|
-
|
|
6
4
|
const serviceEndpoints = /\.endpoint\.js$/;
|
|
7
|
-
|
|
8
5
|
const getFilesMatching = (filePattern) => {
|
|
9
6
|
const getFiles = (dir) => {
|
|
10
7
|
let routeFiles = [];
|
|
11
|
-
if (!fs.existsSync(dir))
|
|
8
|
+
if (!fs.existsSync(dir))
|
|
9
|
+
return routeFiles;
|
|
12
10
|
fs.readdirSync(dir).forEach((file) => {
|
|
13
11
|
const fullPath = path.join(dir, file);
|
|
14
12
|
if (fs.lstatSync(fullPath).isDirectory()) {
|
|
15
13
|
routeFiles = routeFiles.concat(getFiles(fullPath));
|
|
16
|
-
} else if (filePattern.test(fullPath))
|
|
14
|
+
} else if (filePattern.test(fullPath))
|
|
15
|
+
routeFiles.push(fullPath);
|
|
17
16
|
});
|
|
18
17
|
return routeFiles;
|
|
19
18
|
};
|
|
20
19
|
return getFiles;
|
|
21
20
|
};
|
|
22
|
-
|
|
23
21
|
const getServerRouteFiles = getFilesMatching(allJS);
|
|
24
22
|
const getServiceEndpoints = getFilesMatching(serviceEndpoints);
|
|
25
|
-
|
|
26
|
-
exports.loadRoutes = (app) => {
|
|
23
|
+
const loadRoutes = async (app) => {
|
|
27
24
|
const routeFiles = getServerRouteFiles(
|
|
28
|
-
path.join(process.cwd(),
|
|
25
|
+
path.join(process.cwd(), "server/routes")
|
|
29
26
|
);
|
|
30
|
-
routeFiles.push(...getServiceEndpoints(path.join(process.cwd(),
|
|
31
|
-
routeFiles.push(...getServiceEndpoints(path.join(process.cwd(),
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
27
|
+
routeFiles.push(...getServiceEndpoints(path.join(process.cwd(), "app")));
|
|
28
|
+
routeFiles.push(...getServiceEndpoints(path.join(process.cwd(), "lib")));
|
|
29
|
+
await Promise.all(
|
|
30
|
+
routeFiles.map(async (routeFile) => {
|
|
31
|
+
const { default: init } = await import(routeFile);
|
|
32
|
+
try {
|
|
33
|
+
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
|
|
42
44
|
};
|
package/dist/esm/server/csp.js
CHANGED
|
@@ -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,
|
|
31
|
+
res.send(html.replace(nonceRegex, res.locals.cspNonce));
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
};
|
|
35
35
|
const getScriptSrc = () => {
|
|
36
|
-
const
|
|
37
|
-
|
|
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) => {
|
package/dist/esm/server/index.js
CHANGED
|
@@ -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 "./
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
app
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
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
|
|
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 =
|
|
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(
|
|
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 {
|
package/dist/esm/server/utils.js
CHANGED
|
@@ -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.
|
|
7
|
-
import { basePath, getAppConfig } from "../utils.
|
|
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,11 @@ 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
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
import {
|
|
9
|
+
setupAdditionalMiddlewars,
|
|
10
|
+
setupDefaultMiddlewares
|
|
11
|
+
} from "../server/middlewares.js";
|
|
12
|
+
import { loadRoutes } from "../server/appRoutes.js";
|
|
12
13
|
import {
|
|
13
14
|
isAppLoaderEnabled,
|
|
14
15
|
getPaths,
|
|
@@ -16,7 +17,6 @@ import {
|
|
|
16
17
|
} from "./helpers.js";
|
|
17
18
|
import { baseConfig } from "./webpack.base.babel.js";
|
|
18
19
|
const __filename = fileURLToPath(import.meta.url);
|
|
19
|
-
const smp = new SpeedMeasurePlugin({ disable: !process.env.MEASURE });
|
|
20
20
|
const {
|
|
21
21
|
appVersion,
|
|
22
22
|
buildPath,
|
|
@@ -115,15 +115,21 @@ const devConfig = {
|
|
|
115
115
|
open: [basePath],
|
|
116
116
|
port: process.env.PORT || "auto",
|
|
117
117
|
setupMiddlewares: (middlewares, devServer) => {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
if (devServer.app) {
|
|
119
|
+
setupDefaultMiddlewares(devServer.app);
|
|
120
|
+
loadRoutes(devServer.app).then(() => {
|
|
121
|
+
if (devServer.app)
|
|
122
|
+
setupAdditionalMiddlewars(devServer.app);
|
|
123
|
+
}).catch((err) => {
|
|
124
|
+
console.error(err);
|
|
125
|
+
});
|
|
126
|
+
}
|
|
121
127
|
return middlewares;
|
|
122
128
|
}
|
|
123
129
|
}
|
|
124
130
|
};
|
|
125
|
-
const config =
|
|
126
|
-
config.plugins = config.plugins.concat([new ReactRefreshWebpackPlugin({})]);
|
|
131
|
+
const config = baseConfig(devConfig);
|
|
132
|
+
config.plugins = config.plugins ? config.plugins.concat([new ReactRefreshWebpackPlugin({})]) : [];
|
|
127
133
|
var webpack_dev_babel_default = config;
|
|
128
134
|
export {
|
|
129
135
|
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.
|
|
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(
|
|
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",
|
|
@@ -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
|
|
110
|
-
|
|
111
|
-
|
|
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.
|
|
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 =
|
|
53
|
+
const webpackFinal = (config, { configType }) => {
|
|
54
54
|
const isProd = configType === "PRODUCTION";
|
|
55
|
-
const fileLoaderRule = config
|
|
55
|
+
const fileLoaderRule = config?.module?.rules?.find?.(
|
|
56
56
|
(rule) => rule.test?.test?.(".svg")
|
|
57
57
|
);
|
|
58
|
-
fileLoaderRule
|
|
59
|
-
|
|
60
|
-
config
|
|
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
|
|
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
|
|
73
|
-
|
|
74
|
-
|
|
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 =
|
|
78
|
-
|
|
79
|
-
|
|
82
|
+
const managerWebpack = (config) => {
|
|
83
|
+
if (config.plugins)
|
|
84
|
+
config.plugins = config.plugins.concat(getCompressionPlugins());
|
|
85
|
+
if (config.resolve)
|
|
86
|
+
config.resolve.alias = { ...config.resolve.alias, ...getAlias() };
|
|
80
87
|
return config;
|
|
81
88
|
};
|
|
82
89
|
export {
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
namespace builder {
|
|
8
|
-
namespace service {
|
|
9
|
-
export const type: string;
|
|
10
|
-
const _default: boolean;
|
|
11
|
-
export { _default as default };
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
1
|
+
import { CommandModule } from 'yargs';
|
|
2
|
+
type Arguments = {
|
|
3
|
+
service: boolean;
|
|
4
|
+
};
|
|
5
|
+
export declare const buildCmd: CommandModule<Record<string, never>, Arguments>;
|
|
6
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
1
|
+
import { CommandModule } from 'yargs';
|
|
2
|
+
type Arguments = {
|
|
3
|
+
transform: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const codemodCmd: CommandModule<Record<string, never>, Arguments>;
|
|
6
|
+
export {};
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const command: string;
|
|
4
|
-
const describe: string;
|
|
5
|
-
const builder: {};
|
|
6
|
-
}
|
|
1
|
+
import { CommandModule } from 'yargs';
|
|
2
|
+
export declare const gendocCmd: CommandModule<Record<string, never>, Record<string, never>>;
|
|
@@ -1,29 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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 { CommandModule } from 'yargs';
|
|
2
|
+
type Arguments = {
|
|
3
|
+
css: boolean;
|
|
4
|
+
js: boolean;
|
|
5
|
+
fix: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const lintCmd: CommandModule<Record<string, never>, Arguments>;
|
|
8
|
+
export {};
|
|
@@ -1,26 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const _default: boolean;
|
|
10
|
-
export { _default as default };
|
|
11
|
-
}
|
|
12
|
-
namespace target {
|
|
13
|
-
const alias_1: string;
|
|
14
|
-
export { alias_1 as alias };
|
|
15
|
-
const type_1: string;
|
|
16
|
-
export { type_1 as type };
|
|
17
|
-
export const description: string;
|
|
18
|
-
}
|
|
19
|
-
namespace srcPath {
|
|
20
|
-
const type_2: string;
|
|
21
|
-
export { type_2 as type };
|
|
22
|
-
const _default_1: string;
|
|
23
|
-
export { _default_1 as default };
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
1
|
+
import { CommandModule } from 'yargs';
|
|
2
|
+
type Arguments = {
|
|
3
|
+
production: boolean;
|
|
4
|
+
target: string;
|
|
5
|
+
srcPath: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const packCmd: CommandModule<Record<string, never>, Arguments>;
|
|
8
|
+
export {};
|
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
export const alias: string;
|
|
8
|
-
const _default: boolean;
|
|
9
|
-
export { _default as default };
|
|
10
|
-
export const type: string;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
1
|
+
import { CommandModule } from 'yargs';
|
|
2
|
+
type Arguments = {
|
|
3
|
+
prod: boolean;
|
|
4
|
+
};
|
|
5
|
+
export declare const startCmd: CommandModule<Record<string, never>, Arguments>;
|
|
6
|
+
export {};
|
|
@@ -1,27 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const _default: boolean;
|
|
10
|
-
export { _default as default };
|
|
11
|
-
}
|
|
12
|
-
namespace docs {
|
|
13
|
-
const type_1: string;
|
|
14
|
-
export { type_1 as type };
|
|
15
|
-
const _default_1: boolean;
|
|
16
|
-
export { _default_1 as default };
|
|
17
|
-
}
|
|
18
|
-
namespace output {
|
|
19
|
-
const alias_1: string;
|
|
20
|
-
export { alias_1 as alias };
|
|
21
|
-
const type_2: string;
|
|
22
|
-
export { type_2 as type };
|
|
23
|
-
const _default_2: string;
|
|
24
|
-
export { _default_2 as default };
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
1
|
+
import { CommandModule } from 'yargs';
|
|
2
|
+
type Arguments = {
|
|
3
|
+
build: boolean;
|
|
4
|
+
docs: boolean;
|
|
5
|
+
output: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const storybookCmd: CommandModule<Record<string, never>, Arguments>;
|
|
8
|
+
export {};
|