@servicetitan/startup 33.1.1 → 34.0.1

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 (449) hide show
  1. package/dist/cli/commands/build.d.ts +48 -22
  2. package/dist/cli/commands/build.d.ts.map +1 -1
  3. package/dist/cli/commands/build.js +72 -52
  4. package/dist/cli/commands/build.js.map +1 -1
  5. package/dist/cli/commands/bundle-package.d.ts +54 -10
  6. package/dist/cli/commands/bundle-package.d.ts.map +1 -1
  7. package/dist/cli/commands/bundle-package.js +40 -0
  8. package/dist/cli/commands/bundle-package.js.map +1 -1
  9. package/dist/cli/commands/clean.d.ts +4 -0
  10. package/dist/cli/commands/clean.d.ts.map +1 -1
  11. package/dist/cli/commands/clean.js +50 -16
  12. package/dist/cli/commands/clean.js.map +1 -1
  13. package/dist/cli/commands/convert-eslint-config.d.ts +1 -1
  14. package/dist/cli/commands/convert-eslint-config.d.ts.map +1 -1
  15. package/dist/cli/commands/convert-eslint-config.js +2 -15
  16. package/dist/cli/commands/convert-eslint-config.js.map +1 -1
  17. package/dist/cli/commands/eslint.d.ts +29 -7
  18. package/dist/cli/commands/eslint.d.ts.map +1 -1
  19. package/dist/cli/commands/eslint.js +18 -6
  20. package/dist/cli/commands/eslint.js.map +1 -1
  21. package/dist/cli/commands/get-command.d.ts.map +1 -1
  22. package/dist/cli/commands/get-command.js +6 -0
  23. package/dist/cli/commands/get-command.js.map +1 -1
  24. package/dist/cli/commands/index.d.ts +2 -2
  25. package/dist/cli/commands/index.d.ts.map +1 -1
  26. package/dist/cli/commands/index.js +2 -2
  27. package/dist/cli/commands/index.js.map +1 -1
  28. package/dist/cli/commands/init.d.ts +10 -6
  29. package/dist/cli/commands/init.d.ts.map +1 -1
  30. package/dist/cli/commands/init.js +8 -6
  31. package/dist/cli/commands/init.js.map +1 -1
  32. package/dist/cli/commands/install.d.ts +27 -15
  33. package/dist/cli/commands/install.d.ts.map +1 -1
  34. package/dist/cli/commands/install.js +18 -16
  35. package/dist/cli/commands/install.js.map +1 -1
  36. package/dist/cli/commands/kendo-ui-license.d.ts +1 -0
  37. package/dist/cli/commands/kendo-ui-license.d.ts.map +1 -1
  38. package/dist/cli/commands/kendo-ui-license.js +1 -0
  39. package/dist/cli/commands/kendo-ui-license.js.map +1 -1
  40. package/dist/cli/commands/lint.d.ts +51 -17
  41. package/dist/cli/commands/lint.d.ts.map +1 -1
  42. package/dist/cli/commands/lint.js +36 -26
  43. package/dist/cli/commands/lint.js.map +1 -1
  44. package/dist/cli/commands/mfe-check.d.ts +52 -0
  45. package/dist/cli/commands/mfe-check.d.ts.map +1 -0
  46. package/dist/cli/commands/mfe-check.js +145 -0
  47. package/dist/cli/commands/mfe-check.js.map +1 -0
  48. package/dist/cli/commands/mfe-generate-metadata.d.ts +20 -0
  49. package/dist/cli/commands/mfe-generate-metadata.d.ts.map +1 -0
  50. package/dist/cli/commands/mfe-generate-metadata.js +93 -0
  51. package/dist/cli/commands/mfe-generate-metadata.js.map +1 -0
  52. package/dist/cli/commands/mfe-list.d.ts +52 -15
  53. package/dist/cli/commands/mfe-list.d.ts.map +1 -1
  54. package/dist/cli/commands/mfe-list.js +42 -29
  55. package/dist/cli/commands/mfe-list.js.map +1 -1
  56. package/dist/cli/commands/mfe-package-clean.d.ts +34 -15
  57. package/dist/cli/commands/mfe-package-clean.d.ts.map +1 -1
  58. package/dist/cli/commands/mfe-package-clean.js +43 -34
  59. package/dist/cli/commands/mfe-package-clean.js.map +1 -1
  60. package/dist/cli/commands/mfe-package-publish.d.ts +60 -22
  61. package/dist/cli/commands/mfe-package-publish.d.ts.map +1 -1
  62. package/dist/cli/commands/mfe-package-publish.js +137 -78
  63. package/dist/cli/commands/mfe-package-publish.js.map +1 -1
  64. package/dist/cli/commands/mfe-package-rollback.d.ts +40 -0
  65. package/dist/cli/commands/mfe-package-rollback.d.ts.map +1 -0
  66. package/dist/cli/commands/mfe-package-rollback.js +119 -0
  67. package/dist/cli/commands/mfe-package-rollback.js.map +1 -0
  68. package/dist/cli/commands/mfe-publish.d.ts +36 -11
  69. package/dist/cli/commands/mfe-publish.d.ts.map +1 -1
  70. package/dist/cli/commands/mfe-publish.js +72 -22
  71. package/dist/cli/commands/mfe-publish.js.map +1 -1
  72. package/dist/cli/commands/prepare-package.d.ts +14 -5
  73. package/dist/cli/commands/prepare-package.d.ts.map +1 -1
  74. package/dist/cli/commands/prepare-package.js +20 -0
  75. package/dist/cli/commands/prepare-package.js.map +1 -1
  76. package/dist/cli/commands/review/review.d.ts +17 -8
  77. package/dist/cli/commands/review/review.d.ts.map +1 -1
  78. package/dist/cli/commands/review/review.js +16 -21
  79. package/dist/cli/commands/review/review.js.map +1 -1
  80. package/dist/cli/commands/review/rules/index.d.ts.map +1 -1
  81. package/dist/cli/commands/review/rules/index.js +3 -1
  82. package/dist/cli/commands/review/rules/index.js.map +1 -1
  83. package/dist/cli/commands/review/rules/no-deprecated-content-base.js.map +1 -1
  84. package/dist/cli/commands/review/rules/prefer-open-ended-peer-dependencies.js.map +1 -1
  85. package/dist/cli/commands/review/rules/require-compatible-launch-darkly-sdk.js +4 -4
  86. package/dist/cli/commands/review/rules/require-compatible-launch-darkly-sdk.js.map +1 -1
  87. package/dist/cli/commands/review/rules/require-one-collection-version.js +1 -2
  88. package/dist/cli/commands/review/rules/require-one-collection-version.js.map +1 -1
  89. package/dist/cli/commands/review/rules/require-one-uikit-version.d.ts.map +1 -1
  90. package/dist/cli/commands/review/rules/require-one-uikit-version.js +1 -0
  91. package/dist/cli/commands/review/rules/require-one-uikit-version.js.map +1 -1
  92. package/dist/cli/commands/review/rules/require-project-version-in-root-node-modules.d.ts.map +1 -1
  93. package/dist/cli/commands/review/rules/require-project-version-in-root-node-modules.js +8 -8
  94. package/dist/cli/commands/review/rules/require-project-version-in-root-node-modules.js.map +1 -1
  95. package/dist/cli/commands/review/rules/require-tsconfig-references.d.ts +26 -0
  96. package/dist/cli/commands/review/rules/require-tsconfig-references.d.ts.map +1 -0
  97. package/dist/cli/commands/review/rules/require-tsconfig-references.js +156 -0
  98. package/dist/cli/commands/review/rules/require-tsconfig-references.js.map +1 -0
  99. package/dist/cli/commands/review/utils/collate-dependencies.js +1 -3
  100. package/dist/cli/commands/review/utils/collate-dependencies.js.map +1 -1
  101. package/dist/cli/commands/review/utils/compare-version.js +2 -2
  102. package/dist/cli/commands/review/utils/compare-version.js.map +1 -1
  103. package/dist/cli/commands/review/utils/set-version.js +1 -1
  104. package/dist/cli/commands/review/utils/set-version.js.map +1 -1
  105. package/dist/cli/commands/run-task.d.ts +29 -7
  106. package/dist/cli/commands/run-task.d.ts.map +1 -1
  107. package/dist/cli/commands/run-task.js +21 -8
  108. package/dist/cli/commands/run-task.js.map +1 -1
  109. package/dist/cli/commands/run-task.test.js +14 -2
  110. package/dist/cli/commands/run-task.test.js.map +1 -1
  111. package/dist/cli/commands/start.d.ts +38 -18
  112. package/dist/cli/commands/start.d.ts.map +1 -1
  113. package/dist/cli/commands/start.js +65 -45
  114. package/dist/cli/commands/start.js.map +1 -1
  115. package/dist/cli/commands/stylelint.d.ts +29 -7
  116. package/dist/cli/commands/stylelint.d.ts.map +1 -1
  117. package/dist/cli/commands/stylelint.js +18 -6
  118. package/dist/cli/commands/stylelint.js.map +1 -1
  119. package/dist/cli/commands/test/runners/vitest.js +1 -1
  120. package/dist/cli/commands/test/runners/vitest.js.map +1 -1
  121. package/dist/cli/commands/test/tests.d.ts +25 -5
  122. package/dist/cli/commands/test/tests.d.ts.map +1 -1
  123. package/dist/cli/commands/test/tests.js +22 -14
  124. package/dist/cli/commands/test/tests.js.map +1 -1
  125. package/dist/cli/commands/types.d.ts +51 -10
  126. package/dist/cli/commands/types.d.ts.map +1 -1
  127. package/dist/cli/commands/types.js +1 -0
  128. package/dist/cli/commands/types.js.map +1 -1
  129. package/dist/cli/commands/upload-sourcemaps.d.ts +26 -6
  130. package/dist/cli/commands/upload-sourcemaps.d.ts.map +1 -1
  131. package/dist/cli/commands/upload-sourcemaps.js +27 -4
  132. package/dist/cli/commands/upload-sourcemaps.js.map +1 -1
  133. package/dist/cli/commands/utils.d.ts +4 -0
  134. package/dist/cli/commands/utils.d.ts.map +1 -0
  135. package/dist/cli/commands/utils.js +28 -0
  136. package/dist/cli/commands/utils.js.map +1 -0
  137. package/dist/cli/index.js +8 -5
  138. package/dist/cli/index.js.map +1 -1
  139. package/dist/cli/tasks/cli-task.d.ts.map +1 -1
  140. package/dist/cli/tasks/cli-task.js +1 -1
  141. package/dist/cli/tasks/cli-task.js.map +1 -1
  142. package/dist/cli/tasks/swc-compile-package.d.ts +1 -2
  143. package/dist/cli/tasks/swc-compile-package.d.ts.map +1 -1
  144. package/dist/cli/tasks/swc-compile-package.js.map +1 -1
  145. package/dist/cli/tasks/tsc-compile-package.d.ts +1 -2
  146. package/dist/cli/tasks/tsc-compile-package.d.ts.map +1 -1
  147. package/dist/cli/tasks/tsc-compile-package.js.map +1 -1
  148. package/dist/cli/tasks/tsc-compile.d.ts +1 -2
  149. package/dist/cli/tasks/tsc-compile.d.ts.map +1 -1
  150. package/dist/cli/tasks/tsc-compile.js.map +1 -1
  151. package/dist/cli/utils/bundle.d.ts.map +1 -1
  152. package/dist/cli/utils/bundle.js +2 -2
  153. package/dist/cli/utils/bundle.js.map +1 -1
  154. package/dist/cli/utils/check-startup-location.d.ts +4 -0
  155. package/dist/cli/utils/check-startup-location.d.ts.map +1 -0
  156. package/dist/cli/utils/check-startup-location.js +27 -0
  157. package/dist/cli/utils/check-startup-location.js.map +1 -0
  158. package/dist/cli/utils/cli-npm.d.ts +6 -0
  159. package/dist/cli/utils/cli-npm.d.ts.map +1 -1
  160. package/dist/cli/utils/cli-npm.js +25 -3
  161. package/dist/cli/utils/cli-npm.js.map +1 -1
  162. package/dist/cli/utils/compile-less.js +1 -1
  163. package/dist/cli/utils/compile-less.js.map +1 -1
  164. package/dist/cli/utils/constants.d.ts +2 -0
  165. package/dist/cli/utils/constants.d.ts.map +1 -0
  166. package/dist/cli/utils/constants.js +13 -0
  167. package/dist/cli/utils/constants.js.map +1 -0
  168. package/dist/cli/utils/copy-files.d.ts.map +1 -1
  169. package/dist/cli/utils/copy-files.js.map +1 -1
  170. package/dist/cli/utils/eslint.d.ts +1 -2
  171. package/dist/cli/utils/eslint.d.ts.map +1 -1
  172. package/dist/cli/utils/eslint.js.map +1 -1
  173. package/dist/cli/utils/index.d.ts +2 -0
  174. package/dist/cli/utils/index.d.ts.map +1 -1
  175. package/dist/cli/utils/index.js +2 -0
  176. package/dist/cli/utils/index.js.map +1 -1
  177. package/dist/cli/utils/is-module-installed.js +1 -1
  178. package/dist/cli/utils/is-module-installed.js.map +1 -1
  179. package/dist/cli/utils/lerna-exec.d.ts.map +1 -1
  180. package/dist/cli/utils/lerna-exec.js +1 -3
  181. package/dist/cli/utils/lerna-exec.js.map +1 -1
  182. package/dist/cli/utils/process-tree.js.map +1 -1
  183. package/dist/cli/utils/set-node-options.js +2 -4
  184. package/dist/cli/utils/set-node-options.js.map +1 -1
  185. package/dist/cli/utils/stylelint.d.ts +1 -2
  186. package/dist/cli/utils/stylelint.d.ts.map +1 -1
  187. package/dist/cli/utils/stylelint.js.map +1 -1
  188. package/dist/index.d.ts +1 -1
  189. package/dist/index.d.ts.map +1 -1
  190. package/dist/index.js +1 -1
  191. package/dist/index.js.map +1 -1
  192. package/dist/jest/resolver.js +2 -2
  193. package/dist/jest/resolver.js.map +1 -1
  194. package/dist/jest/svg-transformer.d.ts.map +1 -1
  195. package/dist/jest/svg-transformer.js.map +1 -1
  196. package/dist/utils/find-packages.js +1 -1
  197. package/dist/utils/find-packages.js.map +1 -1
  198. package/dist/utils/format-relative-date.js +1 -1
  199. package/dist/utils/format-relative-date.js.map +1 -1
  200. package/dist/utils/get-configuration.d.ts +3 -0
  201. package/dist/utils/get-configuration.d.ts.map +1 -1
  202. package/dist/utils/get-configuration.js +14 -11
  203. package/dist/utils/get-configuration.js.map +1 -1
  204. package/dist/utils/get-destination-folders.d.ts.map +1 -1
  205. package/dist/utils/get-destination-folders.js.map +1 -1
  206. package/dist/utils/get-folders.d.ts.map +1 -1
  207. package/dist/utils/get-folders.js.map +1 -1
  208. package/dist/utils/get-jest-config.js +1 -1
  209. package/dist/utils/get-jest-config.js.map +1 -1
  210. package/dist/utils/get-package-data.js +1 -1
  211. package/dist/utils/get-package-data.js.map +1 -1
  212. package/dist/utils/get-packages.js.map +1 -1
  213. package/dist/utils/index.d.ts +1 -0
  214. package/dist/utils/index.d.ts.map +1 -1
  215. package/dist/utils/index.js +1 -0
  216. package/dist/utils/index.js.map +1 -1
  217. package/dist/utils/load-shared-dependencies.js.map +1 -1
  218. package/dist/utils/prettify.d.ts +13 -0
  219. package/dist/utils/prettify.d.ts.map +1 -0
  220. package/dist/utils/prettify.js +48 -0
  221. package/dist/utils/prettify.js.map +1 -0
  222. package/dist/utils/read-json.js +1 -1
  223. package/dist/utils/read-json.js.map +1 -1
  224. package/dist/utils/transform-svg.js +2 -2
  225. package/dist/utils/transform-svg.js.map +1 -1
  226. package/dist/webpack/configs/cache-config.js +1 -1
  227. package/dist/webpack/configs/cache-config.js.map +1 -1
  228. package/dist/webpack/configs/optimization-config.js +3 -4
  229. package/dist/webpack/configs/optimization-config.js.map +1 -1
  230. package/dist/webpack/configs/output-config.js +1 -1
  231. package/dist/webpack/configs/output-config.js.map +1 -1
  232. package/dist/webpack/configs/plugins/assets-manifest-plugin.d.ts.map +1 -1
  233. package/dist/webpack/configs/plugins/assets-manifest-plugin.js +5 -5
  234. package/dist/webpack/configs/plugins/assets-manifest-plugin.js.map +1 -1
  235. package/dist/webpack/configs/plugins/bundle-analyser-plugin.d.ts.map +1 -1
  236. package/dist/webpack/configs/plugins/bundle-analyser-plugin.js +1 -1
  237. package/dist/webpack/configs/plugins/bundle-analyser-plugin.js.map +1 -1
  238. package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.d.ts.map +1 -1
  239. package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.js +6 -9
  240. package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.js.map +1 -1
  241. package/dist/webpack/configs/plugins/html-tags-plugin.js +1 -1
  242. package/dist/webpack/configs/plugins/html-tags-plugin.js.map +1 -1
  243. package/dist/webpack/configs/plugins/ignore-plugin/check-resource.js +1 -1
  244. package/dist/webpack/configs/plugins/ignore-plugin/check-resource.js.map +1 -1
  245. package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.d.ts.map +1 -1
  246. package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.js.map +1 -1
  247. package/dist/webpack/configs/plugins/moment-locales-plugin.js +1 -1
  248. package/dist/webpack/configs/plugins/moment-locales-plugin.js.map +1 -1
  249. package/dist/webpack/configs/plugins/watch-run-plugin.d.ts.map +1 -1
  250. package/dist/webpack/configs/plugins/watch-run-plugin.js.map +1 -1
  251. package/dist/webpack/configs/types.d.ts +1 -0
  252. package/dist/webpack/configs/types.d.ts.map +1 -1
  253. package/dist/webpack/configs/utils/build-metadata.d.ts +10 -0
  254. package/dist/webpack/configs/utils/build-metadata.d.ts.map +1 -0
  255. package/dist/webpack/configs/utils/build-metadata.js +50 -0
  256. package/dist/webpack/configs/utils/build-metadata.js.map +1 -0
  257. package/dist/webpack/configs/utils/generate-metadata.d.ts.map +1 -1
  258. package/dist/webpack/configs/utils/generate-metadata.js +5 -24
  259. package/dist/webpack/configs/utils/generate-metadata.js.map +1 -1
  260. package/dist/webpack/configs/utils/get-exposed-dependencies.d.ts +3 -0
  261. package/dist/webpack/configs/utils/get-exposed-dependencies.d.ts.map +1 -0
  262. package/dist/webpack/configs/utils/get-exposed-dependencies.js +21 -0
  263. package/dist/webpack/configs/utils/get-exposed-dependencies.js.map +1 -0
  264. package/dist/webpack/configs/utils/get-launchdarkly-sdk-version.js +1 -1
  265. package/dist/webpack/configs/utils/get-launchdarkly-sdk-version.js.map +1 -1
  266. package/dist/webpack/configs/utils/index.d.ts +1 -0
  267. package/dist/webpack/configs/utils/index.d.ts.map +1 -1
  268. package/dist/webpack/configs/utils/index.js +1 -0
  269. package/dist/webpack/configs/utils/index.js.map +1 -1
  270. package/dist/webpack/create-webpack-config.js +10 -4
  271. package/dist/webpack/create-webpack-config.js.map +1 -1
  272. package/dist/webpack/loaders/expose-loader/index.d.ts.map +1 -1
  273. package/dist/webpack/loaders/expose-loader/index.js.map +1 -1
  274. package/dist/webpack/loaders/expose-loader/runtime/get-global-this.js +1 -1
  275. package/dist/webpack/loaders/expose-loader/runtime/get-global-this.js.map +1 -1
  276. package/dist/webpack/loaders/expose-loader/utils/get-new-user-request.js +2 -2
  277. package/dist/webpack/loaders/expose-loader/utils/get-new-user-request.js.map +1 -1
  278. package/dist/webpack/utils/stringify-config.js +2 -2
  279. package/dist/webpack/utils/stringify-config.js.map +1 -1
  280. package/dist/webpack/utils/testing/get-compiler.d.ts.map +1 -1
  281. package/dist/webpack/utils/testing/get-compiler.js +1 -1
  282. package/dist/webpack/utils/testing/get-compiler.js.map +1 -1
  283. package/dist/webpack/utils/testing/get-errors.d.ts.map +1 -1
  284. package/dist/webpack/utils/testing/get-errors.js.map +1 -1
  285. package/dist/webpack/utils/testing/get-warnings.d.ts.map +1 -1
  286. package/dist/webpack/utils/testing/get-warnings.js.map +1 -1
  287. package/dist/webpack/utils/testing/read-asset.d.ts.map +1 -1
  288. package/dist/webpack/utils/testing/read-asset.js +1 -1
  289. package/dist/webpack/utils/testing/read-asset.js.map +1 -1
  290. package/dist/webpack/utils/testing/read-assets.d.ts.map +1 -1
  291. package/dist/webpack/utils/testing/read-assets.js.map +1 -1
  292. package/package.json +35 -41
  293. package/src/cli/commands/__tests__/build.test.ts +32 -9
  294. package/src/cli/commands/__tests__/bundle-package.test.ts +2 -1
  295. package/src/cli/commands/__tests__/clean.test.ts +99 -8
  296. package/src/cli/commands/__tests__/convert-eslint-config.test.ts +14 -9
  297. package/src/cli/commands/__tests__/eslint.test.ts +1 -1
  298. package/src/cli/commands/__tests__/get-command.test.ts +3 -1
  299. package/src/cli/commands/__tests__/init.test.ts +14 -1
  300. package/src/cli/commands/__tests__/install.test.ts +6 -2
  301. package/src/cli/commands/__tests__/kendo-ui-license.test.ts +7 -2
  302. package/src/cli/commands/__tests__/lint.test.ts +4 -2
  303. package/src/cli/commands/__tests__/mfe-check.test.ts +346 -0
  304. package/src/cli/commands/__tests__/mfe-generate-metadata.test.ts +160 -0
  305. package/src/cli/commands/__tests__/mfe-list.test.ts +8 -1
  306. package/src/cli/commands/__tests__/mfe-package-clean.test.ts +0 -1
  307. package/src/cli/commands/__tests__/mfe-package-publish.test.ts +322 -93
  308. package/src/cli/commands/__tests__/mfe-package-rollback.test.ts +196 -0
  309. package/src/cli/commands/__tests__/mfe-publish.test.ts +65 -5
  310. package/src/cli/commands/__tests__/prepare-package.test.ts +3 -0
  311. package/src/cli/commands/__tests__/start.test.ts +30 -7
  312. package/src/cli/commands/__tests__/stylelint.test.ts +1 -1
  313. package/src/cli/commands/__tests__/styles-check.test.ts +1 -2
  314. package/src/cli/commands/__tests__/upload-sourcemaps.test.ts +3 -6
  315. package/src/cli/commands/build.ts +35 -26
  316. package/src/cli/commands/bundle-package.ts +11 -10
  317. package/src/cli/commands/clean.ts +51 -5
  318. package/src/cli/commands/convert-eslint-config.ts +3 -12
  319. package/src/cli/commands/eslint.ts +9 -11
  320. package/src/cli/commands/get-command.ts +6 -1
  321. package/src/cli/commands/index.ts +2 -2
  322. package/src/cli/commands/init.ts +7 -9
  323. package/src/cli/commands/install.ts +11 -13
  324. package/src/cli/commands/kendo-ui-license.ts +1 -1
  325. package/src/cli/commands/lint.ts +12 -18
  326. package/src/cli/commands/mfe-check.ts +166 -0
  327. package/src/cli/commands/mfe-generate-metadata.ts +69 -0
  328. package/src/cli/commands/mfe-list.ts +28 -30
  329. package/src/cli/commands/mfe-package-clean.ts +29 -34
  330. package/src/cli/commands/mfe-package-publish.ts +153 -87
  331. package/src/cli/commands/mfe-package-rollback.ts +100 -0
  332. package/src/cli/commands/mfe-publish.ts +80 -27
  333. package/src/cli/commands/prepare-package.ts +6 -5
  334. package/src/cli/commands/review/__tests__/review.test.ts +18 -19
  335. package/src/cli/commands/review/review.ts +11 -20
  336. package/src/cli/commands/review/rules/__tests__/no-deprecated-content-base.test.ts +1 -1
  337. package/src/cli/commands/review/rules/__tests__/no-deprecated-startup-install.test.ts +0 -1
  338. package/src/cli/commands/review/rules/__tests__/no-direct-peer-dependencies.test.ts +1 -1
  339. package/src/cli/commands/review/rules/__tests__/no-typescript-entry-point.test.ts +0 -1
  340. package/src/cli/commands/review/rules/__tests__/require-all-react-dependencies.test.ts +0 -1
  341. package/src/cli/commands/review/rules/__tests__/require-compatible-launch-darkly-sdk.test.ts +2 -2
  342. package/src/cli/commands/review/rules/__tests__/require-explicit-side-effects.test.ts +0 -1
  343. package/src/cli/commands/review/rules/__tests__/require-npmrc.test.ts +0 -1
  344. package/src/cli/commands/review/rules/__tests__/require-one-anvil-uikit-contrib-version.test.ts +1 -2
  345. package/src/cli/commands/review/rules/__tests__/require-one-collection-version.test.ts +0 -1
  346. package/src/cli/commands/review/rules/__tests__/require-one-package-version.test.ts +0 -1
  347. package/src/cli/commands/review/rules/__tests__/require-one-react-version.test.ts +0 -1
  348. package/src/cli/commands/review/rules/__tests__/require-one-uikit-version.test.ts +1 -1
  349. package/src/cli/commands/review/rules/__tests__/require-project-version-in-root-node-modules.test.ts +2 -3
  350. package/src/cli/commands/review/rules/__tests__/require-servicetitan-scope.test.ts +0 -1
  351. package/src/cli/commands/review/rules/__tests__/require-tsconfig-references.test.ts +193 -0
  352. package/src/cli/commands/review/rules/index.ts +2 -0
  353. package/src/cli/commands/review/rules/require-compatible-launch-darkly-sdk.ts +1 -1
  354. package/src/cli/commands/review/rules/require-one-uikit-version.ts +1 -0
  355. package/src/cli/commands/review/rules/require-project-version-in-root-node-modules.ts +3 -3
  356. package/src/cli/commands/review/rules/require-tsconfig-references.ts +173 -0
  357. package/src/cli/commands/review/utils/__tests__/set-version.test.ts +0 -1
  358. package/src/cli/commands/run-task.test.ts +15 -3
  359. package/src/cli/commands/run-task.ts +12 -14
  360. package/src/cli/commands/start.ts +75 -59
  361. package/src/cli/commands/stylelint.ts +9 -11
  362. package/src/cli/commands/test/runners/__tests__/jest.test.ts +1 -2
  363. package/src/cli/commands/test/runners/vitest.ts +1 -1
  364. package/src/cli/commands/test/tests.ts +13 -15
  365. package/src/cli/commands/types.ts +53 -7
  366. package/src/cli/commands/upload-sourcemaps.ts +14 -12
  367. package/src/cli/commands/utils.ts +6 -0
  368. package/src/cli/index.ts +11 -7
  369. package/src/cli/tasks/__tests__/cli-task.test.ts +1 -1
  370. package/src/cli/tasks/__tests__/swc-compile-package.test.ts +3 -1
  371. package/src/cli/tasks/__tests__/tsc-compile-package.test.ts +2 -0
  372. package/src/cli/tasks/__tests__/tsc-compile.test.ts +3 -13
  373. package/src/cli/tasks/cli-task.ts +1 -1
  374. package/src/cli/tasks/swc-compile-package.ts +1 -3
  375. package/src/cli/tasks/tsc-compile-package.ts +1 -2
  376. package/src/cli/tasks/tsc-compile.ts +1 -2
  377. package/src/cli/utils/__tests__/bundle.test.ts +1 -2
  378. package/src/cli/utils/__tests__/check-args.test.ts +1 -1
  379. package/src/cli/utils/__tests__/check-startup-location.test.ts +88 -0
  380. package/src/cli/utils/__tests__/cli-git.test.ts +1 -2
  381. package/src/cli/utils/__tests__/cli-npm.test.ts +51 -2
  382. package/src/cli/utils/__tests__/cli-os.test.ts +1 -2
  383. package/src/cli/utils/__tests__/compile.test.ts +1 -1
  384. package/src/cli/utils/__tests__/copy-files.test.ts +0 -1
  385. package/src/cli/utils/__tests__/eslint.test.ts +1 -1
  386. package/src/cli/utils/__tests__/lerna-exec.test.ts +1 -2
  387. package/src/cli/utils/__tests__/maybe-create-git-folder.test.ts +0 -1
  388. package/src/cli/utils/__tests__/set-node-options.test.ts +0 -1
  389. package/src/cli/utils/__tests__/stylelint.test.ts +1 -1
  390. package/src/cli/utils/bundle.ts +1 -3
  391. package/src/cli/utils/check-startup-location.ts +21 -0
  392. package/src/cli/utils/cli-npm.ts +22 -0
  393. package/src/cli/utils/compile-less.ts +1 -1
  394. package/src/cli/utils/constants.ts +1 -0
  395. package/src/cli/utils/copy-files.ts +0 -1
  396. package/src/cli/utils/eslint.ts +1 -3
  397. package/src/cli/utils/index.ts +2 -0
  398. package/src/cli/utils/lerna-exec.ts +0 -1
  399. package/src/cli/utils/stylelint.ts +1 -2
  400. package/src/index.ts +1 -1
  401. package/src/jest/svg-transformer.ts +0 -1
  402. package/src/utils/__tests__/get-branch-configs.test.ts +0 -1
  403. package/src/utils/__tests__/get-configuration.test.ts +0 -1
  404. package/src/utils/__tests__/get-destination-folders.test.ts +1 -2
  405. package/src/utils/__tests__/get-folders.test.ts +0 -1
  406. package/src/utils/__tests__/get-jest-config.test.ts +1 -2
  407. package/src/utils/__tests__/get-package-data.test.ts +1 -2
  408. package/src/utils/__tests__/get-packages.test.ts +1 -1
  409. package/src/utils/__tests__/get-startup-version.test.ts +0 -1
  410. package/src/utils/__tests__/get-tsconfig.test.ts +0 -1
  411. package/src/utils/__tests__/load-shared-dependencies.test.ts +1 -1
  412. package/src/utils/__tests__/log.test.ts +1 -1
  413. package/src/utils/__tests__/prettify.test.ts +80 -0
  414. package/src/utils/__tests__/read-json.test.ts +0 -1
  415. package/src/utils/find-packages.ts +1 -1
  416. package/src/utils/get-configuration.ts +8 -7
  417. package/src/utils/get-destination-folders.ts +0 -1
  418. package/src/utils/get-folders.ts +0 -1
  419. package/src/utils/get-jest-config.ts +1 -1
  420. package/src/utils/index.ts +1 -0
  421. package/src/utils/prettify.ts +36 -0
  422. package/src/webpack/__tests__/create-webpack-config-shared-dependencies.test.ts +6 -2
  423. package/src/webpack/__tests__/create-webpack-config-web-component.test.ts +7 -4
  424. package/src/webpack/__tests__/create-webpack-config.test.ts +8 -4
  425. package/src/webpack/configs/cache-config.ts +1 -1
  426. package/src/webpack/configs/plugins/assets-manifest-plugin.ts +1 -1
  427. package/src/webpack/configs/plugins/bundle-analyser-plugin.ts +2 -2
  428. package/src/webpack/configs/plugins/define-exposed-dependencies-plugin.ts +6 -15
  429. package/src/webpack/configs/plugins/ignore-plugin/__tests__/get-package-json.test.ts +1 -1
  430. package/src/webpack/configs/plugins/ignore-plugin/__tests__/is-optional-peer-dependency.test.ts +1 -1
  431. package/src/webpack/configs/plugins/ignore-plugin/ignore-plugin.ts +0 -1
  432. package/src/webpack/configs/plugins/watch-run-plugin.ts +0 -1
  433. package/src/webpack/configs/types.ts +1 -0
  434. package/src/webpack/configs/utils/__tests__/build-metadata.test.ts +71 -0
  435. package/src/webpack/configs/utils/__tests__/generate-metadata.test.ts +42 -46
  436. package/src/webpack/configs/utils/__tests__/get-exposed-dependencies.test.ts +39 -0
  437. package/src/webpack/configs/utils/__tests__/get-web-components-version.test.ts +0 -1
  438. package/src/webpack/configs/utils/build-metadata.ts +40 -0
  439. package/src/webpack/configs/utils/generate-metadata.ts +7 -21
  440. package/src/webpack/configs/utils/get-exposed-dependencies.ts +17 -0
  441. package/src/webpack/configs/utils/index.ts +1 -0
  442. package/src/webpack/create-webpack-config.ts +3 -3
  443. package/src/webpack/loaders/expose-loader/__tests__/index.test.ts +0 -2
  444. package/src/webpack/loaders/expose-loader/index.ts +0 -1
  445. package/src/webpack/utils/testing/get-compiler.ts +1 -3
  446. package/src/webpack/utils/testing/get-errors.ts +0 -1
  447. package/src/webpack/utils/testing/get-warnings.ts +0 -1
  448. package/src/webpack/utils/testing/read-asset.ts +1 -2
  449. package/src/webpack/utils/testing/read-assets.ts +0 -1
@@ -0,0 +1,346 @@
1
+ import { fs, vol } from 'memfs';
2
+ import path from 'node:path';
3
+ import * as utils from '../../../utils';
4
+ import { MfeCheck } from '../mfe-check';
5
+
6
+ jest.mock('fs', () => fs);
7
+ jest.mock('../../../utils', () => ({
8
+ ...jest.requireActual('../../../utils'),
9
+ log: { info: jest.fn(), error: jest.fn(), warning: jest.fn() },
10
+ }));
11
+
12
+ describe(`[startup] ${MfeCheck.name}`, () => {
13
+ let stdoutWriteSpy: jest.SpyInstance;
14
+ let processExitCodeSpy: jest.SpyInstance;
15
+ let mfeCheckArgs:
16
+ | {
17
+ metadata?: string;
18
+ hostPackageJson?: string[];
19
+ json?: boolean;
20
+ }
21
+ | undefined;
22
+
23
+ const defaultMfeCheckArgs = {
24
+ metadata: '/path/to/metadata.json',
25
+ hostPackageJson: ['/path/to/host/package.json'],
26
+ json: false,
27
+ };
28
+
29
+ const mockMetadata = {
30
+ name: 'test-mfe',
31
+ version: '1.0.0',
32
+ bundledWith: { '@servicetitan/startup': '33.0.0' },
33
+ sharedDependencies: {
34
+ react: 'SharedDependencies.React',
35
+ mobx: 'SharedDependencies.MobX',
36
+ },
37
+ dependencies: { react: '^18.0.0', mobx: '^6.0.0' },
38
+ entrypoints: {},
39
+ };
40
+
41
+ const mockHostPackageJson = {
42
+ name: 'host-app',
43
+ cli: {
44
+ webpack: {
45
+ 'expose-shared-dependencies': true,
46
+ },
47
+ },
48
+ };
49
+
50
+ beforeEach(() => {
51
+ jest.clearAllMocks();
52
+
53
+ mfeCheckArgs = undefined;
54
+ stdoutWriteSpy = jest.spyOn(process.stdout, 'write').mockImplementation(() => true);
55
+ processExitCodeSpy = jest.spyOn(process, 'exitCode', 'set').mockImplementation(() => {});
56
+
57
+ vol.fromJSON({
58
+ '/path/to/metadata.json': JSON.stringify(mockMetadata),
59
+ '/path/to/host/package.json': JSON.stringify(mockHostPackageJson),
60
+ });
61
+ });
62
+
63
+ afterEach(() => {
64
+ vol.reset();
65
+ stdoutWriteSpy.mockRestore();
66
+ processExitCodeSpy.mockRestore();
67
+ });
68
+
69
+ const subject = () => new MfeCheck({ ...defaultMfeCheckArgs, ...mfeCheckArgs }).execute();
70
+
71
+ function itSetsErrorExitCode() {
72
+ test('sets exit code to 1', async () => {
73
+ await subject();
74
+
75
+ expect(processExitCodeSpy).toHaveBeenCalledWith(1);
76
+ });
77
+ }
78
+
79
+ test('allows running from global location', () => {
80
+ expect(MfeCheck.allowRunFromGlobal).toBe(true);
81
+ });
82
+
83
+ describe('when compatible', () => {
84
+ beforeEach(() => {
85
+ vol.fromJSON({
86
+ '/path/to/host/package.json': JSON.stringify({
87
+ ...mockHostPackageJson,
88
+ dependencies: mockMetadata.dependencies,
89
+ }),
90
+ });
91
+ });
92
+
93
+ test('outputs human-readable compatible message', async () => {
94
+ await subject();
95
+
96
+ expect(utils.log.info).toHaveBeenCalledWith('Compatible: light bundle can be used');
97
+ });
98
+
99
+ test('does not set exit code', async () => {
100
+ await subject();
101
+
102
+ expect(processExitCodeSpy).not.toHaveBeenCalled();
103
+ });
104
+
105
+ describe('with --json option', () => {
106
+ beforeEach(() => {
107
+ mfeCheckArgs = {
108
+ json: true,
109
+ };
110
+ });
111
+
112
+ test('outputs JSON', async () => {
113
+ await subject();
114
+
115
+ const output = stdoutWriteSpy.mock.calls[0][0];
116
+ const result = JSON.parse(output);
117
+
118
+ expect(result).toEqual({
119
+ name: 'test-mfe',
120
+ compatible: true,
121
+ bundleType: 'light',
122
+ isSharedDependenciesEnabled: true,
123
+ isHostMfe: false,
124
+ });
125
+ });
126
+ });
127
+ });
128
+
129
+ describe('when incompatible', () => {
130
+ beforeEach(() => {
131
+ vol.fromJSON({
132
+ '/path/to/host/package.json': JSON.stringify({
133
+ ...mockHostPackageJson,
134
+ dependencies: { react: '19.0.0' },
135
+ }),
136
+ });
137
+ });
138
+
139
+ test('outputs dependency mismatch found error', async () => {
140
+ await subject();
141
+
142
+ expect(utils.log.error).toHaveBeenCalledWith('Dependency mismatch found:');
143
+ });
144
+
145
+ test('outputs individual dependency mismatch error', async () => {
146
+ await subject();
147
+
148
+ expect(utils.log.error).toHaveBeenCalledWith(' react: host=19.0.0, package=^18.0.0');
149
+ });
150
+
151
+ test('outputs full bundle required error', async () => {
152
+ await subject();
153
+
154
+ expect(utils.log.error).toHaveBeenCalledWith('Result: full bundle required');
155
+ });
156
+
157
+ itSetsErrorExitCode();
158
+
159
+ describe('with --json option', () => {
160
+ beforeEach(() => {
161
+ mfeCheckArgs = {
162
+ json: true,
163
+ };
164
+ });
165
+
166
+ test('outputs JSON', async () => {
167
+ await subject();
168
+
169
+ const output = stdoutWriteSpy.mock.calls[0][0];
170
+ const result = JSON.parse(output);
171
+
172
+ expect(result).toEqual({
173
+ name: 'test-mfe',
174
+ compatible: false,
175
+ bundleType: 'full',
176
+ isSharedDependenciesEnabled: true,
177
+ isHostMfe: false,
178
+ mismatches: {
179
+ react: { host: '19.0.0', package: '^18.0.0' },
180
+ mobx: { host: 'missing', package: '^6.0.0' },
181
+ },
182
+ });
183
+ });
184
+ });
185
+ });
186
+
187
+ describe('when metadata file does not exist', () => {
188
+ const missingMetadataPath = '/path/to/missing.json';
189
+
190
+ beforeEach(() => {
191
+ mfeCheckArgs = {
192
+ metadata: missingMetadataPath,
193
+ };
194
+ });
195
+
196
+ test('throws error', async () => {
197
+ await expect(subject()).rejects.toThrow(
198
+ `ENOENT: no such file or directory, open '${path.resolve(missingMetadataPath)}`
199
+ );
200
+ });
201
+ });
202
+
203
+ describe('when multiple host package.json files are provided', () => {
204
+ const mockHostPackage1 = {
205
+ name: 'host-app-1',
206
+ dependencies: { react: '17.0.0' },
207
+ cli: {
208
+ webpack: {
209
+ 'expose-shared-dependencies': true,
210
+ },
211
+ },
212
+ };
213
+
214
+ const mockHostPackage2 = {
215
+ name: 'host-app-2',
216
+ dependencies: { react: '18.2.0' },
217
+ };
218
+
219
+ beforeEach(() => {
220
+ mfeCheckArgs = {
221
+ hostPackageJson: ['/path/to/package1.json', '/path/to/package2.json'],
222
+ };
223
+
224
+ vol.fromJSON({
225
+ '/path/to/package1.json': JSON.stringify(mockHostPackage1),
226
+ '/path/to/package2.json': JSON.stringify(mockHostPackage2),
227
+ });
228
+ });
229
+
230
+ test('first host package.json dependencies prevail', async () => {
231
+ await subject();
232
+
233
+ expect(utils.log.error).toHaveBeenCalledWith(' react: host=17.0.0, package=^18.0.0');
234
+ });
235
+ });
236
+
237
+ describe('when expose-shared-dependencies is not enabled', () => {
238
+ beforeEach(() => {
239
+ vol.fromJSON({
240
+ '/path/to/host/package.json': JSON.stringify({
241
+ ...mockHostPackageJson,
242
+ cli: { webpack: {} },
243
+ }),
244
+ });
245
+ });
246
+
247
+ test('logs expose-shared-dependencies is not enabled error', async () => {
248
+ await subject();
249
+
250
+ expect(utils.log.error).toHaveBeenCalledWith(
251
+ 'expose-shared-dependencies is not enabled in host package.json'
252
+ );
253
+ });
254
+
255
+ test('logs full bundle required', async () => {
256
+ await subject();
257
+
258
+ expect(utils.log.error).toHaveBeenCalledWith('Result: full bundle required');
259
+ });
260
+
261
+ itSetsErrorExitCode();
262
+
263
+ describe('with --json option', () => {
264
+ beforeEach(() => {
265
+ mfeCheckArgs = {
266
+ json: true,
267
+ };
268
+ });
269
+
270
+ test('outputs JSON', async () => {
271
+ await subject();
272
+
273
+ const output = stdoutWriteSpy.mock.calls[0][0];
274
+ const result = JSON.parse(output);
275
+
276
+ expect(result).toEqual(
277
+ expect.objectContaining({
278
+ name: 'test-mfe',
279
+ compatible: false,
280
+ bundleType: 'full',
281
+ isSharedDependenciesEnabled: false,
282
+ isHostMfe: false,
283
+ })
284
+ );
285
+ });
286
+ });
287
+ });
288
+
289
+ describe('when host package.json has no dependencies', () => {
290
+ beforeEach(() => {
291
+ vol.fromJSON({
292
+ '/path/to/host/package.json': JSON.stringify({
293
+ name: 'host-app',
294
+ cli: {
295
+ webpack: {
296
+ 'expose-shared-dependencies': true,
297
+ },
298
+ },
299
+ }),
300
+ });
301
+ });
302
+
303
+ test('outputs individual dependency mismatch error', async () => {
304
+ await subject();
305
+
306
+ expect(utils.log.error).toHaveBeenCalledWith(' react: host=missing, package=^18.0.0');
307
+ });
308
+ });
309
+
310
+ describe('when host is an MFE', () => {
311
+ beforeEach(() => {
312
+ vol.fromJSON({
313
+ '/path/to/host/package.json': JSON.stringify({
314
+ cli: { 'web-component': true },
315
+ }),
316
+ });
317
+ });
318
+
319
+ test('logs an error', async () => {
320
+ await subject();
321
+
322
+ expect(utils.log.error).toHaveBeenCalledWith(
323
+ 'Skipping compatibility check because host is an MFE'
324
+ );
325
+ });
326
+
327
+ describe('with --json option', () => {
328
+ beforeEach(() => {
329
+ mfeCheckArgs = {
330
+ json: true,
331
+ };
332
+ });
333
+
334
+ test('outputs JSON', async () => {
335
+ await subject();
336
+
337
+ const output = stdoutWriteSpy.mock.calls[0][0];
338
+ const result = JSON.parse(output);
339
+
340
+ expect(result).toEqual(
341
+ expect.objectContaining({ compatible: false, isHostMfe: true })
342
+ );
343
+ });
344
+ });
345
+ });
346
+ });
@@ -0,0 +1,160 @@
1
+ import { fs, vol } from 'memfs';
2
+ import path from 'node:path';
3
+ import { getPackageData, getStartupVersion, loadSharedDependencies, log } from '../../../utils';
4
+ import { getLaunchDarklySdkVersion } from '../../../webpack/configs/utils/get-launchdarkly-sdk-version';
5
+ import { getWebComponentsVersion } from '../../../webpack/configs/utils/get-web-components-version';
6
+ import { MfeGenerateMetadata } from '../mfe-generate-metadata';
7
+
8
+ jest.mock('fs', () => fs);
9
+ jest.mock('../../../utils', () => ({
10
+ ...jest.requireActual('../../../utils'),
11
+ log: { info: jest.fn() },
12
+ }));
13
+ jest.mock('../../../webpack/configs/utils/get-web-components-version', () => ({
14
+ getWebComponentsVersion: jest.fn(() => '1.0.0'),
15
+ }));
16
+ jest.mock('../../../utils/get-startup-version', () => ({
17
+ getStartupVersion: jest.fn(() => '33.0.0'),
18
+ }));
19
+ jest.mock('../../../webpack/configs/utils/get-launchdarkly-sdk-version', () => ({
20
+ getLaunchDarklySdkVersion: jest.fn(() => '3.4.5'),
21
+ }));
22
+
23
+ describe(`[startup] ${MfeGenerateMetadata.name}`, () => {
24
+ let stdoutWriteSpy: jest.SpyInstance;
25
+ let mfeGenerateMetadataArgs: { output?: string } | undefined;
26
+
27
+ const mockPackageJson = {
28
+ name: 'test-mfe',
29
+ version: '1.0.0',
30
+ dependencies: { react: '^18.0.0', mobx: '^6.0.0' },
31
+ cli: {
32
+ 'web-component': true,
33
+ },
34
+ };
35
+
36
+ const mockParentPackageJson = {
37
+ name: 'parent-package',
38
+ dependencies: { 'some-dep': '^1.0.0' },
39
+ };
40
+
41
+ const mockTsConfig = {
42
+ compilerOptions: {
43
+ rootDir: 'src',
44
+ outDir: 'dist',
45
+ },
46
+ };
47
+
48
+ function getMetadataFromStdout() {
49
+ const output = stdoutWriteSpy.mock.calls[0][0];
50
+ return JSON.parse(output);
51
+ }
52
+
53
+ function getMetadataFromFile(path: string) {
54
+ const content = vol.readFileSync(path, 'utf8') as string;
55
+ return JSON.parse(content);
56
+ }
57
+
58
+ beforeEach(() => {
59
+ jest.clearAllMocks();
60
+
61
+ mfeGenerateMetadataArgs = undefined;
62
+ stdoutWriteSpy = jest.spyOn(process.stdout, 'write').mockImplementation(() => true);
63
+
64
+ vol.fromJSON({
65
+ './package.json': JSON.stringify(mockPackageJson),
66
+ '../../package.json': JSON.stringify(mockParentPackageJson),
67
+ './tsconfig.json': JSON.stringify(mockTsConfig),
68
+ });
69
+ });
70
+
71
+ afterEach(() => {
72
+ vol.reset();
73
+ stdoutWriteSpy.mockRestore();
74
+ });
75
+
76
+ const subject = () => new MfeGenerateMetadata({ ...mfeGenerateMetadataArgs }).execute();
77
+
78
+ test('allows running from global location', () => {
79
+ expect(MfeGenerateMetadata.allowRunFromGlobal).toBe(true);
80
+ });
81
+
82
+ test('outputs valid JSON metadata', async () => {
83
+ await subject();
84
+
85
+ const packageData = getPackageData();
86
+
87
+ expect(getMetadataFromStdout()).toEqual({
88
+ ...packageData,
89
+ bundledWith: {
90
+ '@servicetitan/startup': getStartupVersion(),
91
+ '@servicetitan/web-components': getWebComponentsVersion(),
92
+ 'launchdarkly-js-client-sdk': getLaunchDarklySdkVersion(),
93
+ },
94
+ sharedDependencies: loadSharedDependencies(
95
+ packageData.dependencies,
96
+ packageData.sharedDependencies
97
+ ),
98
+ entrypoints: {},
99
+ });
100
+ });
101
+
102
+ describe('when package is not a web component', () => {
103
+ beforeEach(() => {
104
+ vol.fromJSON({
105
+ './package.json': JSON.stringify({
106
+ ...mockPackageJson,
107
+ cli: {},
108
+ }),
109
+ });
110
+ });
111
+
112
+ test('throws error', async () => {
113
+ await expect(subject()).rejects.toThrow(
114
+ 'this command must be run inside a web-component directory'
115
+ );
116
+ });
117
+ });
118
+
119
+ describe('with --output option', () => {
120
+ const outputDir = '/tmp/existing-dir';
121
+ const outputPath = `${outputDir}/metadata.json`;
122
+
123
+ beforeEach(() => {
124
+ vol.mkdirSync(outputDir, { recursive: true });
125
+ mfeGenerateMetadataArgs = {
126
+ output: outputPath,
127
+ };
128
+ });
129
+
130
+ test('writes metadata to file', async () => {
131
+ await subject();
132
+
133
+ expect(getMetadataFromFile(outputPath).name).toBe('test-mfe');
134
+ });
135
+
136
+ test('logs message', async () => {
137
+ await subject();
138
+
139
+ expect(log.info).toHaveBeenCalledWith(
140
+ `Metadata written to ${path.resolve(outputPath)}`
141
+ );
142
+ });
143
+
144
+ describe('when output directory does not exist', () => {
145
+ beforeEach(() => fs.rmSync(outputDir, { recursive: true, force: true }));
146
+
147
+ test('creates directory', async () => {
148
+ await subject();
149
+
150
+ expect(vol.existsSync(outputDir)).toBe(true);
151
+ });
152
+
153
+ test('creates file', async () => {
154
+ await subject();
155
+
156
+ expect(vol.existsSync(outputPath)).toBe(true);
157
+ });
158
+ });
159
+ });
160
+ });
@@ -13,6 +13,9 @@ jest.mock('fs', () => require('memfs').fs);
13
13
  jest.mock('readline/promises', () => ({
14
14
  createInterface: jest.fn(),
15
15
  }));
16
+ jest.mock('yargs', () => jest.fn());
17
+ jest.mock('yargs/helpers', () => ({ hideBin: jest.fn() }));
18
+
16
19
  jest.mock('../../utils', () => ({
17
20
  ...jest.requireActual('../../utils'),
18
21
  isTTY: jest.fn(),
@@ -150,6 +153,10 @@ describe(`[startup] ${MFEList.name}`, () => {
150
153
  });
151
154
  }
152
155
 
156
+ test('allows running from global location', () => {
157
+ expect(MFEList.allowRunFromGlobal).toBe(true);
158
+ });
159
+
153
160
  test(`outputs table with last ${DEFAULT_LIMIT} published versions`, async () => {
154
161
  await subject();
155
162
 
@@ -307,7 +314,7 @@ describe(`[startup] ${MFEList.name}`, () => {
307
314
  });
308
315
 
309
316
  describe('with --ignore', () => {
310
- beforeEach(() => (args.ignore = mfeName));
317
+ beforeEach(() => (args.ignore = [mfeName]));
311
318
 
312
319
  test('omits specified MFE', async () => {
313
320
  await subject();
@@ -1,7 +1,6 @@
1
1
  import { fs, vol } from 'memfs';
2
2
  import { isWebComponent, log } from '../../../utils';
3
3
  import { gitGetBranch, npmGetPackageVersionsDetails, npmUnpublish, Version } from '../../utils';
4
-
5
4
  import { MFEPackageClean } from '../mfe-package-clean';
6
5
 
7
6
  jest.mock('fs', () => fs);