@elliemae/pui-cli 9.0.0-next.3 → 9.0.0-next.30
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/commands/lint.js +26 -7
- package/dist/cjs/commands/start.js +1 -1
- package/dist/cjs/commands/storybook.js +2 -2
- package/dist/cjs/commands/test.js +49 -22
- package/dist/cjs/commands/utils.js +30 -1
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/lint-config/eslint/common.cjs +3 -2
- package/dist/cjs/lint-config/eslint/typescript/common.cjs +3 -3
- package/dist/cjs/lint-config/stylelint.config.cjs +14 -13
- package/dist/cjs/monorepo/delete-merged-tags.js +1 -1
- package/dist/cjs/monorepo/set-registry-version.js +1 -1
- package/dist/cjs/monorepo/set-workspace-version.js +1 -1
- package/dist/cjs/server/csp.js +2 -1
- package/dist/cjs/server/index.js +5 -0
- package/dist/cjs/server/utils.js +11 -4
- package/dist/cjs/server/wsServer.js +129 -0
- package/dist/cjs/testing/ExtendedJSDomEnv.cjs +27 -0
- package/dist/cjs/testing/extended/axe-core/getMessageAndPass.js +37 -0
- package/dist/cjs/testing/extended/axe-core/index.js +24 -0
- package/dist/cjs/testing/extended/axe-core/reporter.js +51 -0
- package/dist/cjs/testing/extended/axe-core/shouldIgnoreNodeViolation.js +31 -0
- package/dist/cjs/testing/extended/axe-core/toHaveNoViolations.js +43 -0
- package/dist/cjs/testing/jest.config.cjs +5 -2
- package/dist/cjs/testing/jest.polyfills.cjs +28 -0
- package/dist/cjs/testing/setup-test-env.js +0 -2
- package/dist/cjs/testing/setup-tests.js +25 -4
- package/dist/cjs/testing/vitest.config.js +8 -8
- package/dist/cjs/transpile/esbuild.js +1 -1
- package/dist/cjs/update-notifier.js +1 -1
- package/dist/cjs/utils.js +1 -1
- package/dist/cjs/webpack/helpers.js +18 -6
- package/dist/cjs/webpack/webpack.base.babel.js +7 -4
- package/dist/cjs/webpack/webpack.dev.babel.js +14 -3
- package/dist/cjs/webpack/webpack.lib.base.babel.js +13 -5
- package/dist/cjs/webpack/webpack.lib.dev.babel.js +5 -11
- package/dist/cjs/webpack/webpack.lib.prod.babel.js +4 -5
- package/dist/cjs/webpack/webpack.prod.babel.js +3 -2
- package/dist/cjs/webpack/webpack.storybook.js +10 -11
- package/dist/esm/commands/lint.js +27 -7
- package/dist/esm/commands/start.js +1 -1
- package/dist/esm/commands/storybook.js +2 -2
- package/dist/esm/commands/test.js +49 -22
- package/dist/esm/commands/utils.js +30 -1
- package/dist/esm/index.js +3 -1
- package/dist/esm/lint-config/eslint/common.cjs +3 -2
- package/dist/esm/lint-config/eslint/typescript/common.cjs +3 -3
- package/dist/esm/lint-config/stylelint.config.cjs +14 -13
- package/dist/esm/monorepo/delete-merged-tags.js +1 -1
- package/dist/esm/monorepo/set-registry-version.js +1 -1
- package/dist/esm/monorepo/set-workspace-version.js +1 -1
- package/dist/esm/server/csp.js +2 -1
- package/dist/esm/server/index.js +6 -1
- package/dist/esm/server/utils.js +11 -4
- package/dist/esm/server/wsServer.js +99 -0
- package/dist/esm/testing/ExtendedJSDomEnv.cjs +27 -0
- package/dist/esm/testing/extended/axe-core/getMessageAndPass.js +17 -0
- package/dist/esm/testing/extended/axe-core/index.js +4 -0
- package/dist/esm/testing/extended/axe-core/reporter.js +31 -0
- package/dist/esm/testing/extended/axe-core/shouldIgnoreNodeViolation.js +11 -0
- package/dist/esm/testing/extended/axe-core/toHaveNoViolations.js +23 -0
- package/dist/esm/testing/jest.config.cjs +5 -2
- package/dist/esm/testing/jest.polyfills.cjs +28 -0
- package/dist/esm/testing/setup-test-env.js +0 -2
- package/dist/esm/testing/setup-tests.js +25 -4
- package/dist/esm/testing/vitest.config.js +8 -8
- package/dist/esm/transpile/esbuild.js +1 -1
- package/dist/esm/update-notifier.js +1 -1
- package/dist/esm/utils.js +1 -1
- package/dist/esm/webpack/helpers.js +18 -6
- package/dist/esm/webpack/webpack.base.babel.js +7 -4
- package/dist/esm/webpack/webpack.dev.babel.js +14 -3
- package/dist/esm/webpack/webpack.lib.base.babel.js +13 -5
- package/dist/esm/webpack/webpack.lib.dev.babel.js +6 -12
- package/dist/esm/webpack/webpack.lib.prod.babel.js +9 -6
- package/dist/esm/webpack/webpack.prod.babel.js +3 -2
- package/dist/esm/webpack/webpack.storybook.js +11 -12
- package/dist/types/babel.config.d.cts +7 -7
- package/dist/types/commands/build.d.ts +2 -2
- package/dist/types/commands/codemod.d.ts +2 -2
- package/dist/types/commands/lint.d.ts +3 -2
- package/dist/types/commands/pack.d.ts +2 -2
- package/dist/types/commands/start.d.ts +2 -2
- package/dist/types/commands/storybook.d.ts +2 -2
- package/dist/types/commands/test.d.ts +4 -2
- package/dist/types/commands/tscheck.d.ts +2 -2
- package/dist/types/commands/utils.d.ts +23 -1
- package/dist/types/commands/version.d.ts +2 -2
- package/dist/types/commands/vitest.d.ts +2 -2
- package/dist/types/index.d.ts +1 -0
- package/dist/types/lint-config/commitlint.config.d.cts +1 -1
- package/dist/types/lint-config/eslint/common.d.cts +18 -12
- package/dist/types/lint-config/eslint/non-react.d.cts +8 -1
- package/dist/types/lint-config/eslint/react.d.cts +8 -1
- package/dist/types/lint-config/eslint/typescript/common.d.cts +6 -6
- package/dist/types/lint-config/eslint/typescript/non-react.d.cts +9 -2
- package/dist/types/lint-config/eslint/typescript/react.d.cts +9 -2
- package/dist/types/lint-config/lint-staged.config.d.ts +3 -3
- package/dist/types/lint-config/prettier.config.d.cts +6 -6
- package/dist/types/lint-config/stylelint.config.d.cts +6 -6
- package/dist/types/release.config.d.cts +2 -2
- package/dist/types/server/csp.d.ts +2 -2
- package/dist/types/server/utils.d.ts +1 -0
- package/dist/types/server/wsServer.d.ts +13 -0
- package/dist/types/testing/ExtendedJSDomEnv.d.cts +5 -0
- package/dist/types/testing/extended/axe-core/getMessageAndPass.d.ts +8 -0
- package/dist/types/testing/extended/axe-core/index.d.ts +1 -0
- package/dist/types/testing/extended/axe-core/reporter.d.ts +2 -0
- package/dist/types/testing/extended/axe-core/shouldIgnoreNodeViolation.d.ts +2 -0
- package/dist/types/testing/extended/axe-core/toHaveNoViolations.d.ts +12 -0
- package/dist/types/testing/jest.config.d.cts +25 -22
- package/dist/types/testing/jest.node.config.d.cts +3 -0
- package/dist/types/testing/jest.polyfills.d.cts +1 -0
- package/dist/types/testing/mocks/axios.d.ts +7 -7
- package/dist/types/testing/mocks/pui-diagnostics.d.ts +13 -13
- package/dist/types/testing/vitest.config.d.ts +1 -1
- package/dist/types/tests/basic.test.d.ts +0 -0
- package/dist/types/transpile/esbuild.d.ts +3 -3
- package/dist/types/typedoc.d.cts +3 -3
- package/dist/types/webpack/helpers.d.ts +4 -1
- package/dist/types/webpack/webpack.storybook.d.ts +0 -1
- package/nx.json +97 -0
- package/package.json +163 -150
|
@@ -57,6 +57,8 @@ const jestConfig = {
|
|
|
57
57
|
coverageReporters: ['lcov', 'html', 'text-summary'],
|
|
58
58
|
moduleDirectories: ['node_modules', 'app', 'lib'],
|
|
59
59
|
moduleNameMapper: {
|
|
60
|
+
d3: '<rootDir>/node_modules/d3/dist/d3.min.js',
|
|
61
|
+
'^d3-(.*)$': '<rootDir>/node_modules/d3-$1/dist/d3-$1.min.js',
|
|
60
62
|
'.*\\webpack-hmr(.[t|j]s)?$': getMockFilePath('webpack-hmr.js'),
|
|
61
63
|
'.*\\.(css|scss)$': getMockFilePath('cssModule.js'),
|
|
62
64
|
'.*\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|ico)$':
|
|
@@ -73,7 +75,7 @@ const jestConfig = {
|
|
|
73
75
|
},
|
|
74
76
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
|
|
75
77
|
setupFilesAfterEnv: [path.resolve(__dirname, './setup-tests.js')],
|
|
76
|
-
setupFiles: ['raf/polyfill', '
|
|
78
|
+
setupFiles: ['raf/polyfill', path.resolve(__dirname, './jest.polyfills.cjs')],
|
|
77
79
|
testRegex: '(app|lib).*/tests/.*\\.test\\.[jt]sx?$',
|
|
78
80
|
snapshotSerializers: [],
|
|
79
81
|
testResultsProcessor: 'jest-sonar-reporter',
|
|
@@ -91,8 +93,9 @@ const jestConfig = {
|
|
|
91
93
|
testEnvironmentOptions: {
|
|
92
94
|
url: `http://localhost:3111${basePath}`,
|
|
93
95
|
resources: 'usable',
|
|
96
|
+
customExportConditions: [''],
|
|
94
97
|
},
|
|
95
|
-
testEnvironment: '
|
|
98
|
+
testEnvironment: path.resolve(__dirname, './ExtendedJSDomEnv.cjs'),
|
|
96
99
|
watchPlugins: [
|
|
97
100
|
'jest-watch-typeahead/filename',
|
|
98
101
|
'jest-watch-typeahead/testname',
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @note The block below contains polyfills for Node.js globals
|
|
3
|
+
* required for Jest to function when running JSDOM tests.
|
|
4
|
+
* These HAVE to be require's and HAVE to be in this exact
|
|
5
|
+
* order, since "undici" depends on the "TextEncoder" global API.
|
|
6
|
+
*
|
|
7
|
+
* Consider migrating to a more modern test runner if
|
|
8
|
+
* you don't want to deal with this.
|
|
9
|
+
*/
|
|
10
|
+
const { TextDecoder, TextEncoder } = require('node:util');
|
|
11
|
+
|
|
12
|
+
Object.defineProperties(globalThis, {
|
|
13
|
+
TextDecoder: { value: TextDecoder },
|
|
14
|
+
TextEncoder: { value: TextEncoder },
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const { Blob, File } = require('node:buffer');
|
|
18
|
+
const { fetch, Headers, FormData, Request, Response } = require('undici');
|
|
19
|
+
|
|
20
|
+
Object.defineProperties(globalThis, {
|
|
21
|
+
fetch: { value: fetch, writable: true },
|
|
22
|
+
Blob: { value: Blob },
|
|
23
|
+
File: { value: File },
|
|
24
|
+
Headers: { value: Headers },
|
|
25
|
+
FormData: { value: FormData },
|
|
26
|
+
Request: { value: Request },
|
|
27
|
+
Response: { value: Response },
|
|
28
|
+
});
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import "core-js/stable";
|
|
2
1
|
import "regenerator-runtime/runtime";
|
|
3
|
-
import "@testing-library/jest-dom/
|
|
4
|
-
import jestAxe from "jest-axe";
|
|
2
|
+
import "@testing-library/jest-dom/jest-globals";
|
|
5
3
|
import ResizeObserver from "resize-observer-polyfill";
|
|
4
|
+
import { toHaveNoViolations } from "./extended/axe-core";
|
|
6
5
|
import { addMatchMedia } from "./mocks/matchMedia.js";
|
|
7
6
|
import { logger } from "./mocks/pui-diagnostics.js";
|
|
8
7
|
const originalError = console.error;
|
|
@@ -25,7 +24,7 @@ console.error = (...args) => {
|
|
|
25
24
|
return originalError(...args);
|
|
26
25
|
};
|
|
27
26
|
if (expect)
|
|
28
|
-
expect.extend(
|
|
27
|
+
expect.extend(toHaveNoViolations);
|
|
29
28
|
const addElementToBody = (element) => {
|
|
30
29
|
const documentEle = (window || {}).document;
|
|
31
30
|
if (!documentEle)
|
|
@@ -49,3 +48,25 @@ window.emui = {
|
|
|
49
48
|
logger: logger(),
|
|
50
49
|
_BASE_PATH: new URL(document.baseURI).pathname
|
|
51
50
|
};
|
|
51
|
+
let showCorejsWarn = false;
|
|
52
|
+
afterAll(() => {
|
|
53
|
+
if (showCorejsWarn) {
|
|
54
|
+
console.warn(
|
|
55
|
+
`IMPORTANT: Try importing core-js/stable in your failed test files and retrying.
|
|
56
|
+
Some tests might have failed because of it`
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
const originalTest = global.test;
|
|
61
|
+
global.it = (name, fn, timeout = void 0) => {
|
|
62
|
+
const fnWrapper = async () => {
|
|
63
|
+
try {
|
|
64
|
+
await fn();
|
|
65
|
+
} catch (error) {
|
|
66
|
+
showCorejsWarn = true;
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
originalTest(name, fnWrapper, timeout);
|
|
71
|
+
};
|
|
72
|
+
global.it.skip = originalTest.skip;
|
|
@@ -2,26 +2,26 @@ import path from "node:path";
|
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
3
|
import { defineConfig, configDefaults } from "vitest/config";
|
|
4
4
|
import react from "@vitejs/plugin-react";
|
|
5
|
+
import tsconfigPaths from "vite-tsconfig-paths";
|
|
5
6
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
6
7
|
const vitestConfig = defineConfig({
|
|
7
|
-
plugins: [react()],
|
|
8
|
+
plugins: [react(), tsconfigPaths()],
|
|
8
9
|
test: {
|
|
9
10
|
globals: true,
|
|
10
11
|
root: process.cwd(),
|
|
11
|
-
environment: "
|
|
12
|
+
environment: "happy-dom",
|
|
12
13
|
setupFiles: [path.resolve(__dirname, "./setup-test-env.js")],
|
|
13
14
|
include: ["./{app,lib}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],
|
|
14
15
|
exclude: [...configDefaults.exclude, ".idea", ".git", ".cache", "e2e"],
|
|
15
|
-
// watchIgnore: [
|
|
16
|
-
// '.*\\/node_modules\\/.*',
|
|
17
|
-
// '.*\\/build\\/.*',
|
|
18
|
-
// '.*\\/dist\\/.*',
|
|
19
|
-
// ],
|
|
20
16
|
coverage: {
|
|
21
17
|
reportsDirectory: "./reports/coverage"
|
|
22
18
|
},
|
|
23
19
|
deps: {
|
|
24
|
-
|
|
20
|
+
optimizer: {
|
|
21
|
+
web: {
|
|
22
|
+
include: ["app.config.json", "@elliemae/pui-app-sdk"]
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
|
+
import { writeFile, copyFile, readFile, mkdir } from "node:fs/promises";
|
|
3
4
|
import fg from "fast-glob";
|
|
4
5
|
import { build } from "esbuild";
|
|
5
|
-
import { writeFile, copyFile, readFile, mkdir } from "node:fs/promises";
|
|
6
6
|
import browserslistToEsbuild from "browserslist-to-esbuild";
|
|
7
7
|
import lodashTransformer from "esbuild-plugin-lodash";
|
|
8
8
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import updateNotifier from "update-notifier";
|
|
2
1
|
import path from "node:path";
|
|
3
2
|
import fs from "node:fs/promises";
|
|
3
|
+
import updateNotifier from "update-notifier";
|
|
4
4
|
const notifyUpdates = async () => {
|
|
5
5
|
const pkgFile = await fs.readFile(path.join(process.cwd(), "./package.json"));
|
|
6
6
|
const pkg = JSON.parse(pkgFile);
|
package/dist/esm/utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
const basePath = (process.env.BASE_PATH
|
|
3
|
+
const basePath = (process.env.BASE_PATH ?? "/").replace(/\/?$/, "/");
|
|
4
4
|
const isApp = () => fs.existsSync(path.join(process.cwd(), "app"));
|
|
5
5
|
const getAppConfig = () => {
|
|
6
6
|
const appConfigPath = path.join(
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import fs from "node:fs";
|
|
3
|
+
import zlib from "zlib";
|
|
3
4
|
import _ from "lodash";
|
|
4
5
|
import CompressionPlugin from "compression-webpack-plugin";
|
|
5
|
-
import zlib from "zlib";
|
|
6
6
|
import { findMonoRepoRoot } from "../monorepo/utils.js";
|
|
7
7
|
import { basePath, getAppConfig } from "../utils.js";
|
|
8
8
|
let pathSep = path.sep;
|
|
@@ -16,8 +16,8 @@ const excludeNodeModulesExcept = (modules) => {
|
|
|
16
16
|
const moduleRegExps = getNodeModulesRegEx(modules);
|
|
17
17
|
return function(modulePath) {
|
|
18
18
|
if (/node_modules/.test(modulePath)) {
|
|
19
|
-
for (
|
|
20
|
-
if (
|
|
19
|
+
for (const moduleRegExp of moduleRegExps)
|
|
20
|
+
if (moduleRegExp.test(modulePath))
|
|
21
21
|
return false;
|
|
22
22
|
return true;
|
|
23
23
|
}
|
|
@@ -32,7 +32,7 @@ const getLibraryName = () => {
|
|
|
32
32
|
const modifiedLibName = `emui-${libraryName.replace("@elliemae/", "").replace("pui-", "")}`;
|
|
33
33
|
return _.camelCase(modifiedLibName);
|
|
34
34
|
};
|
|
35
|
-
const getLibraryVariableName = () => (process.env.LIBRARY_VARIABLE_NAME
|
|
35
|
+
const getLibraryVariableName = () => (process.env.LIBRARY_VARIABLE_NAME ?? getLibraryName()).split(".");
|
|
36
36
|
const mapToFolder = (dependencies, folder) => dependencies.reduce(
|
|
37
37
|
(acc, dependency) => ({
|
|
38
38
|
[dependency]: path.resolve(`${folder}/${dependency.replace("$", "")}`),
|
|
@@ -41,7 +41,7 @@ const mapToFolder = (dependencies, folder) => dependencies.reduce(
|
|
|
41
41
|
{}
|
|
42
42
|
);
|
|
43
43
|
const getAlias = () => {
|
|
44
|
-
const monorepoRoot = findMonoRepoRoot(process.cwd())
|
|
44
|
+
const monorepoRoot = findMonoRepoRoot(process.cwd()) ?? "";
|
|
45
45
|
return mapToFolder(
|
|
46
46
|
[
|
|
47
47
|
"@babel/runtime",
|
|
@@ -55,6 +55,8 @@ const getAlias = () => {
|
|
|
55
55
|
"styled-components",
|
|
56
56
|
"immer",
|
|
57
57
|
"react-dates",
|
|
58
|
+
"react-select",
|
|
59
|
+
"react-spring",
|
|
58
60
|
"react-transition-group",
|
|
59
61
|
"@elliemae/pui-cli",
|
|
60
62
|
"@elliemae/pui-app-sdk$",
|
|
@@ -63,6 +65,15 @@ const getAlias = () => {
|
|
|
63
65
|
path.join(monorepoRoot, "./node_modules")
|
|
64
66
|
);
|
|
65
67
|
};
|
|
68
|
+
const getLibraryAlias = (name, alias) => {
|
|
69
|
+
const monorepoRoot = findMonoRepoRoot(process.cwd()) ?? "";
|
|
70
|
+
const aliasPath = path.resolve(
|
|
71
|
+
`${path.join(monorepoRoot, "./node_modules")}/${alias}`
|
|
72
|
+
);
|
|
73
|
+
return {
|
|
74
|
+
[name]: aliasPath
|
|
75
|
+
};
|
|
76
|
+
};
|
|
66
77
|
const modulesToTranspile = [
|
|
67
78
|
"@elliemae/pui-*",
|
|
68
79
|
"@elliemae/ds-*",
|
|
@@ -125,7 +136,7 @@ const getAppVersion = () => {
|
|
|
125
136
|
if (!process.env.APP_VERSION)
|
|
126
137
|
return LATEST_VERSION;
|
|
127
138
|
const match = process.env.APP_VERSION.match(/^v?(\d+\.\d+)\..*$/);
|
|
128
|
-
return match
|
|
139
|
+
return match?.[1] ?? LATEST_VERSION;
|
|
129
140
|
};
|
|
130
141
|
const getPaths = (latestVersion = true) => {
|
|
131
142
|
const version = latestVersion ? LATEST_VERSION : getAppVersion();
|
|
@@ -202,6 +213,7 @@ export {
|
|
|
202
213
|
getAlias,
|
|
203
214
|
getAppVersion,
|
|
204
215
|
getCompressionPlugins,
|
|
216
|
+
getLibraryAlias,
|
|
205
217
|
getLibraryName,
|
|
206
218
|
getLibraryVariableName,
|
|
207
219
|
getMediaPath,
|
|
@@ -257,9 +257,12 @@ const baseConfig = (options) => ({
|
|
|
257
257
|
mainFields: ["browser", "module", "main"],
|
|
258
258
|
alias: {
|
|
259
259
|
...getAlias(),
|
|
260
|
-
...
|
|
260
|
+
...options.resolve?.alias ?? {}
|
|
261
261
|
}
|
|
262
262
|
},
|
|
263
|
+
externalsPresets: {
|
|
264
|
+
web: true
|
|
265
|
+
},
|
|
263
266
|
externals: {
|
|
264
267
|
"@elliemae/pui-user-monitoring": "emuiUserMonitoring",
|
|
265
268
|
"@elliemae/pui-app-loader": "emuiAppLoader",
|
|
@@ -284,9 +287,9 @@ const baseConfig = (options) => ({
|
|
|
284
287
|
"styled-system": "emuiAppReactDependencies.styledSystem"
|
|
285
288
|
// "@xstyled/styled-components": "emuiAppReactDependencies.xstyled",
|
|
286
289
|
},
|
|
287
|
-
devtool: options.devtool
|
|
288
|
-
performance: options.performance
|
|
289
|
-
devServer: options.devServer
|
|
290
|
+
devtool: options.devtool ?? "eval-source-map",
|
|
291
|
+
performance: options.performance ?? {},
|
|
292
|
+
devServer: options.devServer ?? {}
|
|
290
293
|
});
|
|
291
294
|
export {
|
|
292
295
|
baseConfig
|
|
@@ -14,6 +14,8 @@ import {
|
|
|
14
14
|
isGoogleTagManagerEnabled
|
|
15
15
|
} from "./helpers.js";
|
|
16
16
|
import { baseConfig } from "./webpack.base.babel.js";
|
|
17
|
+
import { wsPort } from "../server/utils.js";
|
|
18
|
+
import { createWSServer } from "../server/wsServer.js";
|
|
17
19
|
const __filename = fileURLToPath(import.meta.url);
|
|
18
20
|
const {
|
|
19
21
|
appVersion,
|
|
@@ -68,7 +70,7 @@ const devConfig = {
|
|
|
68
70
|
// Add development plugins
|
|
69
71
|
plugins: [
|
|
70
72
|
new HtmlWebpackPlugin({
|
|
71
|
-
inject: !isAppLoaderEnabled(),
|
|
73
|
+
inject: !isAppLoaderEnabled() ? "head" : false,
|
|
72
74
|
// Inject all files that are generated by webpack, e.g. bundle.js
|
|
73
75
|
template: !isAppLoaderEnabled() ? "app/index.html" : "app/index-app-loader.html",
|
|
74
76
|
emui: {
|
|
@@ -80,7 +82,8 @@ const devConfig = {
|
|
|
80
82
|
diagnosticsScriptPath,
|
|
81
83
|
encwLoaderScriptPath,
|
|
82
84
|
googleTagManager: isGoogleTagManagerEnabled()
|
|
83
|
-
}
|
|
85
|
+
},
|
|
86
|
+
scriptLoading: "defer"
|
|
84
87
|
}),
|
|
85
88
|
new CircularDependencyPlugin({
|
|
86
89
|
exclude: /a\.(js|ts|jsx|tsx)|node_modules/,
|
|
@@ -113,7 +116,7 @@ const devConfig = {
|
|
|
113
116
|
},
|
|
114
117
|
hot: true,
|
|
115
118
|
open: [basePath],
|
|
116
|
-
port: process.env.PORT
|
|
119
|
+
port: process.env.PORT ?? "auto",
|
|
117
120
|
setupMiddlewares: (middlewares, devServer) => {
|
|
118
121
|
if (devServer.app) {
|
|
119
122
|
setupDefaultMiddlewares(devServer.app);
|
|
@@ -130,6 +133,14 @@ const devConfig = {
|
|
|
130
133
|
}
|
|
131
134
|
next();
|
|
132
135
|
});
|
|
136
|
+
createWSServer({
|
|
137
|
+
port: wsPort
|
|
138
|
+
}).then(({ wsServer }) => {
|
|
139
|
+
if (devServer.app)
|
|
140
|
+
devServer.app.locals.wsServer = wsServer;
|
|
141
|
+
}).catch((err) => {
|
|
142
|
+
console.error(err);
|
|
143
|
+
});
|
|
133
144
|
}
|
|
134
145
|
return middlewares;
|
|
135
146
|
}
|
|
@@ -57,14 +57,22 @@ const baseConfig = (options) => ({
|
|
|
57
57
|
output: {
|
|
58
58
|
clean: true,
|
|
59
59
|
path: path.resolve(process.cwd(), "dist/umd"),
|
|
60
|
+
filename: "[name].js",
|
|
61
|
+
chunkFilename: "[name].[chunkhash].chunk.js",
|
|
62
|
+
assetModuleFilename: "assets/[name].[hash][ext][query]",
|
|
60
63
|
publicPath: "auto",
|
|
61
64
|
library: {
|
|
62
65
|
name: getLibraryVariableName(),
|
|
63
|
-
type: "
|
|
66
|
+
type: "var"
|
|
67
|
+
// type: 'module',
|
|
64
68
|
},
|
|
69
|
+
// module: true,
|
|
65
70
|
...options.output
|
|
66
71
|
},
|
|
67
72
|
// Merge with env dependent settings
|
|
73
|
+
// experiments: {
|
|
74
|
+
// outputModule: true,
|
|
75
|
+
// },
|
|
68
76
|
optimization: options.optimization,
|
|
69
77
|
module: {
|
|
70
78
|
rules: [
|
|
@@ -177,7 +185,7 @@ const baseConfig = (options) => ({
|
|
|
177
185
|
mainFields: ["browser", "module", "main"],
|
|
178
186
|
alias: {
|
|
179
187
|
...getAlias(),
|
|
180
|
-
...
|
|
188
|
+
...options.resolve?.alias ?? {}
|
|
181
189
|
},
|
|
182
190
|
plugins: [new ResolveTypeScriptPlugin({})]
|
|
183
191
|
},
|
|
@@ -186,9 +194,9 @@ const baseConfig = (options) => ({
|
|
|
186
194
|
"@elliemae/pui-app-loader": "emuiAppLoader",
|
|
187
195
|
"@elliemae/pui-diagnostics": "emuiDiagnostics"
|
|
188
196
|
},
|
|
189
|
-
devtool: options.devtool
|
|
190
|
-
performance: options.performance
|
|
191
|
-
devServer: options.devServer
|
|
197
|
+
devtool: options.devtool ?? "eval-source-map",
|
|
198
|
+
performance: options.performance ?? {},
|
|
199
|
+
devServer: options.devServer ?? {}
|
|
192
200
|
});
|
|
193
201
|
export {
|
|
194
202
|
baseConfig
|
|
@@ -5,7 +5,7 @@ import fg from "fast-glob";
|
|
|
5
5
|
import CircularDependencyPlugin from "circular-dependency-plugin";
|
|
6
6
|
import MiniCssExtractPlugin from "mini-css-extract-plugin";
|
|
7
7
|
import HtmlWebpackPlugin from "html-webpack-plugin";
|
|
8
|
-
import { getPaths } from "./helpers.js";
|
|
8
|
+
import { getPaths, getLibraryVariableName } from "./helpers.js";
|
|
9
9
|
import { baseConfig } from "./webpack.lib.base.babel.js";
|
|
10
10
|
const { basePath } = getPaths();
|
|
11
11
|
const getHtmlWebpackPlugins = () => {
|
|
@@ -14,17 +14,14 @@ const getHtmlWebpackPlugins = () => {
|
|
|
14
14
|
(htmlTemplateFile) => new HtmlWebpackPlugin({
|
|
15
15
|
template: htmlTemplateFile,
|
|
16
16
|
filename: path.basename(htmlTemplateFile),
|
|
17
|
-
inject:
|
|
17
|
+
inject: "head",
|
|
18
|
+
scriptLoading: "defer",
|
|
19
|
+
library: getLibraryVariableName()
|
|
18
20
|
})
|
|
19
21
|
);
|
|
20
22
|
};
|
|
21
23
|
var webpack_lib_dev_babel_default = baseConfig({
|
|
22
24
|
mode: "development",
|
|
23
|
-
// output: {
|
|
24
|
-
// filename: `js/${libraryName}.js`,
|
|
25
|
-
// chunkFilename: `js/${libraryName}.chunk.js`,
|
|
26
|
-
// assetModuleFilename: '[name][ext][query]',
|
|
27
|
-
// },
|
|
28
25
|
optimization: {
|
|
29
26
|
splitChunks: {
|
|
30
27
|
chunks: "all"
|
|
@@ -41,10 +38,7 @@ var webpack_lib_dev_babel_default = baseConfig({
|
|
|
41
38
|
failOnError: false
|
|
42
39
|
// show a warning when there is a circular dependency
|
|
43
40
|
}),
|
|
44
|
-
new MiniCssExtractPlugin({
|
|
45
|
-
// filename: `css/${libraryName}.css`,
|
|
46
|
-
// chunkFilename: `css/${libraryName}.chunk.css`,
|
|
47
|
-
}),
|
|
41
|
+
new MiniCssExtractPlugin({}),
|
|
48
42
|
new webpack.ProgressPlugin()
|
|
49
43
|
],
|
|
50
44
|
devtool: "eval-source-map",
|
|
@@ -62,7 +56,7 @@ var webpack_lib_dev_babel_default = baseConfig({
|
|
|
62
56
|
historyApiFallback: true,
|
|
63
57
|
hot: true,
|
|
64
58
|
open: [basePath],
|
|
65
|
-
port: process.env.PORT
|
|
59
|
+
port: process.env.PORT ?? "auto",
|
|
66
60
|
headers: {
|
|
67
61
|
"Access-Control-Allow-Origin": "*",
|
|
68
62
|
"Access-Control-Allow-Methods": "GET, POST, PUT, DELETE, PATCH, OPTIONS"
|
|
@@ -5,7 +5,11 @@ import HtmlWebpackPlugin from "html-webpack-plugin";
|
|
|
5
5
|
import { BundleAnalyzerPlugin } from "webpack-bundle-analyzer";
|
|
6
6
|
import { EsbuildPlugin } from "esbuild-loader";
|
|
7
7
|
import browserslistToEsbuild from "browserslist-to-esbuild";
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
getCompressionPlugins,
|
|
10
|
+
getLibraryName,
|
|
11
|
+
getLibraryVariableName
|
|
12
|
+
} from "./helpers.js";
|
|
9
13
|
import { baseConfig } from "./webpack.lib.base.babel.js";
|
|
10
14
|
const getHtmlWebpackPlugins = () => {
|
|
11
15
|
const htmlTemplateFiles = fg.sync([path.join(process.cwd(), "lib/*.html")]);
|
|
@@ -13,7 +17,9 @@ const getHtmlWebpackPlugins = () => {
|
|
|
13
17
|
(htmlTemplateFile) => new HtmlWebpackPlugin({
|
|
14
18
|
template: htmlTemplateFile,
|
|
15
19
|
filename: path.basename(htmlTemplateFile),
|
|
16
|
-
inject:
|
|
20
|
+
inject: "head",
|
|
21
|
+
scriptLoading: "defer",
|
|
22
|
+
library: getLibraryVariableName(),
|
|
17
23
|
minify: {
|
|
18
24
|
removeComments: true,
|
|
19
25
|
collapseWhitespace: true,
|
|
@@ -49,10 +55,7 @@ const prodConfig = {
|
|
|
49
55
|
},
|
|
50
56
|
plugins: [
|
|
51
57
|
...getHtmlWebpackPlugins(),
|
|
52
|
-
new MiniCssExtractPlugin({
|
|
53
|
-
// filename: `css/${libraryName}.[contenthash].css`,
|
|
54
|
-
// chunkFilename: `css/${libraryName}.[contenthash].chunk.css`,
|
|
55
|
-
}),
|
|
58
|
+
new MiniCssExtractPlugin({}),
|
|
56
59
|
...getCompressionPlugins(true),
|
|
57
60
|
new BundleAnalyzerPlugin({
|
|
58
61
|
analyzerMode: "static",
|
|
@@ -83,7 +83,7 @@ const {
|
|
|
83
83
|
basePath
|
|
84
84
|
} = getPaths();
|
|
85
85
|
const htmlWebpackPlugin = new HtmlWebpackPlugin({
|
|
86
|
-
inject: !isAppLoaderEnabled(),
|
|
86
|
+
inject: !isAppLoaderEnabled() ? "head" : false,
|
|
87
87
|
template: !isAppLoaderEnabled() ? "app/index.html" : "app/index-app-loader.html",
|
|
88
88
|
minify: {
|
|
89
89
|
removeComments: true,
|
|
@@ -106,7 +106,8 @@ const htmlWebpackPlugin = new HtmlWebpackPlugin({
|
|
|
106
106
|
diagnosticsScriptPath,
|
|
107
107
|
encwLoaderScriptPath,
|
|
108
108
|
googleTagManager: isGoogleTagManagerEnabled()
|
|
109
|
-
}
|
|
109
|
+
},
|
|
110
|
+
scriptLoading: "defer"
|
|
110
111
|
});
|
|
111
112
|
const config = baseConfig(getProdConfig());
|
|
112
113
|
if (config.plugins)
|
|
@@ -2,7 +2,7 @@ import webpack from "webpack";
|
|
|
2
2
|
import MiniCssExtractPlugin from "mini-css-extract-plugin";
|
|
3
3
|
import CopyWebpackPlugin from "copy-webpack-plugin";
|
|
4
4
|
import ResolveTypeScriptPlugin from "resolve-typescript-plugin";
|
|
5
|
-
import { getAlias, getCompressionPlugins } from "./helpers.js";
|
|
5
|
+
import { getAlias, getLibraryAlias, getCompressionPlugins } from "./helpers.js";
|
|
6
6
|
import { isApp } from "../utils.js";
|
|
7
7
|
const IS_APP = isApp();
|
|
8
8
|
const CWD = process.cwd();
|
|
@@ -63,15 +63,22 @@ const webpackFinal = (config, { configType }) => {
|
|
|
63
63
|
config.plugins = config?.plugins?.concat(getCompressionPlugins());
|
|
64
64
|
}
|
|
65
65
|
if (config.resolve) {
|
|
66
|
-
config.resolve.alias = {
|
|
66
|
+
config.resolve.alias = {
|
|
67
|
+
...config?.resolve?.alias,
|
|
68
|
+
...getAlias(),
|
|
69
|
+
...getLibraryAlias(
|
|
70
|
+
"@reduxjs/toolkit/query/react",
|
|
71
|
+
"@reduxjs/toolkit/dist/query/react/rtk-query-react.esm.js"
|
|
72
|
+
)
|
|
73
|
+
};
|
|
67
74
|
config.resolve.fallback = { ...config.resolve.fallback, crypto: false };
|
|
68
75
|
config.resolve.extensions?.push(".svg");
|
|
69
76
|
config.resolve.plugins = [
|
|
70
|
-
...config.resolve.plugins
|
|
77
|
+
...config.resolve.plugins ?? [],
|
|
71
78
|
new ResolveTypeScriptPlugin({})
|
|
72
79
|
];
|
|
73
80
|
}
|
|
74
|
-
config.externals = config.externals
|
|
81
|
+
config.externals = config.externals ?? {};
|
|
75
82
|
if (config.externals) {
|
|
76
83
|
config.externals["@elliemae/pui-user-monitoring"] = "emuiUserMonitoring";
|
|
77
84
|
config.externals["@elliemae/pui-app-loader"] = "emuiAppLoader";
|
|
@@ -79,14 +86,6 @@ const webpackFinal = (config, { configType }) => {
|
|
|
79
86
|
}
|
|
80
87
|
return config;
|
|
81
88
|
};
|
|
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() };
|
|
87
|
-
return config;
|
|
88
|
-
};
|
|
89
89
|
export {
|
|
90
|
-
managerWebpack,
|
|
91
90
|
webpackFinal
|
|
92
91
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { config as babelConfig };
|
|
2
2
|
declare namespace config {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
let ignore: RegExp[];
|
|
4
|
+
let sourceType: string;
|
|
5
|
+
let presets: (string | (string | {
|
|
6
6
|
modules: string | boolean;
|
|
7
7
|
targets: {
|
|
8
8
|
node: string;
|
|
@@ -17,7 +17,7 @@ declare namespace config {
|
|
|
17
17
|
})[] | (string | {
|
|
18
18
|
runtime: string;
|
|
19
19
|
})[])[];
|
|
20
|
-
|
|
20
|
+
let plugins: (string | (string | {
|
|
21
21
|
alias: {
|
|
22
22
|
'@': string;
|
|
23
23
|
};
|
|
@@ -29,13 +29,13 @@ declare namespace config {
|
|
|
29
29
|
})[])[];
|
|
30
30
|
namespace env {
|
|
31
31
|
namespace development {
|
|
32
|
-
|
|
32
|
+
let plugins_1: (string | (string | {
|
|
33
33
|
displayName: boolean;
|
|
34
34
|
})[])[];
|
|
35
35
|
export { plugins_1 as plugins };
|
|
36
36
|
}
|
|
37
37
|
namespace production {
|
|
38
|
-
|
|
38
|
+
let plugins_2: (string | (string | {
|
|
39
39
|
displayName: boolean;
|
|
40
40
|
pure: boolean;
|
|
41
41
|
})[] | (string | {
|
|
@@ -44,7 +44,7 @@ declare namespace config {
|
|
|
44
44
|
export { plugins_2 as plugins };
|
|
45
45
|
}
|
|
46
46
|
namespace test {
|
|
47
|
-
|
|
47
|
+
let plugins_3: (string | (string | {
|
|
48
48
|
displayName: boolean;
|
|
49
49
|
})[] | (string | {
|
|
50
50
|
requireDirective: boolean;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { CommandModule } from 'yargs';
|
|
2
|
-
|
|
2
|
+
interface Arguments {
|
|
3
3
|
fix: boolean;
|
|
4
4
|
watch: boolean;
|
|
5
5
|
debug: boolean;
|
|
6
6
|
passWithNoTests: boolean;
|
|
7
7
|
findReleatedTests: boolean;
|
|
8
8
|
silent: boolean;
|
|
9
|
-
|
|
9
|
+
coverage: string;
|
|
10
|
+
maxWorkers: string;
|
|
11
|
+
}
|
|
10
12
|
export declare const testCmd: CommandModule<Record<string, never>, Arguments>;
|
|
11
13
|
export {};
|