@elliemae/pui-cli 9.0.0-next.5 → 9.0.0-next.50
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/app.tsconfig.json +1 -1
- package/dist/cjs/babel.config.cjs +1 -1
- package/dist/cjs/cli.js +2 -2
- package/dist/cjs/commands/build.js +4 -6
- package/dist/cjs/commands/codemod.js +1 -1
- package/dist/cjs/commands/gendoc.js +2 -2
- package/dist/cjs/commands/lint.js +28 -11
- package/dist/cjs/commands/pack.js +3 -4
- package/dist/cjs/commands/start.js +3 -3
- package/dist/cjs/commands/storybook.js +1 -1
- package/dist/cjs/commands/test.js +46 -23
- package/dist/cjs/commands/tscheck.js +3 -3
- package/dist/cjs/commands/utils.js +37 -10
- package/dist/cjs/commands/version.js +1 -1
- package/dist/cjs/commands/vitest.js +6 -11
- package/dist/cjs/index.cjs +0 -2
- package/dist/cjs/index.js +4 -2
- 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/lint-staged.config.js +2 -2
- package/dist/cjs/lint-config/stylelint.config.js +45 -0
- package/dist/cjs/monorepo/delete-merged-tags.js +2 -3
- package/dist/cjs/monorepo/set-registry-version.js +3 -3
- package/dist/cjs/monorepo/set-workspace-version.js +3 -3
- package/dist/cjs/monorepo/utils.js +1 -1
- package/dist/cjs/pui-config.js +5 -6
- package/dist/cjs/release.config.js +46 -0
- package/dist/cjs/server/appRoutes.js +5 -8
- package/dist/cjs/server/csp.js +6 -5
- package/dist/cjs/server/index.js +6 -1
- package/dist/cjs/server/logger.js +2 -2
- package/dist/cjs/server/middlewares.js +5 -5
- package/dist/cjs/server/utils.js +12 -5
- package/dist/cjs/server/wsServer.js +125 -0
- package/dist/cjs/testing/ExtendedJSDomEnv.cjs +27 -0
- package/dist/cjs/testing/extended/axe-core/getMessageAndPass.js +36 -0
- package/dist/cjs/testing/extended/axe-core/index.js +24 -0
- package/dist/cjs/testing/extended/axe-core/reporter.js +50 -0
- package/dist/cjs/testing/extended/axe-core/shouldIgnoreNodeViolation.js +31 -0
- package/dist/cjs/testing/extended/axe-core/toHaveNoViolations.js +42 -0
- package/dist/cjs/testing/jest.config.cjs +6 -2
- package/dist/cjs/testing/jest.polyfills.cjs +30 -0
- package/dist/cjs/testing/mocks/svg.js +1 -1
- package/dist/cjs/testing/setup-react-env.js +1 -1
- package/dist/cjs/testing/setup-test-env.js +0 -2
- package/dist/cjs/testing/setup-tests.js +30 -12
- package/dist/cjs/testing/vitest.config.js +10 -10
- package/dist/cjs/transpile/.swcrc +1 -1
- package/dist/cjs/transpile/esbuild.js +48 -15
- package/dist/cjs/transpile/react-shim.js +1 -1
- package/dist/cjs/update-notifier.js +3 -3
- package/dist/cjs/utils.js +4 -5
- package/dist/cjs/webpack/helpers.js +29 -23
- package/dist/cjs/webpack/webpack.base.babel.js +21 -35
- package/dist/cjs/webpack/webpack.dev.babel.js +20 -10
- package/dist/cjs/webpack/webpack.lib.base.babel.js +22 -13
- package/dist/cjs/webpack/webpack.lib.dev.babel.js +14 -18
- package/dist/cjs/webpack/webpack.lib.prod.babel.js +12 -11
- package/dist/cjs/webpack/webpack.prod.babel.js +8 -8
- package/dist/cjs/webpack/webpack.storybook.js +15 -17
- package/dist/esm/babel.config.cjs +1 -1
- package/dist/esm/commands/build.js +2 -4
- package/dist/esm/commands/lint.js +27 -9
- package/dist/esm/commands/pack.js +1 -2
- package/dist/esm/commands/start.js +1 -1
- package/dist/esm/commands/test.js +45 -22
- package/dist/esm/commands/utils.js +33 -6
- package/dist/esm/commands/vitest.js +5 -10
- package/dist/esm/index.cjs +0 -2
- package/dist/esm/index.js +4 -2
- 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.js +25 -0
- package/dist/esm/monorepo/delete-merged-tags.js +2 -3
- package/dist/esm/monorepo/set-registry-version.js +1 -1
- package/dist/esm/monorepo/set-workspace-version.js +1 -1
- package/dist/esm/pui-config.js +2 -3
- package/dist/esm/release.config.js +26 -0
- package/dist/esm/server/appRoutes.js +3 -6
- 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 +95 -0
- package/dist/esm/testing/ExtendedJSDomEnv.cjs +27 -0
- package/dist/esm/testing/extended/axe-core/getMessageAndPass.js +16 -0
- package/dist/esm/testing/extended/axe-core/index.js +4 -0
- package/dist/esm/testing/extended/axe-core/reporter.js +30 -0
- package/dist/esm/testing/extended/axe-core/shouldIgnoreNodeViolation.js +11 -0
- package/dist/esm/testing/extended/axe-core/toHaveNoViolations.js +22 -0
- package/dist/esm/testing/jest.config.cjs +6 -2
- package/dist/esm/testing/jest.polyfills.cjs +30 -0
- package/dist/esm/testing/setup-test-env.js +0 -2
- package/dist/esm/testing/setup-tests.js +29 -11
- package/dist/esm/testing/vitest.config.js +8 -8
- package/dist/esm/transpile/.swcrc +1 -1
- package/dist/esm/transpile/esbuild.js +45 -12
- package/dist/esm/update-notifier.js +1 -1
- package/dist/esm/utils.js +2 -3
- package/dist/esm/webpack/helpers.js +25 -19
- package/dist/esm/webpack/webpack.base.babel.js +13 -27
- package/dist/esm/webpack/webpack.dev.babel.js +13 -3
- package/dist/esm/webpack/webpack.lib.base.babel.js +14 -5
- package/dist/esm/webpack/webpack.lib.dev.babel.js +9 -13
- package/dist/esm/webpack/webpack.lib.prod.babel.js +12 -7
- package/dist/esm/webpack/webpack.prod.babel.js +4 -4
- package/dist/esm/webpack/webpack.storybook.js +12 -14
- package/dist/types/docusaurus.config.d.ts +2 -0
- package/dist/types/{babel.config.d.cts → lib/babel.config.d.cts} +7 -7
- package/dist/types/{commands → lib/commands}/build.d.ts +2 -2
- package/dist/types/{commands → lib/commands}/codemod.d.ts +2 -2
- package/dist/types/{commands → lib/commands}/lint.d.ts +3 -2
- package/dist/types/{commands → lib/commands}/pack.d.ts +2 -2
- package/dist/types/{commands → lib/commands}/start.d.ts +2 -2
- package/dist/types/{commands → lib/commands}/storybook.d.ts +2 -2
- package/dist/types/{commands → lib/commands}/test.d.ts +4 -2
- package/dist/types/{commands → lib/commands}/tscheck.d.ts +2 -2
- package/dist/types/lib/commands/utils.d.ts +39 -0
- package/dist/types/{commands → lib/commands}/version.d.ts +2 -2
- package/dist/types/{commands → lib/commands}/vitest.d.ts +2 -2
- package/dist/types/{index.d.cts → lib/index.d.cts} +1 -2
- package/dist/types/{index.d.ts → lib/index.d.ts} +3 -1
- package/dist/types/{lint-config → lib/lint-config}/commitlint.config.d.cts +1 -1
- package/dist/types/{lint-config → lib/lint-config}/eslint/common.d.cts +18 -12
- package/dist/types/{lint-config → lib/lint-config}/eslint/non-react.d.cts +8 -1
- package/dist/types/{lint-config → lib/lint-config}/eslint/react.d.cts +8 -1
- package/dist/types/{lint-config → lib/lint-config}/eslint/typescript/common.d.cts +6 -6
- package/dist/types/{lint-config → lib/lint-config}/eslint/typescript/non-react.d.cts +9 -2
- package/dist/types/{lint-config → lib/lint-config}/eslint/typescript/react.d.cts +9 -2
- package/dist/types/lib/lint-config/lint-staged.config.d.ts +5 -0
- package/dist/types/lib/lint-config/prettier.config.d.cts +8 -0
- package/dist/types/lib/lint-config/stylelint.config.d.ts +13 -0
- package/dist/types/lib/release.config.d.ts +10 -0
- package/dist/types/{server → lib/server}/csp.d.ts +2 -2
- package/dist/types/{server → lib/server}/utils.d.ts +1 -0
- package/dist/types/lib/server/wsServer.d.ts +13 -0
- package/dist/types/lib/testing/ExtendedJSDomEnv.d.cts +5 -0
- package/dist/types/lib/testing/extended/axe-core/getMessageAndPass.d.ts +8 -0
- package/dist/types/lib/testing/extended/axe-core/index.d.ts +1 -0
- package/dist/types/lib/testing/extended/axe-core/reporter.d.ts +2 -0
- package/dist/types/lib/testing/extended/axe-core/shouldIgnoreNodeViolation.d.ts +2 -0
- package/dist/types/lib/testing/extended/axe-core/toHaveNoViolations.d.ts +12 -0
- package/dist/types/lib/testing/jest.config.d.cts +45 -0
- package/dist/types/{testing → lib/testing}/jest.node.config.d.cts +4 -0
- package/dist/types/lib/testing/mocks/axios.d.ts +17 -0
- package/dist/types/{testing → lib/testing}/mocks/pui-diagnostics.d.ts +13 -13
- package/dist/types/lib/testing/setup-tests.d.ts +1 -0
- package/dist/types/lib/testing/vitest.config.d.ts +1 -0
- package/dist/types/lib/tests/basic.test.d.ts +0 -0
- package/dist/types/{transpile → lib/transpile}/esbuild.d.ts +3 -3
- package/dist/types/lib/typedoc.d.cts +3 -0
- package/dist/types/{webpack → lib/webpack}/helpers.d.ts +4 -1
- package/dist/types/{webpack → lib/webpack}/webpack.storybook.d.ts +0 -1
- package/nx.json +97 -0
- package/package.json +209 -193
- package/dist/cjs/lint-config/stylelint.config.cjs +0 -19
- package/dist/cjs/release.config.cjs +0 -24
- package/dist/esm/lint-config/stylelint.config.cjs +0 -19
- package/dist/esm/release.config.cjs +0 -24
- package/dist/types/commands/utils.d.ts +0 -17
- package/dist/types/lint-config/lint-staged.config.d.ts +0 -5
- package/dist/types/lint-config/prettier.config.d.cts +0 -8
- package/dist/types/lint-config/stylelint.config.d.cts +0 -10
- package/dist/types/release.config.d.cts +0 -7
- package/dist/types/testing/jest.config.d.cts +0 -41
- package/dist/types/testing/mocks/axios.d.ts +0 -17
- package/dist/types/testing/vitest.config.d.ts +0 -1
- package/dist/types/typedoc.d.cts +0 -3
- /package/dist/types/{cli.d.ts → lib/cli.d.ts} +0 -0
- /package/dist/types/{commands → lib/commands}/gendoc.d.ts +0 -0
- /package/dist/types/{dummy.d.ts → lib/dummy.d.ts} +0 -0
- /package/dist/types/{monorepo → lib/monorepo}/delete-merged-tags.d.ts +0 -0
- /package/dist/types/{monorepo → lib/monorepo}/set-registry-version.d.ts +0 -0
- /package/dist/types/{monorepo → lib/monorepo}/set-workspace-version.d.ts +0 -0
- /package/dist/types/{monorepo → lib/monorepo}/utils.d.cts +0 -0
- /package/dist/types/{monorepo → lib/monorepo}/utils.d.ts +0 -0
- /package/dist/types/{pui-config.d.ts → lib/pui-config.d.ts} +0 -0
- /package/dist/types/{server → lib/server}/appRoutes.d.ts +0 -0
- /package/dist/types/{server → lib/server}/index.d.ts +0 -0
- /package/dist/types/{server → lib/server}/logger.d.ts +0 -0
- /package/dist/types/{server → lib/server}/middlewares.d.ts +0 -0
- /package/dist/types/{testing/setup-react-env.d.ts → lib/testing/jest.polyfills.d.cts} +0 -0
- /package/dist/types/{testing → lib/testing}/mocks/cssModule.d.ts +0 -0
- /package/dist/types/{testing → lib/testing}/mocks/html.d.ts +0 -0
- /package/dist/types/{testing → lib/testing}/mocks/image.d.ts +0 -0
- /package/dist/types/{testing → lib/testing}/mocks/matchMedia.d.ts +0 -0
- /package/dist/types/{testing → lib/testing}/mocks/pui-app-loader.d.ts +0 -0
- /package/dist/types/{testing → lib/testing}/mocks/pui-user-monitoring.d.ts +0 -0
- /package/dist/types/{testing → lib/testing}/mocks/retry-axios.d.ts +0 -0
- /package/dist/types/{testing → lib/testing}/mocks/svg.d.ts +0 -0
- /package/dist/types/{testing → lib/testing}/mocks/webpack-hmr.d.ts +0 -0
- /package/dist/types/{testing → lib/testing}/resolver.d.cts +0 -0
- /package/dist/types/{testing/setup-test-env.d.ts → lib/testing/setup-react-env.d.ts} +0 -0
- /package/dist/types/{testing/setup-tests.d.ts → lib/testing/setup-test-env.d.ts} +0 -0
- /package/dist/types/{transpile → lib/transpile}/react-shim.d.ts +0 -0
- /package/dist/types/{transpile → lib/transpile}/swcrc.config.d.cts +0 -0
- /package/dist/types/{update-notifier.d.ts → lib/update-notifier.d.ts} +0 -0
- /package/dist/types/{utils.d.cts → lib/utils.d.cts} +0 -0
- /package/dist/types/{utils.d.ts → lib/utils.d.ts} +0 -0
- /package/dist/types/{webpack → lib/webpack}/webpack.base.babel.d.ts +0 -0
- /package/dist/types/{webpack → lib/webpack}/webpack.dev.babel.d.ts +0 -0
- /package/dist/types/{webpack → lib/webpack}/webpack.lib.base.babel.d.ts +0 -0
- /package/dist/types/{webpack → lib/webpack}/webpack.lib.dev.babel.d.ts +0 -0
- /package/dist/types/{webpack → lib/webpack}/webpack.lib.prod.babel.d.ts +0 -0
- /package/dist/types/{webpack → lib/webpack}/webpack.prod.babel.d.ts +0 -0
|
@@ -3,7 +3,7 @@ const cwd = process.cwd();
|
|
|
3
3
|
const execaOptions = { cwd, stdio: "inherit" };
|
|
4
4
|
const semVerRegEx = /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/;
|
|
5
5
|
const isSemVersion = (tagName) => semVerRegEx.test(tagName);
|
|
6
|
-
const branchName = (process.env.BRANCH_NAME
|
|
6
|
+
const branchName = (process.env.BRANCH_NAME ?? "master").toLowerCase();
|
|
7
7
|
const branchTags = {
|
|
8
8
|
master: /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/,
|
|
9
9
|
next: /^v.*-next\.(0|[1-9]\d*)/,
|
|
@@ -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
|
};
|
|
@@ -2,7 +2,7 @@ import { readFile, writeFile } from "node:fs/promises";
|
|
|
2
2
|
import fg from "fast-glob";
|
|
3
3
|
import normalizePath from "normalize-path";
|
|
4
4
|
import { findMonoRepoRoot } from "./utils.js";
|
|
5
|
-
const monorepoRoot = normalizePath(findMonoRepoRoot()
|
|
5
|
+
const monorepoRoot = normalizePath(findMonoRepoRoot() ?? "");
|
|
6
6
|
const setRegistryVersion = async () => {
|
|
7
7
|
const files = await fg([
|
|
8
8
|
`${monorepoRoot}/libs/*/package.json`,
|
|
@@ -2,7 +2,7 @@ import { readFile, writeFile } from "node:fs/promises";
|
|
|
2
2
|
import fg from "fast-glob";
|
|
3
3
|
import normalizePath from "normalize-path";
|
|
4
4
|
import { findMonoRepoRoot } from "./utils.js";
|
|
5
|
-
const monorepoRoot = normalizePath(findMonoRepoRoot()
|
|
5
|
+
const monorepoRoot = normalizePath(findMonoRepoRoot() ?? "");
|
|
6
6
|
const setWorkspaceVersion = async () => {
|
|
7
7
|
const files = await fg([
|
|
8
8
|
`${monorepoRoot}/libs/*/package.json`,
|
package/dist/esm/pui-config.js
CHANGED
|
@@ -3,13 +3,12 @@ import fs from "node:fs";
|
|
|
3
3
|
import { merge } from "lodash";
|
|
4
4
|
const baseConfig = {
|
|
5
5
|
esBuild: {
|
|
6
|
-
target: "
|
|
6
|
+
target: "es2022"
|
|
7
7
|
}
|
|
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
|
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
var release_config_default = {
|
|
2
|
+
branches: [
|
|
3
|
+
"+([0-9])?(.{+([0-9]),x}).x",
|
|
4
|
+
"master",
|
|
5
|
+
"next-major",
|
|
6
|
+
{ name: "beta", prerelease: true },
|
|
7
|
+
{ name: "alpha", prerelease: true },
|
|
8
|
+
{ name: "hotfix", prerelease: true },
|
|
9
|
+
{ name: "next", prerelease: true }
|
|
10
|
+
],
|
|
11
|
+
plugins: [
|
|
12
|
+
"@semantic-release/commit-analyzer",
|
|
13
|
+
"@semantic-release/release-notes-generator",
|
|
14
|
+
[
|
|
15
|
+
"@semantic-release/changelog",
|
|
16
|
+
{
|
|
17
|
+
changelogTitle: "# Changelog\n\nAll notable changes to this project will be documented in this file. See\n[Conventional Commits](https://conventionalcommits.org) for commit guidelines."
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"@semantic-release/npm",
|
|
21
|
+
"@semantic-release/github"
|
|
22
|
+
]
|
|
23
|
+
};
|
|
24
|
+
export {
|
|
25
|
+
release_config_default as default
|
|
26
|
+
};
|
|
@@ -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}`
|
package/dist/esm/server/csp.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import path from "node:path";
|
|
3
|
+
import crypto from "crypto";
|
|
3
4
|
import express from "express";
|
|
4
5
|
import cspPolicy from "helmet-csp";
|
|
5
|
-
import crypto from "crypto";
|
|
6
6
|
const CSP_REPORT_URI = "/diagnostics/v1/csp";
|
|
7
7
|
const sources = [
|
|
8
8
|
"'self'",
|
|
9
9
|
"http://localhost:*",
|
|
10
|
+
"ws://localhost:*",
|
|
10
11
|
"*.elliemae.io",
|
|
11
12
|
"*.elliemae.com",
|
|
12
13
|
"*.elliservices.com",
|
package/dist/esm/server/index.js
CHANGED
|
@@ -4,8 +4,9 @@ import {
|
|
|
4
4
|
setupDefaultMiddlewares,
|
|
5
5
|
setupAdditionalMiddlewars
|
|
6
6
|
} from "./middlewares.js";
|
|
7
|
-
import { port, host } from "./utils.js";
|
|
7
|
+
import { port, wsPort, host } from "./utils.js";
|
|
8
8
|
import { loadRoutes } from "./appRoutes.js";
|
|
9
|
+
import { createWSServer } from "./wsServer.js";
|
|
9
10
|
(async function startServer() {
|
|
10
11
|
const app = express();
|
|
11
12
|
setupDefaultMiddlewares(app);
|
|
@@ -17,4 +18,8 @@ import { loadRoutes } from "./appRoutes.js";
|
|
|
17
18
|
logger.error(err);
|
|
18
19
|
process.exit(1);
|
|
19
20
|
});
|
|
21
|
+
const { wsServer } = await createWSServer({
|
|
22
|
+
port: wsPort
|
|
23
|
+
});
|
|
24
|
+
app.locals.wsServer = wsServer;
|
|
20
25
|
})();
|
package/dist/esm/server/utils.js
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import minimist from "minimist";
|
|
2
|
-
const argv = minimist(
|
|
2
|
+
const argv = minimist(
|
|
3
|
+
process.argv.slice(2)
|
|
4
|
+
);
|
|
3
5
|
const getCWD = () => process.cwd();
|
|
4
6
|
const port = parseInt(
|
|
5
|
-
argv.port
|
|
7
|
+
argv.port ?? process.env.port ?? process.env.PORT ?? "3000",
|
|
8
|
+
10
|
|
9
|
+
);
|
|
10
|
+
const host = argv.host ?? process.env.HOST ?? "localhost";
|
|
11
|
+
const wsPort = parseInt(
|
|
12
|
+
argv.wsport ?? process.env.wsport ?? process.env.WSPORT ?? "5000",
|
|
6
13
|
10
|
|
7
14
|
);
|
|
8
|
-
const host = argv.host || process.env.HOST || "localhost";
|
|
9
15
|
export {
|
|
10
16
|
getCWD,
|
|
11
17
|
host,
|
|
12
|
-
port
|
|
18
|
+
port,
|
|
19
|
+
wsPort
|
|
13
20
|
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import http from "node:http";
|
|
2
|
+
import * as wsLib from "ws";
|
|
3
|
+
const PING_INTERVAL = 3e4;
|
|
4
|
+
const DEFAULT_PORT = 5001;
|
|
5
|
+
const onSocketError = (err) => {
|
|
6
|
+
console.error(err);
|
|
7
|
+
};
|
|
8
|
+
const authenticate = (token, cb) => {
|
|
9
|
+
if (!token) cb(4401);
|
|
10
|
+
else cb();
|
|
11
|
+
};
|
|
12
|
+
const getAuthToken = (protocols) => {
|
|
13
|
+
const authProtocol = protocols.find(
|
|
14
|
+
(protocol) => protocol.startsWith("auth--")
|
|
15
|
+
);
|
|
16
|
+
if (!authProtocol) return "";
|
|
17
|
+
return authProtocol.split("--")[1]?.trim?.();
|
|
18
|
+
};
|
|
19
|
+
const createWSServer = ({
|
|
20
|
+
port = DEFAULT_PORT,
|
|
21
|
+
pingInterval = PING_INTERVAL,
|
|
22
|
+
onOpen
|
|
23
|
+
}) => {
|
|
24
|
+
let isAlive = false;
|
|
25
|
+
const heartbeat = () => {
|
|
26
|
+
isAlive = true;
|
|
27
|
+
};
|
|
28
|
+
const httpServer = http.createServer();
|
|
29
|
+
const wsServer = new wsLib.WebSocketServer({ noServer: true });
|
|
30
|
+
httpServer.on("upgrade", (req, socket, head) => {
|
|
31
|
+
socket.on("error", onSocketError);
|
|
32
|
+
wsServer.handleUpgrade(req, socket, head, (ws) => {
|
|
33
|
+
const protocols = req.headers["sec-websocket-protocol"]?.split(",");
|
|
34
|
+
if (!protocols) {
|
|
35
|
+
console.error("no protocols");
|
|
36
|
+
ws.close(4401, "unauthorized");
|
|
37
|
+
socket.destroy();
|
|
38
|
+
socket.removeListener("error", onSocketError);
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
authenticate(getAuthToken(protocols) || "", (errCode) => {
|
|
42
|
+
if (errCode) {
|
|
43
|
+
switch (errCode) {
|
|
44
|
+
case 4401:
|
|
45
|
+
ws.close(errCode, "unauthorized");
|
|
46
|
+
break;
|
|
47
|
+
default:
|
|
48
|
+
ws.close(4400, "Unknown error");
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
socket.destroy();
|
|
52
|
+
socket.removeListener("error", onSocketError);
|
|
53
|
+
} else {
|
|
54
|
+
socket.removeListener("error", onSocketError);
|
|
55
|
+
wsServer.emit("connection", ws, req);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
wsServer.on("connection", (ws) => {
|
|
61
|
+
isAlive = true;
|
|
62
|
+
ws.on("error", console.error);
|
|
63
|
+
ws.on("pong", () => {
|
|
64
|
+
heartbeat();
|
|
65
|
+
});
|
|
66
|
+
ws.on("message", (message) => {
|
|
67
|
+
console.log(
|
|
68
|
+
"message from client:",
|
|
69
|
+
JSON.parse(message)
|
|
70
|
+
);
|
|
71
|
+
ws.send(JSON.stringify(JSON.parse(message)));
|
|
72
|
+
});
|
|
73
|
+
console.log("client connected");
|
|
74
|
+
onOpen?.(ws);
|
|
75
|
+
});
|
|
76
|
+
const interval = setInterval(() => {
|
|
77
|
+
wsServer.clients.forEach((ws) => {
|
|
78
|
+
if (isAlive === false) ws.terminate();
|
|
79
|
+
isAlive = false;
|
|
80
|
+
ws.ping();
|
|
81
|
+
});
|
|
82
|
+
}, pingInterval);
|
|
83
|
+
wsServer.on("close", function close() {
|
|
84
|
+
clearInterval(interval);
|
|
85
|
+
});
|
|
86
|
+
return new Promise((resolve) => {
|
|
87
|
+
httpServer.listen(port, () => {
|
|
88
|
+
console.log(`Websocket server listening on port ${port}`);
|
|
89
|
+
return resolve({ httpServer, wsServer });
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
export {
|
|
94
|
+
createWSServer
|
|
95
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const { TestEnvironment } = require('jest-environment-jsdom');
|
|
2
|
+
|
|
3
|
+
// ICE platform is meant to be run on node > 18
|
|
4
|
+
// "jest-environment-jsdom": "~29.6.3" is instead meant to support node >16
|
|
5
|
+
// features that are supported since node 17 & 18 are not supported in jsdom env
|
|
6
|
+
// the limitation is not relevant for us since we are already running on node 18 anyway,
|
|
7
|
+
// this "ExtendedJSDomEnv" is an extension of the
|
|
8
|
+
// jest.config.cjs
|
|
9
|
+
// {
|
|
10
|
+
// ...
|
|
11
|
+
// testEnvironment: 'jsdom'
|
|
12
|
+
// ...
|
|
13
|
+
// }
|
|
14
|
+
// that actually uses node 18 features that are not supported in "jest-environment-jsdom": "~29.6.3"
|
|
15
|
+
|
|
16
|
+
// https://github.com/facebook/jest/blob/v29.4.3/website/versioned_docs/version-29.4/Configuration.md#testenvironment-string
|
|
17
|
+
class FixJSDOMEnvironment extends TestEnvironment {
|
|
18
|
+
constructor(...args) {
|
|
19
|
+
super(...args);
|
|
20
|
+
|
|
21
|
+
// From here on we are using "node" (currently running version of it) to polyfill jsdom this.global
|
|
22
|
+
|
|
23
|
+
// FIXME https://github.com/jsdom/jsdom/issues/3363
|
|
24
|
+
if (structuredClone) this.global.structuredClone = structuredClone;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
module.exports = FixJSDOMEnvironment;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { matcherHint } from "jest-matcher-utils";
|
|
2
|
+
import { reporter } from "./reporter.js";
|
|
3
|
+
const getMessageAndPass = (violations) => {
|
|
4
|
+
const formatedViolations = reporter(violations);
|
|
5
|
+
const pass = formatedViolations.length === 0;
|
|
6
|
+
if (pass) return { message: () => "", pass };
|
|
7
|
+
return {
|
|
8
|
+
message: () => `${matcherHint(".toHaveNoViolations")}
|
|
9
|
+
|
|
10
|
+
${formatedViolations}`,
|
|
11
|
+
pass
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export {
|
|
15
|
+
getMessageAndPass
|
|
16
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { printReceived } from "jest-matcher-utils";
|
|
2
|
+
const colorYellow = (arg) => `\x1B[93m ${arg ?? ""} \x1B[0m`;
|
|
3
|
+
const colorGrey = (arg) => `\x1B[90m ${arg ?? ""} \x1B[0m`;
|
|
4
|
+
const colorBlue = (arg) => `\x1B[34m ${arg ?? ""} \x1B[0m`;
|
|
5
|
+
const reporter = (violToFormat) => {
|
|
6
|
+
if (violToFormat.length === 0) return "";
|
|
7
|
+
const lineBreak = "\n\n";
|
|
8
|
+
const horizontalLine = "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500";
|
|
9
|
+
return violToFormat.map((violation) => {
|
|
10
|
+
const errorBody = violation.nodes.map((node) => {
|
|
11
|
+
const selector = node.target.join(", ");
|
|
12
|
+
const expectedText = `Expected the HTML found at $('${selector}') to have no violations:${lineBreak}`;
|
|
13
|
+
let violationHelpUrl = "";
|
|
14
|
+
if (violation.helpUrl)
|
|
15
|
+
violationHelpUrl = `You can find more information on this issue here:
|
|
16
|
+
${colorBlue(
|
|
17
|
+
violation.helpUrl
|
|
18
|
+
)}`;
|
|
19
|
+
return `${expectedText + colorGrey(node.html) + lineBreak}Received:${lineBreak}${printReceived(
|
|
20
|
+
`${violation.help} (${violation.id})`
|
|
21
|
+
)}${lineBreak}${colorYellow(
|
|
22
|
+
node.failureSummary
|
|
23
|
+
)}${lineBreak}${violationHelpUrl}`;
|
|
24
|
+
}).join(lineBreak);
|
|
25
|
+
return errorBody;
|
|
26
|
+
}).join(lineBreak + horizontalLine + lineBreak);
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
reporter
|
|
30
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
const dataAttributeRegexp = /(data-[\S]*)=["']([\S]*)["']/gm;
|
|
2
|
+
const shouldIgnoreNodeViolation = (node, violation) => [...node.html.matchAll(dataAttributeRegexp)].map(([fullMatch, dataKey, dataValue]) => ({
|
|
3
|
+
fullMatch,
|
|
4
|
+
dataKey,
|
|
5
|
+
dataValue
|
|
6
|
+
})).some(
|
|
7
|
+
({ dataKey, dataValue }) => dataKey === `data-axe-ignore-${violation.id}` && dataValue === "true"
|
|
8
|
+
);
|
|
9
|
+
export {
|
|
10
|
+
shouldIgnoreNodeViolation
|
|
11
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { getMessageAndPass } from "./getMessageAndPass.js";
|
|
2
|
+
import { shouldIgnoreNodeViolation } from "./shouldIgnoreNodeViolation.js";
|
|
3
|
+
const toHaveNoViolations = {
|
|
4
|
+
toHaveNoViolations(results) {
|
|
5
|
+
const { violations } = results;
|
|
6
|
+
const finalViolations = [];
|
|
7
|
+
violations.forEach((violation) => {
|
|
8
|
+
const { nodes } = violation;
|
|
9
|
+
const newNodes = [];
|
|
10
|
+
nodes.forEach((node) => {
|
|
11
|
+
if (!shouldIgnoreNodeViolation(node, violation)) newNodes.push(node);
|
|
12
|
+
});
|
|
13
|
+
if (newNodes.length > 0) {
|
|
14
|
+
finalViolations.push({ ...violation, nodes: newNodes });
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
return { actual: violations, ...getMessageAndPass(finalViolations) };
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
toHaveNoViolations
|
|
22
|
+
};
|
|
@@ -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,13 +93,15 @@ 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',
|
|
99
102
|
],
|
|
100
103
|
testTimeout: 5000,
|
|
104
|
+
prettierPath: null,
|
|
101
105
|
};
|
|
102
106
|
|
|
103
107
|
if (isReactModule && jestConfig.setupFilesAfterEnv)
|
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
const { ReadableStream } = require('node:stream/web');
|
|
12
|
+
|
|
13
|
+
Object.defineProperties(globalThis, {
|
|
14
|
+
TextDecoder: { value: TextDecoder },
|
|
15
|
+
TextEncoder: { value: TextEncoder },
|
|
16
|
+
ReadableStream: { value: ReadableStream },
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const { Blob, File } = require('node:buffer');
|
|
20
|
+
const { fetch, Headers, FormData, Request, Response } = require('undici');
|
|
21
|
+
|
|
22
|
+
Object.defineProperties(globalThis, {
|
|
23
|
+
fetch: { value: fetch, writable: true },
|
|
24
|
+
Blob: { value: Blob },
|
|
25
|
+
File: { value: File },
|
|
26
|
+
Headers: { value: Headers },
|
|
27
|
+
FormData: { value: FormData },
|
|
28
|
+
Request: { value: Request },
|
|
29
|
+
Response: { value: Response },
|
|
30
|
+
});
|
|
@@ -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;
|
|
@@ -24,23 +23,19 @@ console.error = (...args) => {
|
|
|
24
23
|
return false;
|
|
25
24
|
return originalError(...args);
|
|
26
25
|
};
|
|
27
|
-
if (expect)
|
|
28
|
-
expect.extend(jestAxe.toHaveNoViolations);
|
|
26
|
+
if (expect) expect.extend(toHaveNoViolations);
|
|
29
27
|
const addElementToBody = (element) => {
|
|
30
28
|
const documentEle = (window || {}).document;
|
|
31
|
-
if (!documentEle)
|
|
32
|
-
return null;
|
|
29
|
+
if (!documentEle) return null;
|
|
33
30
|
const bodyEle = documentEle.body;
|
|
34
31
|
const newEle = documentEle.createElement(...element);
|
|
35
|
-
if (!newEle)
|
|
36
|
-
return null;
|
|
32
|
+
if (!newEle) return null;
|
|
37
33
|
bodyEle.appendChild(newEle);
|
|
38
34
|
return newEle;
|
|
39
35
|
};
|
|
40
36
|
const addRootElement = (id) => {
|
|
41
37
|
const rootEle = addElementToBody("div");
|
|
42
|
-
if (rootEle)
|
|
43
|
-
rootEle.id = id;
|
|
38
|
+
if (rootEle) rootEle.id = id;
|
|
44
39
|
};
|
|
45
40
|
addRootElement("root");
|
|
46
41
|
addMatchMedia();
|
|
@@ -49,3 +44,26 @@ window.emui = {
|
|
|
49
44
|
logger: logger(),
|
|
50
45
|
_BASE_PATH: new URL(document.baseURI).pathname
|
|
51
46
|
};
|
|
47
|
+
let showCorejsWarn = false;
|
|
48
|
+
afterAll(() => {
|
|
49
|
+
if (showCorejsWarn) {
|
|
50
|
+
console.warn(
|
|
51
|
+
`IMPORTANT: Try importing core-js/stable in your failed test files and retrying.
|
|
52
|
+
Some tests might have failed because of it`
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
const originalTest = global.test;
|
|
57
|
+
global.it = (name, fn, timeout = void 0) => {
|
|
58
|
+
const fnWrapper = async () => {
|
|
59
|
+
try {
|
|
60
|
+
await fn();
|
|
61
|
+
} catch (error) {
|
|
62
|
+
showCorejsWarn = true;
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
originalTest(name, fnWrapper, timeout);
|
|
67
|
+
};
|
|
68
|
+
global.it.skip = originalTest.skip;
|
|
69
|
+
global.it.only = originalTest.only;
|
|
@@ -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,15 +1,40 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { fileURLToPath } from "node:url";
|
|
3
|
-
import fg from "fast-glob";
|
|
4
|
-
import { build } from "esbuild";
|
|
5
3
|
import { writeFile, copyFile, readFile, mkdir } from "node:fs/promises";
|
|
6
4
|
import browserslistToEsbuild from "browserslist-to-esbuild";
|
|
5
|
+
import fg from "fast-glob";
|
|
6
|
+
import { build } from "esbuild";
|
|
7
7
|
import lodashTransformer from "esbuild-plugin-lodash";
|
|
8
|
+
const readPkgJson = async () => {
|
|
9
|
+
const pkgJsonPath = path.join(process.cwd(), "package.json");
|
|
10
|
+
const pkgJson = JSON.parse(await readFile(pkgJsonPath, "utf8"));
|
|
11
|
+
return pkgJson;
|
|
12
|
+
};
|
|
13
|
+
const writePkgJson = async (pkgJson) => {
|
|
14
|
+
const pkgJsonPath = path.join(process.cwd(), "package.json");
|
|
15
|
+
await writeFile(pkgJsonPath, JSON.stringify(pkgJson, null, 2));
|
|
16
|
+
};
|
|
17
|
+
const removeModuleType = async () => {
|
|
18
|
+
const pkgJson = await readPkgJson();
|
|
19
|
+
const prevModuleType = pkgJson.type;
|
|
20
|
+
if (pkgJson.type) {
|
|
21
|
+
delete pkgJson.type;
|
|
22
|
+
await writePkgJson(pkgJson);
|
|
23
|
+
}
|
|
24
|
+
return prevModuleType;
|
|
25
|
+
};
|
|
26
|
+
const restoreModuleType = async (typeValue) => {
|
|
27
|
+
if (typeValue) {
|
|
28
|
+
const pkgJson = await readPkgJson();
|
|
29
|
+
pkgJson.type = typeValue;
|
|
30
|
+
await writePkgJson(pkgJson);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
8
33
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
9
34
|
const TARGETS = {
|
|
10
35
|
browserslist: browserslistToEsbuild(),
|
|
11
|
-
web: "
|
|
12
|
-
node: "
|
|
36
|
+
web: "es2022",
|
|
37
|
+
node: "node20"
|
|
13
38
|
};
|
|
14
39
|
const ESBUILD_FORMAT = {
|
|
15
40
|
CJS: "cjs",
|
|
@@ -77,16 +102,24 @@ const esBuild = async ({
|
|
|
77
102
|
if (!esmOnly) {
|
|
78
103
|
const cjsOutdir = `${outdir}/cjs`;
|
|
79
104
|
const commonJSEntryPoints = await fg(inputFiles);
|
|
80
|
-
await
|
|
81
|
-
|
|
82
|
-
|
|
105
|
+
const typeValue = await removeModuleType();
|
|
106
|
+
try {
|
|
107
|
+
await build({
|
|
108
|
+
entryPoints: commonJSEntryPoints,
|
|
109
|
+
...getCommonConfig({ injectReactShim }),
|
|
110
|
+
outdir: cjsOutdir,
|
|
111
|
+
format: ESBUILD_FORMAT.CJS,
|
|
112
|
+
target,
|
|
113
|
+
plugins: [lodashTransformer()]
|
|
114
|
+
});
|
|
115
|
+
} finally {
|
|
116
|
+
await restoreModuleType(typeValue);
|
|
117
|
+
}
|
|
118
|
+
await copyFiles({ srcdir, outdir: cjsOutdir });
|
|
119
|
+
await createPackageJson({
|
|
83
120
|
outdir: cjsOutdir,
|
|
84
|
-
|
|
85
|
-
target,
|
|
86
|
-
plugins: [lodashTransformer()]
|
|
121
|
+
type: NODE_MODULE_TYPES.CJS
|
|
87
122
|
});
|
|
88
|
-
await copyFiles({ srcdir, outdir: cjsOutdir });
|
|
89
|
-
await createPackageJson({ outdir: cjsOutdir, type: NODE_MODULE_TYPES.CJS });
|
|
90
123
|
}
|
|
91
124
|
const esmOutdir = esmOnly ? outdir : `${outdir}/esm`;
|
|
92
125
|
const entryPoints = await fg(
|
|
@@ -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);
|