@elliemae/pui-cli 7.0.0-beta.9 → 7.2.0

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 (283) hide show
  1. package/README.md +4 -0
  2. package/{lib/babel/babel.config.js → dist/cjs/babel.config.cjs} +3 -7
  3. package/dist/cjs/cli.js +53 -0
  4. package/dist/cjs/commands/build.js +81 -0
  5. package/dist/cjs/commands/codemod.js +55 -0
  6. package/dist/cjs/commands/gendoc.js +53 -0
  7. package/dist/cjs/commands/lint.js +95 -0
  8. package/dist/cjs/commands/pack.js +98 -0
  9. package/dist/cjs/commands/start.js +76 -0
  10. package/dist/cjs/commands/storybook.js +71 -0
  11. package/dist/cjs/commands/test.js +100 -0
  12. package/dist/cjs/commands/tscheck.js +82 -0
  13. package/dist/cjs/commands/utils.js +157 -0
  14. package/dist/cjs/commands/version.js +77 -0
  15. package/dist/cjs/commands/vitest.js +93 -0
  16. package/dist/cjs/dummy.js +1 -0
  17. package/dist/cjs/index.cjs +25 -0
  18. package/dist/cjs/index.js +42 -0
  19. package/dist/cjs/jsdoc.conf.json +17 -0
  20. package/dist/cjs/lint-config/commitlint.config.cjs +1 -0
  21. package/{lib/lint/eslint/common.js → dist/cjs/lint-config/eslint/common.cjs} +5 -5
  22. package/{lib/lint/eslint/non-react.js → dist/cjs/lint-config/eslint/non-react.cjs} +2 -2
  23. package/{lib/lint/eslint/react.js → dist/cjs/lint-config/eslint/react.cjs} +2 -2
  24. package/{lib/lint/eslint/typescript/common.js → dist/cjs/lint-config/eslint/typescript/common.cjs} +1 -1
  25. package/{lib/lint/eslint/typescript/non-react.js → dist/cjs/lint-config/eslint/typescript/non-react.cjs} +2 -2
  26. package/{lib/lint/eslint/typescript/react.js → dist/cjs/lint-config/eslint/typescript/react.cjs} +2 -2
  27. package/dist/cjs/lint-config/lint-staged.config.js +40 -0
  28. package/{lib/lint/prettier.config.js → dist/cjs/lint-config/prettier.config.cjs} +1 -1
  29. package/{lib/lint/stylelint.config.js → dist/cjs/lint-config/stylelint.config.cjs} +2 -2
  30. package/dist/cjs/monorepo/delete-merged-tags.js +58 -0
  31. package/dist/cjs/monorepo/set-registry-version.js +49 -0
  32. package/dist/cjs/monorepo/set-workspace-version.js +56 -0
  33. package/{lib/monorepo/utils.js → dist/cjs/monorepo/utils.cjs} +17 -2
  34. package/dist/cjs/package.json +4 -0
  35. package/dist/cjs/pui-config.js +44 -0
  36. package/{lib/release/release.config.js → dist/cjs/release.config.cjs} +0 -0
  37. package/{lib/server/util/index.js → dist/cjs/server/app-routes.cjs} +5 -15
  38. package/dist/cjs/server/csp.js +94 -0
  39. package/dist/cjs/server/index.js +34 -0
  40. package/dist/cjs/server/logger.js +58 -0
  41. package/dist/cjs/server/middlewares.js +75 -0
  42. package/dist/cjs/server/utils.js +39 -0
  43. package/{lib/testing/jest.config.js → dist/cjs/testing/jest.config.cjs} +10 -10
  44. package/{lib/testing/jest.node.config.js → dist/cjs/testing/jest.node.config.cjs} +1 -1
  45. package/dist/cjs/testing/mocks/axios.js +38 -0
  46. package/dist/cjs/testing/mocks/cssModule.js +24 -0
  47. package/dist/cjs/testing/mocks/html.js +24 -0
  48. package/dist/cjs/testing/mocks/image.js +24 -0
  49. package/dist/cjs/testing/mocks/matchMedia.js +44 -0
  50. package/dist/cjs/testing/mocks/pui-app-loader.js +25 -0
  51. package/dist/cjs/testing/mocks/pui-diagnostics.js +69 -0
  52. package/dist/cjs/testing/mocks/pui-user-monitoring.js +31 -0
  53. package/dist/cjs/testing/mocks/retry-axios.js +28 -0
  54. package/dist/cjs/testing/mocks/svg.js +33 -0
  55. package/dist/cjs/testing/mocks/webpack-hmr.js +25 -0
  56. package/{lib/testing/resolver.js → dist/cjs/testing/resolver.cjs} +0 -0
  57. package/dist/cjs/testing/setup-react-env.js +22 -0
  58. package/dist/cjs/testing/setup-test-env.js +23 -0
  59. package/dist/cjs/testing/setup-tests.js +69 -0
  60. package/dist/cjs/testing/vitest.config.js +52 -0
  61. package/{lib → dist/cjs}/transpile/.swcrc +0 -0
  62. package/dist/cjs/transpile/esbuild.js +134 -0
  63. package/dist/cjs/transpile/react-shim.js +30 -0
  64. package/{lib/transpile/swcrc.config.js → dist/cjs/transpile/swcrc.config.cjs} +1 -1
  65. package/dist/cjs/typedoc.cjs +12 -0
  66. package/{lib → dist/cjs}/typescript/app.tsconfig.json +0 -0
  67. package/{lib → dist/cjs}/typescript/library.tsconfig.json +0 -0
  68. package/dist/cjs/update-notifier.js +37 -0
  69. package/dist/cjs/utils.cjs +23 -0
  70. package/dist/cjs/webpack/helpers.js +237 -0
  71. package/dist/cjs/webpack/webpack.base.babel.js +280 -0
  72. package/dist/cjs/webpack/webpack.dev.babel.js +144 -0
  73. package/dist/cjs/webpack/webpack.lib.base.babel.js +212 -0
  74. package/dist/cjs/webpack/webpack.lib.dev.babel.js +93 -0
  75. package/dist/cjs/webpack/webpack.lib.prod.babel.js +95 -0
  76. package/dist/cjs/webpack/webpack.prod.babel.js +145 -0
  77. package/dist/cjs/webpack/webpack.storybook.js +111 -0
  78. package/dist/esm/babel.config.cjs +97 -0
  79. package/dist/esm/cli.js +33 -0
  80. package/dist/esm/commands/build.js +61 -0
  81. package/dist/esm/commands/codemod.js +29 -0
  82. package/dist/esm/commands/gendoc.js +26 -0
  83. package/dist/esm/commands/lint.js +69 -0
  84. package/dist/esm/commands/pack.js +71 -0
  85. package/dist/esm/commands/start.js +49 -0
  86. package/dist/esm/commands/storybook.js +45 -0
  87. package/dist/esm/commands/test.js +74 -0
  88. package/dist/esm/commands/tscheck.js +56 -0
  89. package/dist/esm/commands/utils.js +143 -0
  90. package/dist/esm/commands/version.js +51 -0
  91. package/dist/esm/commands/vitest.js +66 -0
  92. package/{lib/dummy.ts → dist/esm/dummy.js} +0 -0
  93. package/dist/esm/index.cjs +25 -0
  94. package/dist/esm/index.js +22 -0
  95. package/dist/esm/jsdoc.conf.json +17 -0
  96. package/dist/esm/lint-config/commitlint.config.cjs +1 -0
  97. package/dist/esm/lint-config/eslint/common.cjs +160 -0
  98. package/dist/esm/lint-config/eslint/non-react.cjs +14 -0
  99. package/dist/esm/lint-config/eslint/react.cjs +26 -0
  100. package/dist/esm/lint-config/eslint/typescript/common.cjs +43 -0
  101. package/dist/esm/lint-config/eslint/typescript/non-react.cjs +12 -0
  102. package/dist/esm/lint-config/eslint/typescript/react.cjs +19 -0
  103. package/dist/esm/lint-config/lint-staged.config.js +14 -0
  104. package/dist/esm/lint-config/prettier.config.cjs +8 -0
  105. package/dist/esm/lint-config/stylelint.config.cjs +19 -0
  106. package/dist/esm/monorepo/delete-merged-tags.js +38 -0
  107. package/dist/esm/monorepo/set-registry-version.js +23 -0
  108. package/dist/esm/monorepo/set-workspace-version.js +30 -0
  109. package/dist/esm/monorepo/utils.cjs +30 -0
  110. package/dist/esm/package.json +4 -0
  111. package/dist/esm/pui-config.js +18 -0
  112. package/dist/esm/release.config.cjs +31 -0
  113. package/dist/esm/server/app-routes.cjs +42 -0
  114. package/dist/esm/server/csp.js +68 -0
  115. package/dist/esm/server/index.js +18 -0
  116. package/dist/esm/server/logger.js +32 -0
  117. package/dist/esm/server/middlewares.js +49 -0
  118. package/dist/esm/server/utils.js +13 -0
  119. package/dist/esm/testing/jest.config.cjs +103 -0
  120. package/dist/esm/testing/jest.node.config.cjs +8 -0
  121. package/{lib → dist/esm}/testing/mocks/axios.js +8 -5
  122. package/dist/esm/testing/mocks/cssModule.js +4 -0
  123. package/dist/esm/testing/mocks/html.js +4 -0
  124. package/dist/esm/testing/mocks/image.js +4 -0
  125. package/dist/esm/testing/mocks/matchMedia.js +24 -0
  126. package/dist/esm/testing/mocks/pui-app-loader.js +5 -0
  127. package/dist/esm/testing/mocks/pui-diagnostics.js +49 -0
  128. package/dist/esm/testing/mocks/pui-user-monitoring.js +11 -0
  129. package/dist/esm/testing/mocks/retry-axios.js +8 -0
  130. package/dist/esm/testing/mocks/svg.js +7 -0
  131. package/dist/esm/testing/mocks/webpack-hmr.js +5 -0
  132. package/dist/esm/testing/resolver.cjs +47 -0
  133. package/dist/esm/testing/setup-react-env.js +3 -0
  134. package/dist/esm/testing/setup-test-env.js +4 -0
  135. package/dist/esm/testing/setup-tests.js +50 -0
  136. package/dist/esm/testing/vitest.config.js +25 -0
  137. package/dist/esm/transpile/.swcrc +11 -0
  138. package/{lib → dist/esm}/transpile/esbuild.js +35 -44
  139. package/dist/esm/transpile/react-shim.js +4 -0
  140. package/dist/esm/transpile/swcrc.config.cjs +13 -0
  141. package/dist/esm/typedoc.cjs +12 -0
  142. package/dist/esm/typescript/app.tsconfig.json +23 -0
  143. package/dist/esm/typescript/library.tsconfig.json +23 -0
  144. package/dist/esm/update-notifier.js +11 -0
  145. package/dist/esm/utils.cjs +23 -0
  146. package/dist/esm/webpack/helpers.js +211 -0
  147. package/dist/esm/webpack/webpack.base.babel.js +260 -0
  148. package/dist/esm/webpack/webpack.dev.babel.js +121 -0
  149. package/dist/esm/webpack/webpack.lib.base.babel.js +192 -0
  150. package/dist/esm/webpack/webpack.lib.dev.babel.js +67 -0
  151. package/dist/esm/webpack/webpack.lib.prod.babel.js +69 -0
  152. package/dist/esm/webpack/webpack.prod.babel.js +124 -0
  153. package/dist/esm/webpack/webpack.storybook.js +85 -0
  154. package/dist/types/babel.config.d.cts +59 -0
  155. package/dist/types/cli.d.ts +2 -0
  156. package/dist/types/commands/build.d.ts +14 -0
  157. package/dist/types/commands/codemod.d.ts +6 -0
  158. package/dist/types/commands/gendoc.d.ts +6 -0
  159. package/dist/types/commands/lint.d.ts +29 -0
  160. package/dist/types/commands/pack.d.ts +26 -0
  161. package/dist/types/commands/start.d.ts +13 -0
  162. package/dist/types/commands/storybook.d.ts +19 -0
  163. package/dist/types/commands/test.d.ts +39 -0
  164. package/dist/types/commands/tscheck.d.ts +14 -0
  165. package/dist/types/commands/utils.d.ts +16 -0
  166. package/dist/types/commands/version.d.ts +30 -0
  167. package/dist/types/commands/vitest.d.ts +35 -0
  168. package/{lib/testing/vitest.setup.ts → dist/types/dummy.d.ts} +0 -0
  169. package/dist/types/index.d.cts +10 -0
  170. package/dist/types/index.d.ts +10 -0
  171. package/dist/types/lint-config/commitlint.config.d.cts +4 -0
  172. package/dist/types/lint-config/eslint/common.d.cts +127 -0
  173. package/dist/types/lint-config/eslint/non-react.d.cts +93 -0
  174. package/dist/types/lint-config/eslint/react.d.cts +123 -0
  175. package/dist/types/lint-config/eslint/typescript/common.d.cts +37 -0
  176. package/dist/types/lint-config/eslint/typescript/non-react.d.cts +87 -0
  177. package/dist/types/lint-config/eslint/typescript/react.d.cts +118 -0
  178. package/dist/types/lint-config/lint-staged.config.d.ts +5 -0
  179. package/dist/types/lint-config/prettier.config.d.cts +8 -0
  180. package/dist/types/lint-config/stylelint.config.d.cts +11 -0
  181. package/dist/types/monorepo/delete-merged-tags.d.ts +1 -0
  182. package/dist/types/monorepo/set-registry-version.d.ts +1 -0
  183. package/dist/types/monorepo/set-workspace-version.d.ts +1 -0
  184. package/dist/types/monorepo/utils.d.cts +1 -0
  185. package/dist/types/pui-config.d.ts +1 -0
  186. package/dist/types/release.config.d.cts +9 -0
  187. package/dist/types/server/app-routes.d.cts +1 -0
  188. package/dist/types/server/csp.d.ts +10 -0
  189. package/dist/types/server/index.d.ts +1 -0
  190. package/dist/types/server/logger.d.ts +4 -0
  191. package/dist/types/server/middlewares.d.ts +2 -0
  192. package/dist/types/server/utils.d.ts +3 -0
  193. package/dist/types/testing/jest.config.d.cts +39 -0
  194. package/dist/types/testing/jest.node.config.d.cts +39 -0
  195. package/dist/types/testing/mocks/axios.d.ts +17 -0
  196. package/dist/types/testing/mocks/cssModule.d.ts +2 -0
  197. package/dist/types/testing/mocks/html.d.ts +2 -0
  198. package/dist/types/testing/mocks/image.d.ts +2 -0
  199. package/dist/types/testing/mocks/matchMedia.d.ts +1 -0
  200. package/dist/types/testing/mocks/pui-app-loader.d.ts +1 -0
  201. package/dist/types/testing/mocks/pui-diagnostics.d.ts +28 -0
  202. package/dist/types/testing/mocks/pui-user-monitoring.d.ts +3 -0
  203. package/dist/types/testing/mocks/retry-axios.d.ts +3 -0
  204. package/dist/types/testing/mocks/svg.d.ts +3 -0
  205. package/dist/types/testing/mocks/webpack-hmr.d.ts +1 -0
  206. package/dist/types/testing/resolver.d.cts +2 -0
  207. package/dist/types/testing/setup-react-env.d.ts +1 -0
  208. package/dist/types/testing/setup-test-env.d.ts +2 -0
  209. package/dist/types/testing/setup-tests.d.ts +1 -0
  210. package/dist/types/testing/vitest.config.d.ts +2 -0
  211. package/dist/types/transpile/esbuild.d.ts +13 -0
  212. package/dist/types/transpile/react-shim.d.ts +2 -0
  213. package/dist/types/transpile/swcrc.config.d.cts +1 -0
  214. package/dist/types/typedoc.d.cts +3 -0
  215. package/dist/types/update-notifier.d.ts +1 -0
  216. package/dist/types/utils.d.cts +4 -0
  217. package/dist/types/webpack/helpers.d.ts +28 -0
  218. package/dist/types/webpack/webpack.base.babel.d.ts +90 -0
  219. package/dist/types/webpack/webpack.dev.babel.d.ts +2 -0
  220. package/dist/types/webpack/webpack.lib.base.babel.d.ts +110 -0
  221. package/dist/types/webpack/webpack.lib.dev.babel.d.ts +110 -0
  222. package/dist/types/webpack/webpack.lib.prod.babel.d.ts +110 -0
  223. package/dist/types/webpack/webpack.prod.babel.d.ts +2 -0
  224. package/dist/types/webpack/webpack.storybook.d.ts +4 -0
  225. package/package.json +159 -144
  226. package/lib/cli-commands/build.js +0 -60
  227. package/lib/cli-commands/codemod.js +0 -31
  228. package/lib/cli-commands/gendoc.js +0 -36
  229. package/lib/cli-commands/lint.js +0 -75
  230. package/lib/cli-commands/pack.js +0 -67
  231. package/lib/cli-commands/start.js +0 -49
  232. package/lib/cli-commands/storybook.js +0 -53
  233. package/lib/cli-commands/test.js +0 -63
  234. package/lib/cli-commands/tsc.js +0 -103
  235. package/lib/cli-commands/utils.js +0 -135
  236. package/lib/cli-commands/version.js +0 -53
  237. package/lib/cli-commands/vitest.js +0 -66
  238. package/lib/cli.js +0 -33
  239. package/lib/docgen/jsdoc.config.js +0 -17
  240. package/lib/index.js +0 -25
  241. package/lib/lint/commitlint.config.js +0 -1
  242. package/lib/lint/lint-staged.config.js +0 -16
  243. package/lib/monorepo/delete-merged-tags.js +0 -48
  244. package/lib/monorepo/set-registry-version.js +0 -22
  245. package/lib/monorepo/set-workspace-version.js +0 -29
  246. package/lib/pui-config/index.js +0 -18
  247. package/lib/scripts/helpers/checkmark.js +0 -15
  248. package/lib/scripts/helpers/get-npm-config.js +0 -3
  249. package/lib/scripts/helpers/progress.js +0 -19
  250. package/lib/scripts/helpers/xmark.js +0 -13
  251. package/lib/scripts/npmcheckversion.js +0 -8
  252. package/lib/scripts/update-notifier.js +0 -7
  253. package/lib/server/csp.js +0 -74
  254. package/lib/server/index.js +0 -37
  255. package/lib/server/logger.js +0 -42
  256. package/lib/server/middlewares/addDevMiddlewares.js +0 -39
  257. package/lib/server/middlewares/addProdMiddlewares.js +0 -30
  258. package/lib/server/middlewares/index.js +0 -37
  259. package/lib/testing/mocks/cssModule.js +0 -1
  260. package/lib/testing/mocks/html.js +0 -1
  261. package/lib/testing/mocks/image.js +0 -1
  262. package/lib/testing/mocks/matchMedia.js +0 -24
  263. package/lib/testing/mocks/pui-app-loader.js +0 -1
  264. package/lib/testing/mocks/pui-diagnostics.js +0 -28
  265. package/lib/testing/mocks/pui-user-monitoring.js +0 -3
  266. package/lib/testing/mocks/retry-axios.js +0 -3
  267. package/lib/testing/mocks/svg.js +0 -5
  268. package/lib/testing/mocks/webpack-hmr.js +0 -1
  269. package/lib/testing/setup-react-env.js +0 -3
  270. package/lib/testing/setup-tests.js +0 -58
  271. package/lib/testing/vitest.config.ts +0 -16
  272. package/lib/transpile/react-shim.js +0 -2
  273. package/lib/typescript/tsc-files/index.js +0 -66
  274. package/lib/typescript/tsc-files/utils.js +0 -16
  275. package/lib/typescript/util.js +0 -5
  276. package/lib/webpack/helpers.js +0 -252
  277. package/lib/webpack/webpack.base.babel.js +0 -242
  278. package/lib/webpack/webpack.dev.babel.js +0 -139
  279. package/lib/webpack/webpack.lib.base.babel.js +0 -205
  280. package/lib/webpack/webpack.lib.dev.babel.js +0 -49
  281. package/lib/webpack/webpack.lib.prod.babel.js +0 -77
  282. package/lib/webpack/webpack.prod.babel.js +0 -142
  283. package/lib/webpack/webpack.storybook.js +0 -87
@@ -1,53 +0,0 @@
1
- const { exit } = require('yargs');
2
- const { exec, logError } = require('./utils');
3
- const { setWorkspaceVersion } = require('../monorepo/set-workspace-version');
4
- const { setRegistryVersion } = require('../monorepo/set-registry-version');
5
- const { deleteMergedTags } = require('../monorepo/delete-merged-tags');
6
-
7
- const version = async (lernaOptions = '') => {
8
- await exec(
9
- `cross-env NODE_ENV=production lerna version --conventional-commits --exact --create-release github --force-publish --yes ${lernaOptions}`,
10
- );
11
- };
12
-
13
- async function handler(argv) {
14
- try {
15
- if (argv.deleteTags) {
16
- await deleteMergedTags();
17
- } else if (argv.useRegistry) {
18
- await setRegistryVersion();
19
- } else if (argv.useWorkspace) {
20
- await setWorkspaceVersion();
21
- } else {
22
- await version(argv.lernaOptions);
23
- }
24
- } catch (err) {
25
- logError('Monorepo versioning failed', err);
26
- exit(-1, err);
27
- }
28
- }
29
-
30
- exports.command = 'version [options]';
31
-
32
- exports.describe = 'version monorepo';
33
-
34
- exports.builder = {
35
- deleteTags: {
36
- type: 'boolean',
37
- default: false,
38
- },
39
- useRegistry: {
40
- type: 'boolean',
41
- default: false,
42
- },
43
- useWorkspace: {
44
- type: 'boolean',
45
- default: false,
46
- },
47
- lernaOptions: {
48
- type: 'string',
49
- default: false,
50
- },
51
- };
52
-
53
- exports.handler = handler;
@@ -1,66 +0,0 @@
1
- const { exit } = require('yargs');
2
- const path = require('path');
3
- const { exec, logError, logSuccess } = require('./utils');
4
-
5
- const { CI = false } = process.env;
6
-
7
- const configPath = path.resolve(__dirname, '../testing/vitest.config.ts');
8
-
9
- async function test(commandOptions) {
10
- await exec(
11
- `cross-env FORCE_COLOR=true vitest --config ${configPath} ${commandOptions}`,
12
- );
13
- }
14
-
15
- // eslint-disable-next-line max-statements
16
- async function handler(argv) {
17
- let commandOptions = '--coverage';
18
- if (argv.fix) commandOptions = '-u';
19
- else if (argv.watch) commandOptions = '--watch';
20
- if (argv.p) commandOptions += ' --passWithNoTests';
21
- if (argv.r) commandOptions += ' --related';
22
- if (argv.s) commandOptions += ' --silent';
23
- try {
24
- if (CI) {
25
- await exec('rimraf ./reports');
26
- }
27
-
28
- // eslint-disable-next-line jest/valid-title, jest/no-disabled-tests, jest/expect-expect
29
- await test(commandOptions);
30
- logSuccess('Unit test execution completed');
31
- } catch (err) {
32
- logError('Unit test execution failed', err);
33
- exit(-1, err);
34
- return -1;
35
- }
36
- return 0;
37
- }
38
-
39
- exports.command = 'vitest [options]';
40
-
41
- exports.describe = 'unit tests application code using vitest';
42
-
43
- exports.builder = {
44
- fix: {
45
- alias: 'f',
46
- type: 'boolean',
47
- },
48
- watch: {
49
- alias: 'w',
50
- type: 'boolean',
51
- },
52
- passWithNoTests: {
53
- alias: 'p',
54
- type: 'boolean',
55
- },
56
- related: {
57
- alias: 'r',
58
- type: 'boolean',
59
- },
60
- silent: {
61
- alias: 's',
62
- type: 'boolean',
63
- },
64
- };
65
-
66
- exports.handler = handler;
package/lib/cli.js DELETED
@@ -1,33 +0,0 @@
1
- #!/usr/bin/env node
2
- /* eslint-disable no-unused-expressions */
3
- const yargs = require('yargs');
4
- const path = require('path');
5
- const { config: envConfig } = require('dotenv');
6
- const notifyUpdates = require('./scripts/update-notifier');
7
- const buildCmd = require('./cli-commands/build');
8
- const packCmd = require('./cli-commands/pack');
9
- const startCmd = require('./cli-commands/start');
10
- const testCmd = require('./cli-commands/test');
11
- const lintCmd = require('./cli-commands/lint');
12
- const gendocCmd = require('./cli-commands/gendoc');
13
- const codemodCmd = require('./cli-commands/codemod');
14
- const storybookCmd = require('./cli-commands/storybook');
15
- const vitestCmd = require('./cli-commands/vitest');
16
- const versionCmd = require('./cli-commands/version');
17
-
18
- envConfig();
19
- process.env.PATH +=
20
- path.delimiter + path.join(__dirname, '..', 'node_modules', '.bin');
21
-
22
- yargs.command(buildCmd).help().argv;
23
- yargs.command(packCmd).help().argv;
24
- yargs.command(startCmd).help().argv;
25
- yargs.command(testCmd).help().argv;
26
- yargs.command(lintCmd).help().argv;
27
- yargs.command(gendocCmd).help().argv;
28
- yargs.command(codemodCmd).help().argv;
29
- yargs.command(storybookCmd).help().argv;
30
- yargs.command(vitestCmd).help().argv;
31
- yargs.command(versionCmd).help().argv;
32
-
33
- notifyUpdates();
@@ -1,17 +0,0 @@
1
- module.exports = {
2
- plugins: ['plugins/markdown'],
3
- opts: {
4
- template: 'node_modules/docdash',
5
- },
6
- docdash: {
7
- sort: true,
8
- search: true,
9
- collapse: true,
10
- wrap: true,
11
- },
12
- templates: {
13
- default: {
14
- includeDate: false,
15
- },
16
- },
17
- };
package/lib/index.js DELETED
@@ -1,25 +0,0 @@
1
- const babelConfig = require('./babel/babel.config');
2
- const { esConfig } = require('./lint/eslint/non-react');
3
- const { esReactConfig } = require('./lint/eslint/react');
4
- const stylelintConfig = require('./lint/stylelint.config');
5
- const prettierConfig = require('./lint/prettier.config');
6
- const commitlintConfig = require('./lint/commitlint.config');
7
- const { jestConfig } = require('./testing/jest.config');
8
- const { jestNodeConfig } = require('./testing/jest.node.config');
9
- const jsdocConfig = require('./docgen/jsdoc.config');
10
- const lintStagedConfig = require('./lint/lint-staged.config');
11
- const { loadRoutes } = require('./server/util');
12
-
13
- module.exports = {
14
- babelConfig,
15
- eslintConfig: esReactConfig,
16
- eslintBaseConfig: esConfig,
17
- stylelintConfig,
18
- prettierConfig,
19
- commitlintConfig,
20
- jestConfig,
21
- jestNodeConfig,
22
- jsdocConfig,
23
- lintStagedConfig,
24
- loadRoutes,
25
- };
@@ -1 +0,0 @@
1
- module.exports = { extends: ['@commitlint/config-conventional'] };
@@ -1,16 +0,0 @@
1
- const path = require('path');
2
-
3
- module.exports = {
4
- '*.{js,ts,jsx,tsx,md,mdx,html,css,json}': ['prettier --write'],
5
- '*.{ts,tsx}': [
6
- `node ${path.resolve(
7
- __dirname,
8
- '../typescript/tsc-files/index.js',
9
- )} --noEmit --emitDeclarationOnly false`,
10
- ],
11
- '*.{js,ts,jsx,tsx}': [
12
- 'npm run lint:fix',
13
- 'npm run test:staged',
14
- 'npm run gendoc',
15
- ],
16
- };
@@ -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
- };
@@ -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,3 +0,0 @@
1
- const fs = require('fs');
2
-
3
- module.exports = JSON.parse(fs.readFileSync('package.json', 'utf8'));
@@ -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,13 +0,0 @@
1
- const chalk = require('chalk');
2
-
3
- /**
4
- * Adds mark cross symbol
5
- *
6
- * @param callback
7
- */
8
- function addXMark(callback) {
9
- process.stdout.write(chalk.red(' ✘'));
10
- if (callback) callback();
11
- }
12
-
13
- module.exports = addXMark;
@@ -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
- });
@@ -1,7 +0,0 @@
1
- const updateNotifier = require('update-notifier');
2
- const path = require('path');
3
- const pkg = require(path.join(process.cwd(), './package.json'));
4
-
5
- module.exports = () => {
6
- updateNotifier({ pkg }).notify();
7
- };
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;
@@ -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
- });
@@ -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
- };