@elliemae/pui-cli 7.0.0-alpha.1 → 7.0.0-alpha.4
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/{lib/babel/babel.config.js → dist/cjs/babel/babel.config.cjs} +2 -2
- package/dist/cjs/cli-commands/build.js +72 -0
- package/dist/cjs/cli-commands/codemod.js +51 -0
- package/dist/cjs/cli-commands/gendoc.js +52 -0
- package/dist/cjs/cli-commands/lint.js +86 -0
- package/dist/cjs/cli-commands/pack.js +88 -0
- package/dist/cjs/cli-commands/start.js +61 -0
- package/dist/cjs/cli-commands/storybook.js +63 -0
- package/dist/cjs/cli-commands/test.js +86 -0
- package/dist/cjs/cli-commands/tsc.js +103 -0
- package/dist/cjs/cli-commands/utils.js +137 -0
- package/dist/cjs/cli-commands/version.js +71 -0
- package/dist/cjs/cli-commands/vitest.js +84 -0
- package/dist/cjs/cli.js +47 -0
- package/dist/cjs/docgen/jsdoc.conf.json +17 -0
- package/{lib/dummy.ts → dist/cjs/dummy.js} +0 -0
- package/dist/cjs/index.js +41 -0
- package/dist/cjs/lint/commitlint.config.cjs +1 -0
- package/{lib/lint/eslint/common.js → dist/cjs/lint/eslint/common.cjs} +8 -8
- package/{lib/lint/eslint/non-react.js → dist/cjs/lint/eslint/non-react.cjs} +2 -2
- package/{lib/lint/eslint/react.js → dist/cjs/lint/eslint/react.cjs} +2 -2
- package/{lib/lint/eslint/typescript/common.js → dist/cjs/lint/eslint/typescript/common.cjs} +1 -1
- package/{lib/lint/eslint/typescript/non-react.js → dist/cjs/lint/eslint/typescript/non-react.cjs} +2 -2
- package/{lib/lint/eslint/typescript/react.js → dist/cjs/lint/eslint/typescript/react.cjs} +2 -2
- package/dist/cjs/lint/lint-staged.config.js +42 -0
- package/{lib/lint/prettier.config.js → dist/cjs/lint/prettier.config.cjs} +1 -1
- package/{lib/lint/stylelint.config.js → dist/cjs/lint/stylelint.config.cjs} +2 -2
- package/dist/cjs/monorepo/delete-merged-tags.js +57 -0
- package/dist/cjs/monorepo/set-registry-version.js +43 -0
- package/dist/cjs/monorepo/set-workspace-version.js +44 -0
- package/dist/cjs/monorepo/utils.js +34 -0
- package/dist/cjs/package.json +4 -0
- package/dist/cjs/pui-config/index.js +40 -0
- package/{lib/release/release.config.js → dist/cjs/release/release.config.cjs} +0 -0
- package/dist/cjs/scripts/helpers/checkmark.js +32 -0
- package/dist/cjs/scripts/helpers/get-npm-config.js +27 -0
- package/dist/cjs/scripts/helpers/progress.js +35 -0
- package/dist/cjs/scripts/helpers/xmark.js +31 -0
- package/dist/cjs/scripts/npmcheckversion.js +8 -0
- package/dist/cjs/scripts/update-notifier.js +33 -0
- package/dist/cjs/server/csp.js +88 -0
- package/dist/cjs/server/index.js +29 -0
- package/dist/cjs/server/logger.js +50 -0
- package/dist/cjs/server/middlewares/addProdMiddlewares.js +44 -0
- package/dist/cjs/server/middlewares/index.js +57 -0
- package/dist/cjs/server/util/index.js +68 -0
- package/{lib/testing/jest.config.js → dist/cjs/testing/jest.config.cjs} +15 -15
- package/{lib/testing/jest.node.config.js → dist/cjs/testing/jest.node.config.cjs} +1 -1
- package/{lib/testing/mocks/axios.js → dist/cjs/testing/mocks/axios.cjs} +0 -0
- package/{lib/testing/mocks/cssModule.js → dist/cjs/testing/mocks/cssModule.cjs} +0 -0
- package/{lib/testing/mocks/html.js → dist/cjs/testing/mocks/html.cjs} +0 -0
- package/{lib/testing/mocks/image.js → dist/cjs/testing/mocks/image.cjs} +0 -0
- package/{lib/testing/mocks/matchMedia.js → dist/cjs/testing/mocks/matchMedia.cjs} +0 -0
- package/{lib/testing/mocks/pui-app-loader.js → dist/cjs/testing/mocks/pui-app-loader.cjs} +0 -0
- package/{lib/testing/mocks/pui-diagnostics.js → dist/cjs/testing/mocks/pui-diagnostics.cjs} +0 -0
- package/{lib/testing/mocks/pui-user-monitoring.js → dist/cjs/testing/mocks/pui-user-monitoring.cjs} +0 -0
- package/{lib/testing/mocks/retry-axios.js → dist/cjs/testing/mocks/retry-axios.cjs} +0 -0
- package/{lib/testing/mocks/svg.js → dist/cjs/testing/mocks/svg.cjs} +0 -0
- package/{lib/testing/mocks/webpack-hmr.js → dist/cjs/testing/mocks/webpack-hmr.cjs} +0 -0
- package/{lib/testing/resolver.js → dist/cjs/testing/resolver.cjs} +0 -0
- package/dist/cjs/testing/setup-react-env.js +18 -0
- package/dist/cjs/testing/setup-tests.js +63 -0
- package/dist/cjs/testing/vitest.config.js +39 -0
- package/{lib/testing/vitest.setup.ts → dist/cjs/testing/vitest.setup.js} +0 -0
- package/dist/cjs/transpile/esbuild.js +138 -0
- package/dist/cjs/transpile/react-shim.js +26 -0
- package/{lib/transpile/swcrc.config.js → dist/cjs/transpile/swcrc.config.cjs} +1 -1
- package/{lib → dist/cjs}/typescript/app.tsconfig.json +0 -0
- package/{lib → dist/cjs}/typescript/library.tsconfig.json +0 -0
- package/dist/cjs/typescript/tsc-files/index.js +68 -0
- package/dist/cjs/typescript/tsc-files/utils.js +31 -0
- package/dist/cjs/typescript/util.js +28 -0
- package/dist/cjs/utils.cjs +20 -0
- package/dist/cjs/webpack/helpers.js +216 -0
- package/dist/cjs/webpack/webpack.base.babel.js +262 -0
- package/dist/cjs/webpack/webpack.dev.babel.js +136 -0
- package/dist/cjs/webpack/webpack.lib.base.babel.js +217 -0
- package/dist/cjs/webpack/webpack.lib.dev.babel.js +67 -0
- package/dist/cjs/webpack/webpack.lib.prod.babel.js +92 -0
- package/dist/cjs/webpack/webpack.prod.babel.js +139 -0
- package/{lib/webpack/webpack.storybook.js → dist/cjs/webpack/webpack.storybook.cjs} +1 -1
- package/dist/esm/babel/babel.config.cjs +101 -0
- package/dist/esm/cli-commands/build.js +56 -0
- package/dist/esm/cli-commands/codemod.js +29 -0
- package/dist/esm/cli-commands/gendoc.js +29 -0
- package/dist/esm/cli-commands/lint.js +64 -0
- package/dist/esm/cli-commands/pack.js +65 -0
- package/dist/esm/cli-commands/start.js +38 -0
- package/dist/esm/cli-commands/storybook.js +41 -0
- package/dist/esm/cli-commands/test.js +64 -0
- package/dist/esm/cli-commands/tsc.js +83 -0
- package/dist/esm/cli-commands/utils.js +120 -0
- package/dist/esm/cli-commands/version.js +49 -0
- package/dist/esm/cli-commands/vitest.js +61 -0
- package/dist/esm/cli.js +31 -0
- package/dist/esm/docgen/jsdoc.conf.json +17 -0
- package/dist/esm/dummy.js +0 -0
- package/dist/esm/index.js +22 -0
- package/dist/esm/lint/commitlint.config.cjs +1 -0
- package/dist/esm/lint/eslint/common.cjs +160 -0
- package/dist/esm/lint/eslint/non-react.cjs +14 -0
- package/dist/esm/lint/eslint/react.cjs +26 -0
- package/dist/esm/lint/eslint/typescript/common.cjs +43 -0
- package/dist/esm/lint/eslint/typescript/non-react.cjs +12 -0
- package/dist/esm/lint/eslint/typescript/react.cjs +19 -0
- package/dist/esm/lint/lint-staged.config.js +19 -0
- package/dist/esm/lint/prettier.config.cjs +8 -0
- package/dist/esm/lint/stylelint.config.cjs +19 -0
- package/dist/esm/monorepo/delete-merged-tags.js +38 -0
- package/dist/esm/monorepo/set-registry-version.js +21 -0
- package/dist/esm/monorepo/set-workspace-version.js +22 -0
- package/dist/esm/monorepo/utils.js +12 -0
- package/dist/esm/package.json +4 -0
- package/dist/esm/pui-config/index.js +18 -0
- package/dist/esm/release/release.config.cjs +31 -0
- package/dist/esm/scripts/helpers/checkmark.js +10 -0
- package/dist/esm/scripts/helpers/get-npm-config.js +5 -0
- package/dist/esm/scripts/helpers/progress.js +13 -0
- package/dist/esm/scripts/helpers/xmark.js +9 -0
- package/dist/esm/scripts/npmcheckversion.js +8 -0
- package/dist/esm/scripts/update-notifier.js +11 -0
- package/dist/esm/server/csp.js +66 -0
- package/dist/esm/server/index.js +17 -0
- package/dist/esm/server/logger.js +28 -0
- package/dist/esm/server/middlewares/addProdMiddlewares.js +22 -0
- package/dist/esm/server/middlewares/index.js +35 -0
- package/dist/esm/server/util/index.js +46 -0
- package/dist/esm/testing/jest.config.cjs +105 -0
- package/dist/esm/testing/jest.node.config.cjs +8 -0
- package/dist/esm/testing/mocks/axios.cjs +15 -0
- package/dist/esm/testing/mocks/cssModule.cjs +1 -0
- package/dist/esm/testing/mocks/html.cjs +1 -0
- package/dist/esm/testing/mocks/image.cjs +1 -0
- package/dist/esm/testing/mocks/matchMedia.cjs +24 -0
- package/dist/esm/testing/mocks/pui-app-loader.cjs +1 -0
- package/dist/esm/testing/mocks/pui-diagnostics.cjs +28 -0
- package/dist/esm/testing/mocks/pui-user-monitoring.cjs +3 -0
- package/dist/esm/testing/mocks/retry-axios.cjs +3 -0
- package/dist/esm/testing/mocks/svg.cjs +5 -0
- package/dist/esm/testing/mocks/webpack-hmr.cjs +1 -0
- package/dist/esm/testing/resolver.cjs +47 -0
- package/dist/esm/testing/setup-react-env.js +3 -0
- package/dist/esm/testing/setup-tests.js +48 -0
- package/dist/esm/testing/vitest.config.js +17 -0
- package/dist/esm/testing/vitest.setup.js +0 -0
- package/dist/esm/transpile/esbuild.js +117 -0
- package/dist/esm/transpile/react-shim.js +4 -0
- package/dist/esm/transpile/swcrc.config.cjs +13 -0
- package/dist/esm/typescript/app.tsconfig.json +23 -0
- package/dist/esm/typescript/library.tsconfig.json +23 -0
- package/dist/esm/typescript/tsc-files/index.js +55 -0
- package/{lib → dist/esm}/typescript/tsc-files/utils.js +3 -7
- package/dist/esm/typescript/util.js +6 -0
- package/dist/esm/utils.cjs +20 -0
- package/dist/esm/webpack/helpers.js +196 -0
- package/dist/esm/webpack/webpack.base.babel.js +248 -0
- package/dist/esm/webpack/webpack.dev.babel.js +118 -0
- package/dist/esm/webpack/webpack.lib.base.babel.js +208 -0
- package/dist/esm/webpack/webpack.lib.dev.babel.js +45 -0
- package/dist/esm/webpack/webpack.lib.prod.babel.js +70 -0
- package/dist/esm/webpack/webpack.prod.babel.js +122 -0
- package/dist/esm/webpack/webpack.storybook.cjs +87 -0
- package/dist/types/babel/babel.config.d.cts +59 -0
- package/dist/types/cli-commands/build.d.ts +14 -0
- package/dist/types/cli-commands/codemod.d.ts +6 -0
- package/dist/types/cli-commands/gendoc.d.ts +6 -0
- package/dist/types/cli-commands/lint.d.ts +29 -0
- package/dist/types/cli-commands/pack.d.ts +26 -0
- package/dist/types/cli-commands/start.d.ts +13 -0
- package/dist/types/cli-commands/storybook.d.ts +19 -0
- package/dist/types/cli-commands/test.d.ts +35 -0
- package/dist/types/cli-commands/tsc.d.ts +20 -0
- package/dist/types/cli-commands/utils.d.ts +14 -0
- package/dist/types/cli-commands/version.d.ts +30 -0
- package/dist/types/cli-commands/vitest.d.ts +35 -0
- package/dist/types/cli.d.ts +2 -0
- package/dist/types/dummy.d.ts +0 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/lint/commitlint.config.d.cts +4 -0
- package/dist/types/lint/eslint/common.d.cts +124 -0
- package/dist/types/lint/eslint/non-react.d.cts +88 -0
- package/dist/types/lint/eslint/react.d.cts +118 -0
- package/dist/types/lint/eslint/typescript/common.d.cts +37 -0
- package/dist/types/lint/eslint/typescript/non-react.d.cts +87 -0
- package/dist/types/lint/eslint/typescript/react.d.cts +118 -0
- package/dist/types/lint/lint-staged.config.d.ts +5 -0
- package/dist/types/lint/prettier.config.d.cts +8 -0
- package/dist/types/lint/stylelint.config.d.cts +11 -0
- package/dist/types/monorepo/delete-merged-tags.d.ts +1 -0
- package/dist/types/monorepo/set-registry-version.d.ts +1 -0
- package/dist/types/monorepo/set-workspace-version.d.ts +1 -0
- package/dist/types/monorepo/utils.d.ts +1 -0
- package/dist/types/pui-config/index.d.ts +1 -0
- package/dist/types/release/release.config.d.cts +9 -0
- package/dist/types/scripts/helpers/checkmark.d.ts +7 -0
- package/dist/types/scripts/helpers/get-npm-config.d.ts +2 -0
- package/dist/types/scripts/helpers/progress.d.ts +7 -0
- package/dist/types/scripts/helpers/xmark.d.ts +6 -0
- package/dist/types/scripts/npmcheckversion.d.ts +1 -0
- package/dist/types/scripts/update-notifier.d.ts +2 -0
- package/dist/types/server/csp.d.ts +10 -0
- package/dist/types/server/index.d.ts +1 -0
- package/dist/types/server/logger.d.ts +4 -0
- package/dist/types/server/middlewares/addProdMiddlewares.d.ts +1 -0
- package/dist/types/server/middlewares/index.d.ts +2 -0
- package/dist/types/server/util/index.d.ts +4 -0
- package/dist/types/testing/jest.config.d.cts +38 -0
- package/dist/types/testing/jest.node.config.d.cts +38 -0
- package/dist/types/testing/mocks/axios.d.cts +14 -0
- package/dist/types/testing/mocks/cssModule.d.cts +2 -0
- package/dist/types/testing/mocks/html.d.cts +2 -0
- package/dist/types/testing/mocks/image.d.cts +2 -0
- package/dist/types/testing/mocks/matchMedia.d.cts +2 -0
- package/dist/types/testing/mocks/pui-app-loader.d.cts +1 -0
- package/dist/types/testing/mocks/pui-diagnostics.d.cts +28 -0
- package/dist/types/testing/mocks/pui-user-monitoring.d.cts +3 -0
- package/dist/types/testing/mocks/retry-axios.d.cts +3 -0
- package/dist/types/testing/mocks/svg.d.cts +3 -0
- package/dist/types/testing/mocks/webpack-hmr.d.cts +1 -0
- package/dist/types/testing/resolver.d.cts +2 -0
- package/dist/types/testing/setup-react-env.d.ts +1 -0
- package/dist/types/testing/setup-tests.d.ts +1 -0
- package/dist/types/testing/vitest.config.d.ts +2 -0
- package/dist/types/testing/vitest.setup.d.ts +0 -0
- package/dist/types/transpile/esbuild.d.ts +13 -0
- package/dist/types/transpile/react-shim.d.ts +2 -0
- package/dist/types/transpile/swcrc.config.d.cts +1 -0
- package/dist/types/typescript/tsc-files/index.d.ts +1 -0
- package/dist/types/typescript/tsc-files/utils.d.ts +3 -0
- package/dist/types/typescript/util.d.ts +1 -0
- package/dist/types/utils.d.cts +3 -0
- package/dist/types/webpack/helpers.d.ts +28 -0
- package/dist/types/webpack/webpack.base.babel.d.ts +90 -0
- package/dist/types/webpack/webpack.dev.babel.d.ts +1 -0
- package/dist/types/webpack/webpack.lib.base.babel.d.ts +107 -0
- package/dist/types/webpack/webpack.lib.dev.babel.d.ts +91 -0
- package/dist/types/webpack/webpack.lib.prod.babel.d.ts +91 -0
- package/dist/types/webpack/webpack.prod.babel.d.ts +2 -0
- package/dist/types/webpack/webpack.storybook.d.cts +4 -0
- package/package.json +45 -37
- package/lib/cli-commands/build.js +0 -60
- package/lib/cli-commands/codemod.js +0 -31
- package/lib/cli-commands/gendoc.js +0 -36
- package/lib/cli-commands/lint.js +0 -75
- package/lib/cli-commands/pack.js +0 -67
- package/lib/cli-commands/start.js +0 -49
- package/lib/cli-commands/storybook.js +0 -53
- package/lib/cli-commands/test.js +0 -63
- package/lib/cli-commands/tsc.js +0 -103
- package/lib/cli-commands/utils.js +0 -135
- package/lib/cli-commands/version.js +0 -53
- package/lib/cli-commands/vitest.js +0 -66
- package/lib/cli.js +0 -33
- package/lib/docgen/jsdoc.config.js +0 -17
- package/lib/index.js +0 -25
- package/lib/lint/commitlint.config.js +0 -1
- package/lib/lint/lint-staged.config.js +0 -16
- package/lib/monorepo/delete-merged-tags.js +0 -48
- package/lib/monorepo/set-registry-version.js +0 -22
- package/lib/monorepo/set-workspace-version.js +0 -29
- package/lib/monorepo/utils.js +0 -15
- package/lib/pui-config/index.js +0 -18
- package/lib/scripts/helpers/checkmark.js +0 -15
- package/lib/scripts/helpers/get-npm-config.js +0 -3
- package/lib/scripts/helpers/progress.js +0 -19
- package/lib/scripts/helpers/xmark.js +0 -13
- package/lib/scripts/npmcheckversion.js +0 -8
- package/lib/scripts/update-notifier.js +0 -7
- package/lib/server/csp.js +0 -74
- package/lib/server/index.js +0 -37
- package/lib/server/logger.js +0 -42
- package/lib/server/middlewares/addDevMiddlewares.js +0 -39
- package/lib/server/middlewares/addProdMiddlewares.js +0 -30
- package/lib/server/middlewares/index.js +0 -37
- package/lib/server/util/index.js +0 -52
- package/lib/testing/setup-react-env.js +0 -3
- package/lib/testing/setup-tests.js +0 -58
- package/lib/testing/vitest.config.ts +0 -16
- package/lib/transpile/.swcrc +0 -11
- package/lib/transpile/esbuild.js +0 -116
- package/lib/transpile/react-shim.js +0 -2
- package/lib/typescript/tsc-files/index.js +0 -66
- package/lib/typescript/util.js +0 -5
- package/lib/webpack/helpers.js +0 -252
- package/lib/webpack/webpack.base.babel.js +0 -242
- package/lib/webpack/webpack.dev.babel.js +0 -137
- package/lib/webpack/webpack.lib.base.babel.js +0 -205
- package/lib/webpack/webpack.lib.dev.babel.js +0 -49
- package/lib/webpack/webpack.lib.prod.babel.js +0 -77
- package/lib/webpack/webpack.prod.babel.js +0 -142
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
const { execSync } = require('child_process');
|
|
2
|
-
const cwd = process.cwd();
|
|
3
|
-
const execaOptions = { cwd, stdio: 'inherit' };
|
|
4
|
-
|
|
5
|
-
const semVerRegEx =
|
|
6
|
-
/^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-]+)*))?$/;
|
|
7
|
-
|
|
8
|
-
const isSemVersion = (tagName) => semVerRegEx.test(tagName);
|
|
9
|
-
const branchName = (process.env.BRANCH_NAME || 'master').toLowerCase();
|
|
10
|
-
|
|
11
|
-
const branchTags = {
|
|
12
|
-
master: /^v?(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/,
|
|
13
|
-
next: /^v.*-next\.(0|[1-9]\d*)/,
|
|
14
|
-
alpha: /^v.*-alpha\.(0|[1-9]\d*)/,
|
|
15
|
-
beta: /^v.*-beta\.(0|[1-9]\d*)/,
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const deleteTags = (cmd, filter) => {
|
|
19
|
-
const result = execSync(cmd, { cwd });
|
|
20
|
-
if (!result) return;
|
|
21
|
-
const tags = result.toString().split('\n').join(' ');
|
|
22
|
-
execSync(`git tag -d ${filter ? filter(tags) : tags}`, { cwd });
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const tagsFromOtherBranches = (tags = []) => {
|
|
26
|
-
const regex = branchTags[branchName] || branchTags.master;
|
|
27
|
-
return tags
|
|
28
|
-
.split(' ')
|
|
29
|
-
.filter((tagName) => isSemVersion(tagName) && !regex.test(tagName))
|
|
30
|
-
.join(' ');
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
exports.deleteMergedTags = () => {
|
|
34
|
-
try {
|
|
35
|
-
// get tag names
|
|
36
|
-
if (branchName) {
|
|
37
|
-
// delete all tags that are not reachable from the current branch
|
|
38
|
-
deleteTags(`git tag -l --no-merged ${branchName}`);
|
|
39
|
-
// delete all tags that were not created in current branch
|
|
40
|
-
deleteTags(`git tag -l --merged ${branchName}`, tagsFromOtherBranches);
|
|
41
|
-
console.log('Last two tags: ');
|
|
42
|
-
execSync('git tag --sort=-creatordate | head -n 2', execaOptions);
|
|
43
|
-
}
|
|
44
|
-
} catch (error) {
|
|
45
|
-
// eslint-disable-next-line no-console
|
|
46
|
-
console.error(error);
|
|
47
|
-
}
|
|
48
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
const fg = require('fast-glob');
|
|
2
|
-
const { readFile, writeFile } = require('fs/promises');
|
|
3
|
-
const normalizePath = require('normalize-path');
|
|
4
|
-
const { findMonoRepoRoot } = require('./utils');
|
|
5
|
-
|
|
6
|
-
const monorepoRoot = normalizePath(findMonoRepoRoot() || '');
|
|
7
|
-
|
|
8
|
-
exports.setRegistryVersion = async () => {
|
|
9
|
-
const files = await fg([
|
|
10
|
-
`${monorepoRoot}/libs/*/package.json`,
|
|
11
|
-
`${monorepoRoot}/apps/*/package.json`,
|
|
12
|
-
`${monorepoRoot}/package.json`,
|
|
13
|
-
]);
|
|
14
|
-
Promise.all(
|
|
15
|
-
files.map(async (file) => {
|
|
16
|
-
let pkgJSONData = await readFile(file, 'utf8');
|
|
17
|
-
const pkgVersion = JSON.parse(pkgJSONData).version;
|
|
18
|
-
pkgJSONData = pkgJSONData.replace(/workspace:\*/g, pkgVersion);
|
|
19
|
-
await writeFile(file, pkgJSONData);
|
|
20
|
-
}),
|
|
21
|
-
);
|
|
22
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
const fg = require('fast-glob');
|
|
2
|
-
const { readFile, writeFile } = require('fs/promises');
|
|
3
|
-
const normalizePath = require('normalize-path');
|
|
4
|
-
const { findMonoRepoRoot } = require('./utils');
|
|
5
|
-
|
|
6
|
-
const monorepoRoot = normalizePath(findMonoRepoRoot() || '');
|
|
7
|
-
|
|
8
|
-
exports.setWorkspaceVersion = async () => {
|
|
9
|
-
const files = await fg([
|
|
10
|
-
`${monorepoRoot}/libs/*/package.json`,
|
|
11
|
-
`${monorepoRoot}/apps/*/package.json`,
|
|
12
|
-
`${monorepoRoot}/package.json`,
|
|
13
|
-
]);
|
|
14
|
-
Promise.all(
|
|
15
|
-
files.map(async (file) => {
|
|
16
|
-
let pkgJSONData = await readFile(file, 'utf8');
|
|
17
|
-
const pkgVersion = JSON.parse(pkgJSONData).version;
|
|
18
|
-
pkgJSONData = pkgJSONData.replace(
|
|
19
|
-
new RegExp(pkgVersion, 'g'),
|
|
20
|
-
'workspace:*',
|
|
21
|
-
);
|
|
22
|
-
pkgJSONData = pkgJSONData.replace(
|
|
23
|
-
/"version": "workspace:\*"/g,
|
|
24
|
-
`"version": "${pkgVersion}"`,
|
|
25
|
-
);
|
|
26
|
-
await writeFile(file, pkgJSONData);
|
|
27
|
-
}),
|
|
28
|
-
);
|
|
29
|
-
};
|
package/lib/monorepo/utils.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const { sync: findUp } = require('find-up');
|
|
3
|
-
|
|
4
|
-
const WORKSPACE_DIR_ENV_VAR = 'NPM_CONFIG_WORKSPACE_DIR';
|
|
5
|
-
const WORKSPACE_MANIFEST_FILENAME = 'pnpm-workspace.yaml';
|
|
6
|
-
|
|
7
|
-
exports.findMonoRepoRoot = (cwd = process.cwd()) => {
|
|
8
|
-
const workspaceManifestDirEnvVar =
|
|
9
|
-
process.env[WORKSPACE_DIR_ENV_VAR] ??
|
|
10
|
-
process.env[WORKSPACE_DIR_ENV_VAR.toLowerCase()];
|
|
11
|
-
const workspaceManifestLocation = workspaceManifestDirEnvVar
|
|
12
|
-
? path.join(workspaceManifestDirEnvVar, 'pnpm-workspace.yaml')
|
|
13
|
-
: findUp([WORKSPACE_MANIFEST_FILENAME, 'pnpm-workspace.yml'], { cwd });
|
|
14
|
-
return workspaceManifestLocation && path.dirname(workspaceManifestLocation);
|
|
15
|
-
};
|
package/lib/pui-config/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const fs = require('fs');
|
|
3
|
-
const { merge } = require('lodash');
|
|
4
|
-
|
|
5
|
-
const baseConfig = {
|
|
6
|
-
esBuild: {
|
|
7
|
-
target: 'es2020',
|
|
8
|
-
},
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const getPUIConfig = () => {
|
|
12
|
-
const configPath = path.resolve(process.cwd(), './pui.config.js');
|
|
13
|
-
if (!fs.existsSync(configPath)) return baseConfig;
|
|
14
|
-
const config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
|
|
15
|
-
return merge(baseConfig, config);
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
exports.getPUIConfig = getPUIConfig;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
const chalk = require('chalk');
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Adds mark check symbol
|
|
5
|
-
*
|
|
6
|
-
* @param callback
|
|
7
|
-
* @param message
|
|
8
|
-
*/
|
|
9
|
-
function addCheckMark(callback, message = '') {
|
|
10
|
-
process.stdout.write('\n\n');
|
|
11
|
-
process.stdout.write(chalk.green(' ✓'));
|
|
12
|
-
if (callback) callback(message);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
module.exports = addCheckMark;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
const readline = require('readline');
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Adds an animated progress indicator
|
|
5
|
-
*
|
|
6
|
-
* @param {string} message The message to write next to the indicator
|
|
7
|
-
* @param {number} [amountOfDots=3] The amount of dots you want to animate
|
|
8
|
-
*/
|
|
9
|
-
function animateProgress(message, amountOfDots = 3) {
|
|
10
|
-
let i = 0;
|
|
11
|
-
return setInterval(() => {
|
|
12
|
-
readline.cursorTo(process.stdout, 0);
|
|
13
|
-
i = (i + 1) % (amountOfDots + 1);
|
|
14
|
-
const dots = new Array(i + 1).join('.');
|
|
15
|
-
process.stdout.write(message + dots);
|
|
16
|
-
}, 500);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
module.exports = animateProgress;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
const { exec } = require('child_process');
|
|
2
|
-
exec('npm -v', (err, stdout) => {
|
|
3
|
-
if (err) throw err;
|
|
4
|
-
if (parseFloat(stdout) < 5) {
|
|
5
|
-
// NOTE: This can happen if you have a dependency which lists an old version of npm in its own dependencies.
|
|
6
|
-
throw new Error(`[ERROR] You need npm version @>=5 but you have ${stdout}`);
|
|
7
|
-
}
|
|
8
|
-
});
|
package/lib/server/csp.js
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const cspPolicy = require('helmet-csp');
|
|
4
|
-
const crypto = require('crypto');
|
|
5
|
-
|
|
6
|
-
const sources = [
|
|
7
|
-
"'self'",
|
|
8
|
-
'http://localhost:*',
|
|
9
|
-
'*.elliemae.io',
|
|
10
|
-
'*.elliemae.com',
|
|
11
|
-
'*.elliservices.com',
|
|
12
|
-
'*.ellielabs.com',
|
|
13
|
-
'http://pdx-col.eum-appdynamics.com',
|
|
14
|
-
'https://pdx-col.eum-appdynamics.com/',
|
|
15
|
-
'https://www.google-analytics.com',
|
|
16
|
-
'https://www.googletagmanager.com',
|
|
17
|
-
];
|
|
18
|
-
|
|
19
|
-
const sendFileWithCSPNonce = ({
|
|
20
|
-
buildPath,
|
|
21
|
-
page = 'index.html',
|
|
22
|
-
nonceRegex = /__CSP_NONCE__/g,
|
|
23
|
-
res,
|
|
24
|
-
fileSystem = fs,
|
|
25
|
-
}) => {
|
|
26
|
-
fileSystem.readFile(path.resolve(buildPath, page), 'utf8', (err, html) => {
|
|
27
|
-
if (err) {
|
|
28
|
-
res.sendStatus(404);
|
|
29
|
-
} else {
|
|
30
|
-
res.set('Content-Type', 'text/html');
|
|
31
|
-
res.send(html.replace(nonceRegex, (res.locals || {}).cspNonce));
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const getScriptSrc = () => {
|
|
37
|
-
const scriptSrc = sources.concat([
|
|
38
|
-
(req, res) => `'nonce-${res.locals.cspNonce}'`,
|
|
39
|
-
]);
|
|
40
|
-
return process.env.NODE_ENV !== 'production'
|
|
41
|
-
? scriptSrc.concat(["'unsafe-eval'"])
|
|
42
|
-
: scriptSrc;
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const csp = (app) => {
|
|
46
|
-
app.use((req, res, next) => {
|
|
47
|
-
res.locals.cspNonce = crypto.randomBytes(16).toString('hex');
|
|
48
|
-
next();
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
app.use(
|
|
52
|
-
cspPolicy({
|
|
53
|
-
directives: {
|
|
54
|
-
defaultSrc: ["'self'"],
|
|
55
|
-
baseUri: ["'self'"],
|
|
56
|
-
blockAllMixedContent: [],
|
|
57
|
-
connectSrc: sources,
|
|
58
|
-
fontSrc: sources.concat(['data:']),
|
|
59
|
-
frameAncestors: sources,
|
|
60
|
-
imgSrc: sources.concat(['data:']),
|
|
61
|
-
objectSrc: ["'none'"],
|
|
62
|
-
scriptSrc: getScriptSrc(),
|
|
63
|
-
scriptSrcAttr: ["'none'"],
|
|
64
|
-
styleSrc: sources.concat(["'unsafe-inline'"]),
|
|
65
|
-
upgradeInsecureRequests: [],
|
|
66
|
-
reportUri: '/v1/csp',
|
|
67
|
-
},
|
|
68
|
-
reportOnly: true,
|
|
69
|
-
}),
|
|
70
|
-
);
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
exports.csp = csp;
|
|
74
|
-
exports.sendFileWithCSPNonce = sendFileWithCSPNonce;
|
package/lib/server/index.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/* eslint consistent-return:0 import/order:0 */
|
|
2
|
-
const express = require('express');
|
|
3
|
-
const logger = require('./logger');
|
|
4
|
-
const {
|
|
5
|
-
setupDefaultMiddlewares,
|
|
6
|
-
setupAdditionalMiddlewars,
|
|
7
|
-
} = require('./middlewares');
|
|
8
|
-
const { loadRoutes, port, host } = require('./util');
|
|
9
|
-
|
|
10
|
-
// const corsOptions = {
|
|
11
|
-
// origin: '*',
|
|
12
|
-
// methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
|
|
13
|
-
// allowedHeaders: [
|
|
14
|
-
// 'Authorization',
|
|
15
|
-
// 'Content-Type',
|
|
16
|
-
// 'Origin',
|
|
17
|
-
// 'X-Requested-With',
|
|
18
|
-
// 'Accept',
|
|
19
|
-
// ],
|
|
20
|
-
// preflightContinue: false,
|
|
21
|
-
// optionsSuccessStatus: 204,
|
|
22
|
-
// maxAge: 3600,
|
|
23
|
-
// };
|
|
24
|
-
const app = express();
|
|
25
|
-
setupDefaultMiddlewares(app);
|
|
26
|
-
// load all custom routes from the application
|
|
27
|
-
loadRoutes(app);
|
|
28
|
-
// In production we need to pass these values in instead of relying on webpack
|
|
29
|
-
setupAdditionalMiddlewars(app);
|
|
30
|
-
|
|
31
|
-
// Start your app.
|
|
32
|
-
app.listen(port, host, async (err) => {
|
|
33
|
-
if (err) {
|
|
34
|
-
return logger.error(err.message);
|
|
35
|
-
}
|
|
36
|
-
logger.appStarted(port, host || 'localhost');
|
|
37
|
-
});
|
package/lib/server/logger.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
|
|
3
|
-
const chalk = require('chalk');
|
|
4
|
-
const ip = require('ip');
|
|
5
|
-
|
|
6
|
-
const divider = chalk.gray('\n-----------------------------------');
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Logger middleware, you can customize it to make messages more personal
|
|
10
|
-
*/
|
|
11
|
-
const logger = {
|
|
12
|
-
// Called whenever there's an error on the server we want to print
|
|
13
|
-
error: (err) => {
|
|
14
|
-
console.error(chalk.red(err));
|
|
15
|
-
},
|
|
16
|
-
|
|
17
|
-
// Called when express.js app starts on given port w/o errors
|
|
18
|
-
appStarted: (port, host, tunnelStarted) => {
|
|
19
|
-
console.log(`Server started ! ${chalk.green('✓')}`);
|
|
20
|
-
|
|
21
|
-
// If the tunnel started, log that and the URL it's available at
|
|
22
|
-
if (tunnelStarted) {
|
|
23
|
-
console.log(`Tunnel initialised ${chalk.green('✓')}`);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const accessUrls = `${chalk.bold('Access URLs:')}${divider}\n`;
|
|
27
|
-
const localHostUrl = `Localhost: ${chalk.magenta(
|
|
28
|
-
`http://${host}:${port}`,
|
|
29
|
-
)}\n`;
|
|
30
|
-
const lanUrl = `LAN: ${chalk.magenta(`http://${ip.address()}:${port}`)}\n`;
|
|
31
|
-
const proxy = tunnelStarted
|
|
32
|
-
? `\n Proxy: ${chalk.magenta(tunnelStarted)}`
|
|
33
|
-
: '';
|
|
34
|
-
|
|
35
|
-
console.log(`${accessUrls}${localHostUrl}${lanUrl}${proxy}${divider}${chalk.blue(
|
|
36
|
-
`\nPress ${chalk.italic('CTRL-C')} to stop`,
|
|
37
|
-
)}
|
|
38
|
-
`);
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
module.exports = logger;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
const webpack = require('webpack');
|
|
2
|
-
const expressStaticGzip = require('express-static-gzip');
|
|
3
|
-
const webpackDevMiddleware = require('webpack-dev-middleware');
|
|
4
|
-
const webpackHotMiddleware = require('webpack-hot-middleware');
|
|
5
|
-
const { sendFileWithCSPNonce } = require('../csp');
|
|
6
|
-
|
|
7
|
-
function createWebpackMiddleware(compiler, publicPath) {
|
|
8
|
-
return webpackDevMiddleware(compiler, {
|
|
9
|
-
publicPath,
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
module.exports = function addDevMiddlewares(app, webpackConfig) {
|
|
14
|
-
const compiler = webpack(webpackConfig);
|
|
15
|
-
const middleware = createWebpackMiddleware(
|
|
16
|
-
compiler,
|
|
17
|
-
webpackConfig.output.publicPath,
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
app.use(middleware);
|
|
21
|
-
app.use(
|
|
22
|
-
webpackHotMiddleware(compiler, {
|
|
23
|
-
log: false,
|
|
24
|
-
path: `/__webpack_hmr`,
|
|
25
|
-
heartbeat: 10 * 1000,
|
|
26
|
-
}),
|
|
27
|
-
);
|
|
28
|
-
app.use(expressStaticGzip('cdn'));
|
|
29
|
-
|
|
30
|
-
const { outputFileSystem } = (middleware || {}).context || {};
|
|
31
|
-
|
|
32
|
-
app.get('*', (req, res) => {
|
|
33
|
-
sendFileWithCSPNonce({
|
|
34
|
-
outputPath: compiler.outputPath,
|
|
35
|
-
fileSystem: outputFileSystem,
|
|
36
|
-
res,
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
const compression = require('compression');
|
|
2
|
-
const expressStaticGzip = require('express-static-gzip');
|
|
3
|
-
const { sendFileWithCSPNonce } = require('../csp');
|
|
4
|
-
const { getPaths } = require('../../webpack/helpers');
|
|
5
|
-
|
|
6
|
-
const paths = getPaths();
|
|
7
|
-
|
|
8
|
-
module.exports = function addProdMiddlewares(app, options = {}) {
|
|
9
|
-
const { buildPath = paths.buildPath, basePath = paths.basePath } = options;
|
|
10
|
-
// compression middleware compresses your server responses which makes them
|
|
11
|
-
// smaller (applies also to assets). You can read more about that technique
|
|
12
|
-
// and other good practices on official Express.js docs http://mxs.is/googmy
|
|
13
|
-
app.use(compression());
|
|
14
|
-
|
|
15
|
-
app.get(basePath, (req, res) => {
|
|
16
|
-
sendFileWithCSPNonce({ buildPath, res });
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
app.use(
|
|
20
|
-
basePath,
|
|
21
|
-
expressStaticGzip(buildPath, {
|
|
22
|
-
index: false,
|
|
23
|
-
enableBrotli: true,
|
|
24
|
-
orderPreference: ['br'],
|
|
25
|
-
}),
|
|
26
|
-
);
|
|
27
|
-
app.use(expressStaticGzip('cdn'));
|
|
28
|
-
|
|
29
|
-
app.get('*', (req, res) => sendFileWithCSPNonce({ buildPath, res }));
|
|
30
|
-
};
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
const express = require('express');
|
|
2
|
-
const cors = require('cors');
|
|
3
|
-
const expressPinoLogger = require('express-pino-logger');
|
|
4
|
-
const { csp } = require('../csp');
|
|
5
|
-
const addProdMiddlewares = require('./addProdMiddlewares');
|
|
6
|
-
const addDevMiddlewares = require('./addDevMiddlewares');
|
|
7
|
-
const webpackConfig = require('../../webpack/webpack.dev.babel');
|
|
8
|
-
|
|
9
|
-
exports.setupDefaultMiddlewares = (app) => {
|
|
10
|
-
const pino = expressPinoLogger({
|
|
11
|
-
transport: {
|
|
12
|
-
target: 'pino-pretty',
|
|
13
|
-
options: {
|
|
14
|
-
colorize: true,
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
});
|
|
18
|
-
pino.logger.level = 'warn';
|
|
19
|
-
app.use(pino);
|
|
20
|
-
app.use(cors());
|
|
21
|
-
app.options('*', cors());
|
|
22
|
-
csp(app);
|
|
23
|
-
app.use(express.urlencoded({ extended: false }));
|
|
24
|
-
app.use(express.text({ type: 'text/plain' }));
|
|
25
|
-
app.use(express.json({ type: 'application/json' }));
|
|
26
|
-
app.use(express.json({ type: 'application/csp-report' }));
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
exports.setupAdditionalMiddlewars = (app, options) => {
|
|
30
|
-
const isProd = process.env.NODE_ENV === 'production';
|
|
31
|
-
if (isProd) {
|
|
32
|
-
addProdMiddlewares(app, options);
|
|
33
|
-
} else {
|
|
34
|
-
addDevMiddlewares(app, webpackConfig);
|
|
35
|
-
}
|
|
36
|
-
return app;
|
|
37
|
-
};
|
package/lib/server/util/index.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
const fs = require('fs');
|
|
2
|
-
const path = require('path');
|
|
3
|
-
const argv = require('minimist')(process.argv.slice(2));
|
|
4
|
-
|
|
5
|
-
const getCWD = () => process.cwd();
|
|
6
|
-
|
|
7
|
-
const allJS = /\.js$/;
|
|
8
|
-
|
|
9
|
-
const serviceEndpoints = /\.endpoint\.js$/;
|
|
10
|
-
|
|
11
|
-
const getFilesMatching = (filePattern) => {
|
|
12
|
-
const getFiles = (dir) => {
|
|
13
|
-
let routeFiles = [];
|
|
14
|
-
if (!fs.existsSync(dir)) return routeFiles;
|
|
15
|
-
fs.readdirSync(dir).forEach((file) => {
|
|
16
|
-
const fullPath = path.join(dir, file);
|
|
17
|
-
if (fs.lstatSync(fullPath).isDirectory()) {
|
|
18
|
-
routeFiles = routeFiles.concat(getFiles(fullPath));
|
|
19
|
-
} else if (filePattern.test(fullPath)) routeFiles.push(fullPath);
|
|
20
|
-
});
|
|
21
|
-
return routeFiles;
|
|
22
|
-
};
|
|
23
|
-
return getFiles;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const getServerRouteFiles = getFilesMatching(allJS);
|
|
27
|
-
const getServiceEndpoints = getFilesMatching(serviceEndpoints);
|
|
28
|
-
|
|
29
|
-
exports.loadRoutes = (app) => {
|
|
30
|
-
const routeFiles = getServerRouteFiles(path.join(getCWD(), 'server/routes'));
|
|
31
|
-
routeFiles.push(...getServiceEndpoints(path.join(getCWD(), 'app')));
|
|
32
|
-
routeFiles.push(...getServiceEndpoints(path.join(getCWD(), 'lib')));
|
|
33
|
-
routeFiles.forEach((routeFile) => {
|
|
34
|
-
// eslint-disable-next-line global-require
|
|
35
|
-
const init = require(routeFile);
|
|
36
|
-
try {
|
|
37
|
-
init(app);
|
|
38
|
-
} catch (err) {
|
|
39
|
-
// eslint-disable-next-line no-console
|
|
40
|
-
console.error(`unable to load routes from ${routeFile}. ${err.message}`);
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
exports.port = parseInt(
|
|
46
|
-
argv.port || process.env.port || process.env.PORT || '3000',
|
|
47
|
-
10,
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
exports.host = argv.host || process.env.HOST;
|
|
51
|
-
|
|
52
|
-
exports.getCWD = getCWD;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
// needed for regenerator-runtime
|
|
2
|
-
// (ES7 generator support is required by redux-saga)
|
|
3
|
-
import 'core-js/stable';
|
|
4
|
-
import 'regenerator-runtime/runtime';
|
|
5
|
-
import '@testing-library/jest-dom/extend-expect';
|
|
6
|
-
import jestAxe from 'jest-axe';
|
|
7
|
-
import ResizeObserver from 'resize-observer-polyfill';
|
|
8
|
-
import addMatchMedia from './mocks/matchMedia.js';
|
|
9
|
-
import { logger } from './mocks/pui-diagnostics.js';
|
|
10
|
-
|
|
11
|
-
// eslint-disable-next-line no-console
|
|
12
|
-
const originalError = console.error;
|
|
13
|
-
// eslint-disable-next-line no-console
|
|
14
|
-
console.error = (...args) => {
|
|
15
|
-
const ignoreList = [
|
|
16
|
-
`Warning: Can't perform a React state update on an unmounted component`,
|
|
17
|
-
`Warning: Function components cannot be given refs`,
|
|
18
|
-
`Warning: Failed %s type:`,
|
|
19
|
-
`Warning: Invalid DOM property`,
|
|
20
|
-
`Warning: Each child in a list should have a unique`,
|
|
21
|
-
'Warning: Received `%s` for a non-boolean attribute',
|
|
22
|
-
'Warning: <%s /> is using incorrect casing.',
|
|
23
|
-
'Warning: The tag <%s> is unrecognized in this browser',
|
|
24
|
-
'Warning: Invalid arguments supplied to oneOf',
|
|
25
|
-
];
|
|
26
|
-
if (
|
|
27
|
-
ignoreList.find(
|
|
28
|
-
(ignoreMsg) => !!args.find((arg) => arg?.includes?.(ignoreMsg)),
|
|
29
|
-
)
|
|
30
|
-
)
|
|
31
|
-
return false;
|
|
32
|
-
return originalError(...args);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
if (expect) expect.extend(jestAxe.toHaveNoViolations);
|
|
36
|
-
jest.setTimeout(60000);
|
|
37
|
-
|
|
38
|
-
const addElementToBody = (element) => {
|
|
39
|
-
const documentEle = (window || {}).document;
|
|
40
|
-
if (!documentEle) return null;
|
|
41
|
-
const bodyEle = documentEle.body;
|
|
42
|
-
const newEle = documentEle.createElement(...element);
|
|
43
|
-
if (!newEle) return null;
|
|
44
|
-
bodyEle.appendChild(newEle);
|
|
45
|
-
return newEle;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const addRootElement = (id) => {
|
|
49
|
-
const rootEle = addElementToBody('div');
|
|
50
|
-
if (rootEle) rootEle.id = id;
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
addRootElement('root');
|
|
54
|
-
|
|
55
|
-
addMatchMedia();
|
|
56
|
-
window.ResizeObserver = ResizeObserver;
|
|
57
|
-
window.emui = {};
|
|
58
|
-
window.emui.logger = logger();
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/// <reference types="vitest" />
|
|
2
|
-
import { defineConfig } from 'vite';
|
|
3
|
-
import path from 'path';
|
|
4
|
-
|
|
5
|
-
export default defineConfig({
|
|
6
|
-
test: {
|
|
7
|
-
globals: true,
|
|
8
|
-
root: process.cwd(),
|
|
9
|
-
exclude: ['node_modules', 'dist', '.idea', '.git', '.cache', 'e2e'],
|
|
10
|
-
setupFiles: [path.resolve(__dirname, './vitest.setup.ts')],
|
|
11
|
-
coverage: {
|
|
12
|
-
reportsDirectory: './reports/coverage',
|
|
13
|
-
},
|
|
14
|
-
environment: 'happy-dom',
|
|
15
|
-
},
|
|
16
|
-
});
|