@elliemae/pui-cli 7.0.0-alpha.2 → 7.0.0-alpha.20

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.
Files changed (225) hide show
  1. package/dist/cjs/babel.config.cjs +97 -0
  2. package/dist/cjs/cli.js +14 -12
  3. package/dist/cjs/{cli-commands → commands}/build.js +0 -0
  4. package/dist/cjs/{cli-commands → commands}/codemod.js +0 -0
  5. package/dist/cjs/{cli-commands → commands}/gendoc.js +1 -1
  6. package/dist/cjs/{cli-commands → commands}/lint.js +2 -2
  7. package/dist/cjs/{cli-commands → commands}/pack.js +2 -2
  8. package/dist/cjs/{cli-commands → commands}/start.js +0 -0
  9. package/dist/cjs/{cli-commands → commands}/storybook.js +0 -0
  10. package/dist/cjs/{cli-commands → commands}/test.js +13 -5
  11. package/dist/cjs/{cli-commands/tsc.js → commands/tscheck.js} +26 -44
  12. package/dist/cjs/{cli-commands → commands}/utils.js +0 -0
  13. package/dist/cjs/{cli-commands → commands}/version.js +0 -0
  14. package/dist/cjs/{cli-commands → commands}/vitest.js +4 -1
  15. package/dist/cjs/index.cjs +25 -0
  16. package/dist/cjs/index.js +9 -9
  17. package/dist/cjs/{docgen/jsdoc.conf.json → jsdoc.conf.json} +0 -0
  18. package/dist/cjs/lint-config/commitlint.config.cjs +1 -0
  19. package/dist/cjs/lint-config/eslint/common.cjs +160 -0
  20. package/dist/cjs/lint-config/eslint/non-react.cjs +14 -0
  21. package/dist/cjs/lint-config/eslint/react.cjs +26 -0
  22. package/dist/cjs/lint-config/eslint/typescript/common.cjs +43 -0
  23. package/dist/cjs/lint-config/eslint/typescript/non-react.cjs +12 -0
  24. package/dist/cjs/lint-config/eslint/typescript/react.cjs +19 -0
  25. package/dist/cjs/{lint → lint-config}/lint-staged.config.js +1 -6
  26. package/dist/cjs/lint-config/prettier.config.cjs +8 -0
  27. package/dist/cjs/lint-config/stylelint.config.cjs +19 -0
  28. package/dist/cjs/monorepo/set-registry-version.js +1 -1
  29. package/dist/cjs/monorepo/set-workspace-version.js +1 -1
  30. package/dist/cjs/monorepo/utils.cjs +30 -0
  31. package/dist/cjs/{pui-config/index.js → pui-config.js} +0 -0
  32. package/dist/cjs/release.config.cjs +31 -0
  33. package/dist/cjs/server/app-routes.cjs +42 -0
  34. package/dist/cjs/server/index.js +6 -5
  35. package/dist/cjs/server/{middlewares/index.js → middlewares.js} +18 -7
  36. package/dist/cjs/{typescript/util.js → server/utils.js} +11 -7
  37. package/dist/cjs/testing/jest.config.cjs +103 -0
  38. package/dist/cjs/testing/jest.node.config.cjs +8 -0
  39. package/dist/cjs/{typescript/tsc-files/utils.js → testing/mocks/axios.js} +18 -12
  40. package/dist/cjs/{scripts/helpers/checkmark.js → testing/mocks/cssModule.js} +5 -14
  41. package/dist/cjs/testing/mocks/html.js +23 -0
  42. package/dist/cjs/testing/mocks/image.js +23 -0
  43. package/dist/cjs/testing/mocks/matchMedia.js +43 -0
  44. package/dist/cjs/testing/mocks/pui-app-loader.js +24 -0
  45. package/dist/cjs/testing/mocks/pui-diagnostics.js +68 -0
  46. package/dist/cjs/testing/mocks/pui-user-monitoring.js +30 -0
  47. package/dist/cjs/testing/mocks/retry-axios.js +27 -0
  48. package/dist/cjs/{scripts/helpers/xmark.js → testing/mocks/svg.js} +8 -10
  49. package/dist/cjs/testing/mocks/webpack-hmr.js +24 -0
  50. package/dist/cjs/testing/resolver.cjs +47 -0
  51. package/dist/cjs/{scripts/helpers/get-npm-config.js → testing/setup-test-env.js} +4 -12
  52. package/dist/cjs/testing/setup-tests.js +3 -3
  53. package/dist/cjs/testing/vitest.config.js +20 -6
  54. package/dist/cjs/transpile/.swcrc +11 -0
  55. package/dist/cjs/transpile/esbuild.js +2 -1
  56. package/dist/cjs/transpile/swcrc.config.cjs +13 -0
  57. package/dist/cjs/{scripts/update-notifier.js → update-notifier.js} +2 -2
  58. package/dist/cjs/utils.cjs +23 -0
  59. package/dist/cjs/webpack/helpers.js +1 -1
  60. package/dist/cjs/webpack/webpack.base.babel.js +2 -2
  61. package/dist/cjs/webpack/webpack.dev.babel.js +10 -6
  62. package/dist/cjs/webpack/webpack.lib.base.babel.js +6 -6
  63. package/dist/cjs/webpack/webpack.lib.prod.babel.js +2 -2
  64. package/dist/cjs/webpack/webpack.prod.babel.js +2 -2
  65. package/dist/cjs/webpack/webpack.storybook.js +122 -0
  66. package/dist/esm/babel.config.cjs +97 -0
  67. package/dist/esm/cli.js +13 -11
  68. package/dist/esm/{cli-commands → commands}/build.js +0 -0
  69. package/dist/esm/{cli-commands → commands}/codemod.js +0 -0
  70. package/dist/esm/{cli-commands → commands}/gendoc.js +1 -1
  71. package/dist/esm/{cli-commands → commands}/lint.js +1 -1
  72. package/dist/esm/{cli-commands → commands}/pack.js +1 -1
  73. package/dist/esm/{cli-commands → commands}/start.js +0 -0
  74. package/dist/esm/{cli-commands → commands}/storybook.js +0 -0
  75. package/dist/esm/{cli-commands → commands}/test.js +13 -5
  76. package/dist/esm/commands/tscheck.js +65 -0
  77. package/dist/esm/{cli-commands → commands}/utils.js +0 -0
  78. package/dist/esm/{cli-commands → commands}/version.js +0 -0
  79. package/dist/esm/{cli-commands → commands}/vitest.js +4 -1
  80. package/dist/esm/index.cjs +25 -0
  81. package/dist/esm/index.js +8 -8
  82. package/dist/esm/{docgen/jsdoc.conf.json → jsdoc.conf.json} +0 -0
  83. package/dist/esm/lint-config/commitlint.config.cjs +1 -0
  84. package/dist/esm/lint-config/eslint/common.cjs +160 -0
  85. package/dist/esm/lint-config/eslint/non-react.cjs +14 -0
  86. package/dist/esm/lint-config/eslint/react.cjs +26 -0
  87. package/dist/esm/lint-config/eslint/typescript/common.cjs +43 -0
  88. package/dist/esm/lint-config/eslint/typescript/non-react.cjs +12 -0
  89. package/dist/esm/lint-config/eslint/typescript/react.cjs +19 -0
  90. package/dist/esm/{lint → lint-config}/lint-staged.config.js +1 -5
  91. package/dist/esm/lint-config/prettier.config.cjs +8 -0
  92. package/dist/esm/lint-config/stylelint.config.cjs +19 -0
  93. package/dist/esm/monorepo/set-registry-version.js +1 -1
  94. package/dist/esm/monorepo/set-workspace-version.js +1 -1
  95. package/dist/esm/monorepo/utils.cjs +30 -0
  96. package/dist/esm/{pui-config/index.js → pui-config.js} +0 -0
  97. package/dist/esm/release.config.cjs +31 -0
  98. package/dist/esm/server/app-routes.cjs +42 -0
  99. package/dist/esm/server/index.js +3 -2
  100. package/dist/esm/server/middlewares.js +46 -0
  101. package/dist/esm/server/utils.js +10 -0
  102. package/dist/esm/testing/jest.config.cjs +103 -0
  103. package/dist/esm/testing/jest.node.config.cjs +8 -0
  104. package/dist/esm/testing/mocks/axios.js +18 -0
  105. package/dist/esm/testing/mocks/cssModule.js +4 -0
  106. package/dist/esm/testing/mocks/html.js +4 -0
  107. package/dist/esm/testing/mocks/image.js +4 -0
  108. package/dist/esm/testing/mocks/matchMedia.js +24 -0
  109. package/dist/esm/testing/mocks/pui-app-loader.js +5 -0
  110. package/dist/esm/testing/mocks/pui-diagnostics.js +49 -0
  111. package/dist/esm/testing/mocks/pui-user-monitoring.js +11 -0
  112. package/dist/esm/testing/mocks/retry-axios.js +8 -0
  113. package/dist/esm/testing/mocks/svg.js +7 -0
  114. package/dist/esm/testing/mocks/webpack-hmr.js +5 -0
  115. package/dist/esm/testing/resolver.cjs +47 -0
  116. package/dist/esm/testing/setup-test-env.js +4 -0
  117. package/dist/esm/testing/setup-tests.js +2 -2
  118. package/dist/esm/testing/vitest.config.js +18 -5
  119. package/dist/esm/transpile/.swcrc +11 -0
  120. package/dist/esm/transpile/esbuild.js +2 -1
  121. package/dist/esm/transpile/swcrc.config.cjs +13 -0
  122. package/dist/esm/{scripts/update-notifier.js → update-notifier.js} +2 -2
  123. package/dist/esm/utils.cjs +23 -0
  124. package/dist/esm/webpack/helpers.js +1 -1
  125. package/dist/esm/webpack/webpack.base.babel.js +3 -3
  126. package/dist/esm/webpack/webpack.dev.babel.js +8 -5
  127. package/dist/esm/webpack/webpack.lib.base.babel.js +6 -11
  128. package/dist/esm/webpack/webpack.lib.prod.babel.js +1 -1
  129. package/dist/esm/webpack/webpack.prod.babel.js +2 -2
  130. package/dist/esm/webpack/webpack.storybook.js +102 -0
  131. package/dist/types/{babel/babel.config.d.cts → babel.config.d.cts} +0 -0
  132. package/dist/types/{cli-commands → commands}/build.d.ts +0 -0
  133. package/dist/types/{cli-commands → commands}/codemod.d.ts +0 -0
  134. package/dist/types/{cli-commands → commands}/gendoc.d.ts +0 -0
  135. package/dist/types/{cli-commands → commands}/lint.d.ts +0 -0
  136. package/dist/types/{cli-commands → commands}/pack.d.ts +0 -0
  137. package/dist/types/{cli-commands → commands}/start.d.ts +0 -0
  138. package/dist/types/{cli-commands → commands}/storybook.d.ts +0 -0
  139. package/dist/types/{cli-commands → commands}/test.d.ts +10 -6
  140. package/dist/types/commands/tscheck.d.ts +14 -0
  141. package/dist/types/{cli-commands → commands}/utils.d.ts +0 -0
  142. package/dist/types/{cli-commands → commands}/version.d.ts +0 -0
  143. package/dist/types/{cli-commands → commands}/vitest.d.ts +0 -0
  144. package/dist/types/index.d.cts +10 -0
  145. package/dist/types/index.d.ts +8 -8
  146. package/dist/types/{lint → lint-config}/commitlint.config.d.cts +0 -0
  147. package/dist/types/{lint → lint-config}/eslint/common.d.cts +15 -12
  148. package/dist/types/{lint → lint-config}/eslint/non-react.d.cts +6 -1
  149. package/dist/types/{lint → lint-config}/eslint/react.d.cts +6 -1
  150. package/dist/types/{lint → lint-config}/eslint/typescript/common.d.cts +2 -2
  151. package/dist/types/{lint → lint-config}/eslint/typescript/non-react.d.cts +1 -1
  152. package/dist/types/{lint → lint-config}/eslint/typescript/react.d.cts +1 -1
  153. package/dist/types/{lint → lint-config}/lint-staged.config.d.ts +0 -0
  154. package/dist/types/{lint → lint-config}/prettier.config.d.cts +0 -0
  155. package/dist/types/{lint → lint-config}/stylelint.config.d.cts +1 -0
  156. package/dist/types/monorepo/utils.d.cts +1 -0
  157. package/dist/types/{pui-config/index.d.ts → pui-config.d.ts} +0 -0
  158. package/dist/types/{release/release.config.d.cts → release.config.d.cts} +0 -0
  159. package/dist/types/server/app-routes.d.cts +1 -0
  160. package/dist/types/server/{middlewares/index.d.ts → middlewares.d.ts} +1 -1
  161. package/dist/types/server/{util/index.d.ts → utils.d.ts} +0 -1
  162. package/dist/types/testing/jest.config.d.cts +3 -3
  163. package/dist/types/testing/jest.node.config.d.cts +4 -4
  164. package/dist/types/testing/mocks/axios.d.ts +17 -0
  165. package/dist/types/testing/mocks/cssModule.d.ts +2 -0
  166. package/dist/types/testing/mocks/html.d.ts +2 -0
  167. package/dist/types/testing/mocks/image.d.ts +2 -0
  168. package/dist/types/testing/mocks/matchMedia.d.ts +1 -0
  169. package/dist/types/testing/mocks/{pui-app-loader.d.cts → pui-app-loader.d.ts} +0 -0
  170. package/dist/types/testing/mocks/{pui-diagnostics.d.cts → pui-diagnostics.d.ts} +0 -0
  171. package/dist/types/testing/mocks/{pui-user-monitoring.d.cts → pui-user-monitoring.d.ts} +0 -0
  172. package/dist/types/testing/mocks/{retry-axios.d.cts → retry-axios.d.ts} +0 -0
  173. package/dist/types/testing/mocks/{svg.d.cts → svg.d.ts} +1 -1
  174. package/dist/types/testing/mocks/{webpack-hmr.d.cts → webpack-hmr.d.ts} +0 -0
  175. package/dist/types/testing/setup-test-env.d.ts +2 -0
  176. package/dist/types/testing/vitest.config.d.ts +1 -1
  177. package/dist/types/transpile/swcrc.config.d.cts +1 -1
  178. package/dist/types/update-notifier.d.ts +1 -0
  179. package/dist/types/utils.d.cts +2 -1
  180. package/dist/types/webpack/helpers.d.ts +1 -1
  181. package/dist/types/webpack/webpack.dev.babel.d.ts +2 -1
  182. package/dist/types/webpack/webpack.lib.dev.babel.d.ts +1 -1
  183. package/dist/types/webpack/webpack.lib.prod.babel.d.ts +20 -4
  184. package/dist/types/webpack/webpack.prod.babel.d.ts +1 -1
  185. package/dist/types/webpack/{webpack.storybook.d.cts → webpack.storybook.d.ts} +0 -0
  186. package/package.json +92 -87
  187. package/dist/cjs/monorepo/utils.js +0 -34
  188. package/dist/cjs/scripts/helpers/progress.js +0 -35
  189. package/dist/cjs/scripts/npmcheckversion.js +0 -8
  190. package/dist/cjs/server/middlewares/addProdMiddlewares.js +0 -44
  191. package/dist/cjs/server/util/index.js +0 -68
  192. package/dist/cjs/testing/vitest.setup.js +0 -0
  193. package/dist/cjs/typescript/tsc-files/index.js +0 -68
  194. package/dist/esm/cli-commands/tsc.js +0 -83
  195. package/dist/esm/monorepo/utils.js +0 -12
  196. package/dist/esm/scripts/helpers/checkmark.js +0 -10
  197. package/dist/esm/scripts/helpers/get-npm-config.js +0 -5
  198. package/dist/esm/scripts/helpers/progress.js +0 -13
  199. package/dist/esm/scripts/helpers/xmark.js +0 -9
  200. package/dist/esm/scripts/npmcheckversion.js +0 -8
  201. package/dist/esm/server/middlewares/addProdMiddlewares.js +0 -22
  202. package/dist/esm/server/middlewares/index.js +0 -35
  203. package/dist/esm/server/util/index.js +0 -46
  204. package/dist/esm/testing/vitest.setup.js +0 -0
  205. package/dist/esm/typescript/tsc-files/index.js +0 -55
  206. package/dist/esm/typescript/tsc-files/utils.js +0 -12
  207. package/dist/esm/typescript/util.js +0 -6
  208. package/dist/types/cli-commands/tsc.d.ts +0 -20
  209. package/dist/types/monorepo/utils.d.ts +0 -1
  210. package/dist/types/scripts/helpers/checkmark.d.ts +0 -7
  211. package/dist/types/scripts/helpers/get-npm-config.d.ts +0 -2
  212. package/dist/types/scripts/helpers/progress.d.ts +0 -7
  213. package/dist/types/scripts/helpers/xmark.d.ts +0 -6
  214. package/dist/types/scripts/npmcheckversion.d.ts +0 -1
  215. package/dist/types/scripts/update-notifier.d.ts +0 -2
  216. package/dist/types/server/middlewares/addProdMiddlewares.d.ts +0 -1
  217. package/dist/types/testing/mocks/axios.d.cts +0 -14
  218. package/dist/types/testing/mocks/cssModule.d.cts +0 -2
  219. package/dist/types/testing/mocks/html.d.cts +0 -2
  220. package/dist/types/testing/mocks/image.d.cts +0 -2
  221. package/dist/types/testing/mocks/matchMedia.d.cts +0 -2
  222. package/dist/types/testing/vitest.setup.d.ts +0 -0
  223. package/dist/types/typescript/tsc-files/index.d.ts +0 -1
  224. package/dist/types/typescript/tsc-files/utils.d.ts +0 -3
  225. package/dist/types/typescript/util.d.ts +0 -1
@@ -0,0 +1,12 @@
1
+ /* eslint-disable max-lines */
2
+ const { baseRules } = require('../common.cjs');
3
+ const { tsBaseExtends, tsBaseRules, tsBaseConfig } = require('./common.cjs');
4
+
5
+ exports.tsConfig = {
6
+ ...tsBaseConfig,
7
+ extends: ['airbnb-base', 'airbnb-typescript/base'].concat(tsBaseExtends),
8
+ rules: {
9
+ ...baseRules,
10
+ ...tsBaseRules,
11
+ },
12
+ };
@@ -0,0 +1,19 @@
1
+ /* eslint-disable max-lines */
2
+ const { baseRules, reactRules } = require('../common.cjs');
3
+ const { tsBaseExtends, tsBaseRules, tsBaseConfig } = require('./common.cjs');
4
+
5
+ exports.tsReactConfig = {
6
+ ...tsBaseConfig,
7
+ extends: [
8
+ 'airbnb',
9
+ 'airbnb/hooks',
10
+ 'plugin:redux-saga/recommended',
11
+ 'airbnb-typescript',
12
+ ].concat(tsBaseExtends),
13
+ rules: {
14
+ ...baseRules,
15
+ ...tsBaseRules,
16
+ ...reactRules,
17
+ 'react/prop-types': 0,
18
+ },
19
+ };
@@ -24,16 +24,11 @@ __export(lint_staged_config_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(lint_staged_config_exports);
26
26
  var import_node_path = __toESM(require("node:path"), 1);
27
- var import_node_url = require("node:url");
28
27
  var import_node_fs = __toESM(require("node:fs"), 1);
29
- const import_meta = {};
30
- const __dirname = import_node_path.default.dirname((0, import_node_url.fileURLToPath)(import_meta.url));
31
28
  const npmClient = import_node_fs.default.existsSync(import_node_path.default.join(process.cwd(), "pnpm-lock.yaml")) ? "pnpm" : "npm";
32
29
  const lintStagedConfig = {
33
30
  "*.{js,ts,jsx,tsx,md,mdx,html,css,json}": ["prettier --write"],
34
- "*.{ts,tsx}": [
35
- `node ${import_node_path.default.resolve(__dirname, "../typescript/tsc-files/index.js")} --noEmit --emitDeclarationOnly false`
36
- ],
31
+ "*.{ts,tsx}": [`${npmClient} run tscheck`],
37
32
  "*.{js,ts,jsx,tsx}": [
38
33
  `${npmClient} run lint:fix`,
39
34
  `${npmClient} run test:staged`,
@@ -0,0 +1,8 @@
1
+ exports.prettierConfig = {
2
+ printWidth: 80,
3
+ tabWidth: 2,
4
+ useTabs: false,
5
+ semi: true,
6
+ singleQuote: true,
7
+ trailingComma: 'all',
8
+ };
@@ -0,0 +1,19 @@
1
+ exports.stylelintConfig = {
2
+ ignoreFiles: [
3
+ '/dist/**/*',
4
+ '/coverage/**/*',
5
+ '/build/**/*',
6
+ '/reports/**/*',
7
+ '/temp/**/*',
8
+ '/docs/**/*',
9
+ '/demo/**/*',
10
+ '/node_modules/**/*',
11
+ '/vendor/**/*',
12
+ ],
13
+ customSyntax: '@stylelint/postcss-css-in-js',
14
+ extends: [
15
+ 'stylelint-config-recommended',
16
+ 'stylelint-config-styled-components',
17
+ ],
18
+ rules: { 'selector-type-no-unknown': null, 'no-extra-semicolons': null, 'function-no-unknown': null },
19
+ };
@@ -26,7 +26,7 @@ module.exports = __toCommonJS(set_registry_version_exports);
26
26
  var import_promises = require("node:fs/promises");
27
27
  var import_fast_glob = __toESM(require("fast-glob"), 1);
28
28
  var import_normalize_path = __toESM(require("normalize-path"), 1);
29
- var import_utils = require("./utils.js");
29
+ var import_utils = require("./utils.cjs");
30
30
  const monorepoRoot = (0, import_normalize_path.default)((0, import_utils.findMonoRepoRoot)() || "");
31
31
  const setRegistryVersion = async () => {
32
32
  const files = await (0, import_fast_glob.default)([
@@ -26,7 +26,7 @@ module.exports = __toCommonJS(set_workspace_version_exports);
26
26
  var import_promises = require("node:fs/promises");
27
27
  var import_fast_glob = __toESM(require("fast-glob"), 1);
28
28
  var import_normalize_path = __toESM(require("normalize-path"), 1);
29
- var import_utils = require("./utils.js");
29
+ var import_utils = require("./utils.cjs");
30
30
  const monorepoRoot = (0, import_normalize_path.default)((0, import_utils.findMonoRepoRoot)() || "");
31
31
  const setWorkspaceVersion = async () => {
32
32
  const files = await (0, import_fast_glob.default)([
@@ -0,0 +1,30 @@
1
+ const path = require('path');
2
+ const { execSync } = require('child_process');
3
+
4
+ const WORKSPACE_DIR_ENV_VAR = 'NPM_CONFIG_WORKSPACE_DIR';
5
+ const WORKSPACE_MANIFEST_FILENAME = 'pnpm-workspace.yaml';
6
+
7
+ const getPNPMWorkspaceLocation = (cwd) => {
8
+ let location = null;
9
+ // eslint-disable-next-line no-restricted-syntax
10
+ for (const fileName of [WORKSPACE_MANIFEST_FILENAME, 'pnpm-workspace.yml']) {
11
+ try {
12
+ const result = execSync(`npx find-up ${fileName}`, { cwd });
13
+ location = result.toString().trim();
14
+ break;
15
+ } catch (err) {
16
+ // ignore
17
+ }
18
+ }
19
+ return location;
20
+ };
21
+
22
+ exports.findMonoRepoRoot = (cwd = process.cwd()) => {
23
+ const workspaceManifestDirEnvVar =
24
+ process.env[WORKSPACE_DIR_ENV_VAR] ??
25
+ process.env[WORKSPACE_DIR_ENV_VAR.toLowerCase()];
26
+ const workspaceManifestLocation = workspaceManifestDirEnvVar
27
+ ? path.join(workspaceManifestDirEnvVar, 'pnpm-workspace.yaml')
28
+ : getPNPMWorkspaceLocation(cwd);
29
+ return workspaceManifestLocation && path.dirname(workspaceManifestLocation);
30
+ };
File without changes
@@ -0,0 +1,31 @@
1
+ module.exports = {
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:
18
+ '# Changelog\n\nAll notable changes to this project will be documented in this file. See\n[Conventional Commits](https://conventionalcommits.org) for commit guidelines.',
19
+ },
20
+ ],
21
+ '@semantic-release/npm',
22
+ '@semantic-release/github',
23
+ [
24
+ '@semantic-release/exec',
25
+ {
26
+ successCmd:
27
+ 'scmutil get slack-release-notes && scmutil get contributors',
28
+ },
29
+ ],
30
+ ],
31
+ };
@@ -0,0 +1,42 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ const allJS = /\.js$/;
5
+
6
+ const serviceEndpoints = /\.endpoint\.js$/;
7
+
8
+ const getFilesMatching = (filePattern) => {
9
+ const getFiles = (dir) => {
10
+ let routeFiles = [];
11
+ if (!fs.existsSync(dir)) return routeFiles;
12
+ fs.readdirSync(dir).forEach((file) => {
13
+ const fullPath = path.join(dir, file);
14
+ if (fs.lstatSync(fullPath).isDirectory()) {
15
+ routeFiles = routeFiles.concat(getFiles(fullPath));
16
+ } else if (filePattern.test(fullPath)) routeFiles.push(fullPath);
17
+ });
18
+ return routeFiles;
19
+ };
20
+ return getFiles;
21
+ };
22
+
23
+ const getServerRouteFiles = getFilesMatching(allJS);
24
+ const getServiceEndpoints = getFilesMatching(serviceEndpoints);
25
+
26
+ exports.loadRoutes = (app) => {
27
+ const routeFiles = getServerRouteFiles(
28
+ path.join(process.cwd(), 'server/routes'),
29
+ );
30
+ routeFiles.push(...getServiceEndpoints(path.join(process.cwd(), 'app')));
31
+ routeFiles.push(...getServiceEndpoints(path.join(process.cwd(), 'lib')));
32
+ routeFiles.forEach((routeFile) => {
33
+ // eslint-disable-next-line global-require
34
+ const init = require(routeFile);
35
+ try {
36
+ init(app);
37
+ } catch (err) {
38
+ // eslint-disable-next-line no-console
39
+ console.error(`unable to load routes from ${routeFile}. ${err.message}`);
40
+ }
41
+ });
42
+ };
@@ -15,15 +15,16 @@ var __copyProps = (to, from, except, desc) => {
15
15
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
16
16
  var import_express = __toESM(require("express"), 1);
17
17
  var import_logger = require("./logger.js");
18
- var import_middlewares = require("./middlewares/index.js");
19
- var import_util = require("./util/index.js");
18
+ var import_middlewares = require("./middlewares.js");
19
+ var import_utils = require("./utils.js");
20
+ var import_app_routes = require("./app-routes.cjs");
20
21
  const app = (0, import_express.default)();
21
22
  (0, import_middlewares.setupDefaultMiddlewares)(app);
22
- (0, import_util.loadRoutes)(app);
23
+ (0, import_app_routes.loadRoutes)(app);
23
24
  (0, import_middlewares.setupAdditionalMiddlewars)(app);
24
- app.listen(import_util.port, import_util.host, async (err) => {
25
+ app.listen(import_utils.port, import_utils.host, async (err) => {
25
26
  if (err) {
26
27
  return import_logger.logger.error(err.message);
27
28
  }
28
- import_logger.logger.appStarted(import_util.port, import_util.host || "localhost");
29
+ import_logger.logger.appStarted(import_utils.port, import_utils.host || "localhost");
29
30
  });
@@ -26,9 +26,12 @@ __export(middlewares_exports, {
26
26
  module.exports = __toCommonJS(middlewares_exports);
27
27
  var import_express = __toESM(require("express"), 1);
28
28
  var import_cors = __toESM(require("cors"), 1);
29
+ var import_compression = __toESM(require("compression"), 1);
30
+ var import_express_static_gzip = __toESM(require("express-static-gzip"), 1);
29
31
  var import_express_pino_logger = __toESM(require("express-pino-logger"), 1);
30
- var import_csp = require("../csp.js");
31
- var import_addProdMiddlewares = require("./addProdMiddlewares.js");
32
+ var import_csp = require("./csp.js");
33
+ var import_helpers = require("../webpack/helpers.js");
34
+ const paths = (0, import_helpers.getPaths)();
32
35
  const setupDefaultMiddlewares = (app) => {
33
36
  const pino = (0, import_express_pino_logger.default)({
34
37
  transport: {
@@ -48,10 +51,18 @@ const setupDefaultMiddlewares = (app) => {
48
51
  app.use(import_express.default.json({ type: "application/json" }));
49
52
  app.use(import_express.default.json({ type: "application/csp-report" }));
50
53
  };
51
- const setupAdditionalMiddlewars = (app, options) => {
52
- const isProd = false;
53
- if (isProd) {
54
- (0, import_addProdMiddlewares.addProdMiddlewares)(app, options);
55
- }
54
+ const setupAdditionalMiddlewars = (app, options = {}) => {
55
+ const { buildPath = paths.buildPath, basePath = paths.basePath } = options;
56
+ app.use((0, import_compression.default)());
57
+ app.get(basePath, (req, res) => {
58
+ (0, import_csp.sendFileWithCSPNonce)({ buildPath, res });
59
+ });
60
+ app.use(basePath, (0, import_express_static_gzip.default)(buildPath, {
61
+ index: false,
62
+ enableBrotli: true,
63
+ orderPreference: ["br"]
64
+ }));
65
+ app.use((0, import_express_static_gzip.default)("cdn"));
66
+ app.get("*", (req, res) => (0, import_csp.sendFileWithCSPNonce)({ buildPath, res }));
56
67
  return app;
57
68
  };
@@ -18,11 +18,15 @@ var __copyProps = (to, from, except, desc) => {
18
18
  };
19
19
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
20
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
- var util_exports = {};
22
- __export(util_exports, {
23
- isTypeScriptEnabled: () => isTypeScriptEnabled
21
+ var utils_exports = {};
22
+ __export(utils_exports, {
23
+ getCWD: () => getCWD,
24
+ host: () => host,
25
+ port: () => port
24
26
  });
25
- module.exports = __toCommonJS(util_exports);
26
- var import_node_fs = __toESM(require("node:fs"), 1);
27
- var import_node_path = __toESM(require("node:path"), 1);
28
- const isTypeScriptEnabled = () => import_node_fs.default.existsSync(import_node_path.default.join(process.cwd(), "tsconfig.json"));
27
+ module.exports = __toCommonJS(utils_exports);
28
+ var import_minimist = __toESM(require("minimist"), 1);
29
+ const argv = (0, import_minimist.default)(process.argv.slice(2));
30
+ const getCWD = () => process.cwd();
31
+ const port = parseInt(argv.port || process.env.port || process.env.PORT || "3000", 10);
32
+ const host = argv.host || process.env.HOST;
@@ -0,0 +1,103 @@
1
+ const path = require('path');
2
+ const normalizePath = require('normalize-path');
3
+ const { getAppConfig, basePath } = require('../utils.cjs');
4
+ const { swcrcConfig } = require('../transpile/swcrc.config.cjs');
5
+ const { findMonoRepoRoot } = require('../monorepo/utils.cjs');
6
+
7
+ let isReactModule = true;
8
+ try {
9
+ /* eslint-disable global-require, import/no-unresolved */
10
+ require('react');
11
+ require('styled-components');
12
+ /* eslint-enable global-require, import/no-unresolved */
13
+ } catch (err) {
14
+ isReactModule = false;
15
+ }
16
+
17
+ const getMockFilePath = (fileName) =>
18
+ normalizePath(path.resolve(__dirname, './mocks', fileName));
19
+
20
+ const getNodeModulesPath = (fileName) => {
21
+ const monorepoRoot = findMonoRepoRoot(process.cwd());
22
+ return normalizePath(
23
+ monorepoRoot
24
+ ? path.join(monorepoRoot, 'node_modules', fileName)
25
+ : `<rootDir>/node_modules/${fileName}`,
26
+ );
27
+ };
28
+
29
+ const jestConfig = {
30
+ collectCoverageFrom: [
31
+ 'app/**/*.{js,ts,jsx,tsx}',
32
+ 'lib/**/*.{js,ts,jsx,tsx}',
33
+ '!app/**/*.d.ts',
34
+ '!lib/**/*.d.ts',
35
+ '!app/**/*.test.{js,ts,jsx,tsx}',
36
+ '!lib/**/*.test.{js,ts,jsx,tsx}',
37
+ '!app/**/*.stories.{js,ts,jsx,tsx}',
38
+ '!lib/**/*.stories.{js,ts,jsx,tsx}',
39
+ '!app/**/*.endpoint.{js,ts,jsx,tsx}',
40
+ '!lib/**/*.endpoint.{js,ts,jsx,tsx}',
41
+ '!app/*/RbGenerated*/*.{js,ts,jsx,tsx}',
42
+ '!app/index.{js,ts,jsx,tsx}',
43
+ '!app/global-styles.{js,ts,jsx,tsx}',
44
+ '!app/**/loadable.{js,ts,jsx,tsx}',
45
+ '!lib/**/loadable.{js,ts,jsx,tsx}',
46
+ ],
47
+ coverageThreshold: {
48
+ // Todo: enable the coverage threshold later
49
+ // global: {
50
+ // statements: 95,
51
+ // branches: 90,
52
+ // functions: 95,
53
+ // lines: 95,
54
+ // },
55
+ },
56
+ coverageDirectory: 'reports',
57
+ coverageReporters: ['lcov', 'html', 'text-summary'],
58
+ moduleDirectories: ['node_modules', 'app', 'lib'],
59
+ moduleNameMapper: {
60
+ '.*\\webpack-hmr(.[t|j]s)?$': getMockFilePath('webpack-hmr.js'),
61
+ '.*\\.(css|scss)$': getMockFilePath('cssModule.js'),
62
+ '.*\\.(jpg|jpeg|png|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga|ico)$':
63
+ getMockFilePath('image.js'),
64
+ '.*\\.svg(?:\\?[a-zA-Z]+)?$': getMockFilePath('svg.js'),
65
+ '.*\\.html(?:\\?[a-zA-Z]+)?$': getMockFilePath('html.js'),
66
+ '@elliemae/pui-user-monitoring': getMockFilePath('pui-user-monitoring.js'),
67
+ '@elliemae/pui-app-loader': getMockFilePath('pui-app-loader.js'),
68
+ '@elliemae/pui-diagnostics': getMockFilePath('pui-diagnostics.js'),
69
+ 'react-spring/web': getNodeModulesPath('react-spring/web.cjs.js'),
70
+ 'react-spring/renderprops': getNodeModulesPath(
71
+ 'react-spring/renderprops.cjs.js',
72
+ ),
73
+ },
74
+ moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
75
+ setupFilesAfterEnv: [path.resolve(__dirname, './setup-tests.js')],
76
+ setupFiles: ['raf/polyfill', 'whatwg-fetch'],
77
+ testRegex: '(app|lib).*/tests/.*\\.test\\.[jt]sx?$',
78
+ snapshotSerializers: [],
79
+ testResultsProcessor: 'jest-sonar-reporter',
80
+ resolver: path.resolve(__dirname, './resolver.cjs'),
81
+ transform: {
82
+ '^.+\\.[jt]sx?$': ['@swc/jest', swcrcConfig],
83
+ },
84
+ transformIgnorePatterns: [
85
+ 'node_modules/(?!(.*@elliemae/pui-cli|lodash-es|react-select|react-dates)/)',
86
+ ],
87
+ globals: {
88
+ APP_CONFIG: getAppConfig(),
89
+ __webpack_public_path__: '/',
90
+ },
91
+ testEnvironmentOptions: {
92
+ url: `http://localhost:3111${basePath}`,
93
+ },
94
+ testEnvironment: 'jsdom',
95
+ watchPlugins: ['jest-watch-typeahead/filename', 'jest-watch-typeahead/testname'],
96
+ };
97
+
98
+ if (isReactModule && jestConfig.setupFilesAfterEnv)
99
+ jestConfig.setupFilesAfterEnv.push(
100
+ path.resolve(__dirname, './setup-react-env.js'),
101
+ );
102
+
103
+ exports.jestConfig = jestConfig;
@@ -0,0 +1,8 @@
1
+ const { jestConfig } = require('./jest.config.cjs');
2
+ exports.jestNodeConfig = {
3
+ ...jestConfig,
4
+ testEnvironment: 'node',
5
+ transformIgnorePatterns: [],
6
+ setupFiles: [],
7
+ setupFilesAfterEnv: [],
8
+ };
@@ -15,17 +15,23 @@ var __copyProps = (to, from, except, desc) => {
15
15
  return to;
16
16
  };
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var utils_exports = {};
19
- __export(utils_exports, {
20
- randomChars: () => randomChars,
21
- resolveFromModule: () => resolveFromModule,
22
- resolveFromRoot: () => resolveFromRoot
18
+ var axios_exports = {};
19
+ __export(axios_exports, {
20
+ default: () => axios_default
23
21
  });
24
- module.exports = __toCommonJS(utils_exports);
25
- var import_node_path = require("node:path");
26
- const randomChars = () => Math.random().toString(36).slice(2);
27
- const resolveFromModule = (moduleName, ...paths) => {
28
- const modulePath = (0, import_node_path.dirname)(require.resolve(`${moduleName}/package.json`));
29
- return (0, import_node_path.join)(modulePath, ...paths);
22
+ module.exports = __toCommonJS(axios_exports);
23
+ var axios_default = {
24
+ defaults: {},
25
+ interceptors: {
26
+ request: {
27
+ use: jest.fn()
28
+ },
29
+ response: {
30
+ use: jest.fn()
31
+ }
32
+ },
33
+ create: jest.fn().mockReturnThis(),
34
+ get: jest.fn().mockResolvedValue({ data: {} }),
35
+ post: jest.fn().mockResolvedValue({ data: {} }),
36
+ put: jest.fn().mockResolvedValue({ data: {} })
30
37
  };
31
- const resolveFromRoot = (...paths) => (0, import_node_path.join)(process.cwd(), ...paths);
@@ -1,8 +1,6 @@
1
- var __create = Object.create;
2
1
  var __defProp = Object.defineProperty;
3
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __getProtoOf = Object.getPrototypeOf;
6
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
5
  var __export = (target, all) => {
8
6
  for (var name in all)
@@ -16,17 +14,10 @@ var __copyProps = (to, from, except, desc) => {
16
14
  }
17
15
  return to;
18
16
  };
19
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
20
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
- var checkmark_exports = {};
22
- __export(checkmark_exports, {
23
- default: () => checkmark_default
18
+ var cssModule_exports = {};
19
+ __export(cssModule_exports, {
20
+ default: () => cssModule_default
24
21
  });
25
- module.exports = __toCommonJS(checkmark_exports);
26
- var import_chalk = __toESM(require("chalk"), 1);
27
- function checkmark_default(callback, message = "") {
28
- process.stdout.write("\n\n");
29
- process.stdout.write(import_chalk.default.green(" \u2713"));
30
- if (callback)
31
- callback(message);
32
- }
22
+ module.exports = __toCommonJS(cssModule_exports);
23
+ var cssModule_default = "CSS_MODULE";
@@ -0,0 +1,23 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var html_exports = {};
19
+ __export(html_exports, {
20
+ default: () => html_default
21
+ });
22
+ module.exports = __toCommonJS(html_exports);
23
+ var html_default = "HTML_MODULE";
@@ -0,0 +1,23 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var image_exports = {};
19
+ __export(image_exports, {
20
+ default: () => image_default
21
+ });
22
+ module.exports = __toCommonJS(image_exports);
23
+ var image_default = "IMAGE_MOCK";
@@ -0,0 +1,43 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var matchMedia_exports = {};
19
+ __export(matchMedia_exports, {
20
+ addMatchMedia: () => addMatchMedia
21
+ });
22
+ module.exports = __toCommonJS(matchMedia_exports);
23
+ const addMatchMedia = () => {
24
+ Object.defineProperty(window, "matchMedia", {
25
+ writable: true,
26
+ value: jest.fn().mockImplementation((query) => ({
27
+ matches: false,
28
+ media: query,
29
+ onchange: null,
30
+ addListener: jest.fn(),
31
+ removeListener: jest.fn(),
32
+ addEventListener: jest.fn(),
33
+ removeEventListener: jest.fn(),
34
+ dispatchEvent: jest.fn()
35
+ }))
36
+ });
37
+ Object.defineProperty(window, "getComputedStyle", {
38
+ value: () => ({
39
+ getPropertyValue: () => {
40
+ }
41
+ })
42
+ });
43
+ };
@@ -0,0 +1,24 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var pui_app_loader_exports = {};
19
+ __export(pui_app_loader_exports, {
20
+ load: () => load
21
+ });
22
+ module.exports = __toCommonJS(pui_app_loader_exports);
23
+ const load = () => {
24
+ };