@servicetitan/startup 38.0.0 → 38.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 (429) hide show
  1. package/bin/js-yaml.js +2 -2
  2. package/dist/cli/commands/build.d.ts.map +1 -1
  3. package/dist/cli/commands/build.js +32 -10
  4. package/dist/cli/commands/build.js.map +1 -1
  5. package/dist/cli/commands/bundle-package.d.ts +6 -0
  6. package/dist/cli/commands/bundle-package.d.ts.map +1 -0
  7. package/dist/cli/commands/bundle-package.js +59 -0
  8. package/dist/cli/commands/bundle-package.js.map +1 -0
  9. package/dist/cli/commands/bundle-vite.js +13 -4
  10. package/dist/cli/commands/bundle-vite.js.map +1 -1
  11. package/dist/cli/commands/bundle-webpack.js +13 -4
  12. package/dist/cli/commands/bundle-webpack.js.map +1 -1
  13. package/dist/cli/commands/clean.js +13 -4
  14. package/dist/cli/commands/clean.js.map +1 -1
  15. package/dist/cli/commands/command.d.ts +13 -0
  16. package/dist/cli/commands/command.d.ts.map +1 -0
  17. package/dist/cli/commands/command.js +74 -0
  18. package/dist/cli/commands/command.js.map +1 -0
  19. package/dist/cli/commands/convert-eslint-config.js +14 -7
  20. package/dist/cli/commands/convert-eslint-config.js.map +1 -1
  21. package/dist/cli/commands/eslint.js +13 -4
  22. package/dist/cli/commands/eslint.js.map +1 -1
  23. package/dist/cli/commands/init.d.ts.map +1 -1
  24. package/dist/cli/commands/init.js +13 -5
  25. package/dist/cli/commands/init.js.map +1 -1
  26. package/dist/cli/commands/install.d.ts.map +1 -1
  27. package/dist/cli/commands/install.js +14 -21
  28. package/dist/cli/commands/install.js.map +1 -1
  29. package/dist/cli/commands/kendo-ui-license.js +13 -4
  30. package/dist/cli/commands/kendo-ui-license.js.map +1 -1
  31. package/dist/cli/commands/lint.js +13 -4
  32. package/dist/cli/commands/lint.js.map +1 -1
  33. package/dist/cli/commands/mfe-check.d.ts.map +1 -1
  34. package/dist/cli/commands/mfe-check.js +15 -7
  35. package/dist/cli/commands/mfe-check.js.map +1 -1
  36. package/dist/cli/commands/mfe-generate-metadata.js +13 -4
  37. package/dist/cli/commands/mfe-generate-metadata.js.map +1 -1
  38. package/dist/cli/commands/mfe-list.js +13 -4
  39. package/dist/cli/commands/mfe-list.js.map +1 -1
  40. package/dist/cli/commands/mfe-package-clean.js +13 -4
  41. package/dist/cli/commands/mfe-package-clean.js.map +1 -1
  42. package/dist/cli/commands/mfe-package-publish.js +13 -4
  43. package/dist/cli/commands/mfe-package-publish.js.map +1 -1
  44. package/dist/cli/commands/mfe-package-rollback.js +13 -4
  45. package/dist/cli/commands/mfe-package-rollback.js.map +1 -1
  46. package/dist/cli/commands/mfe-publish.js +13 -4
  47. package/dist/cli/commands/mfe-publish.js.map +1 -1
  48. package/dist/cli/commands/mfe-purge-cache.js +13 -4
  49. package/dist/cli/commands/mfe-purge-cache.js.map +1 -1
  50. package/dist/cli/commands/prepare-package.js +13 -4
  51. package/dist/cli/commands/prepare-package.js.map +1 -1
  52. package/dist/cli/commands/registry/build.d.ts +1 -1
  53. package/dist/cli/commands/registry/build.d.ts.map +1 -1
  54. package/dist/cli/commands/registry/build.js +3 -5
  55. package/dist/cli/commands/registry/build.js.map +1 -1
  56. package/dist/cli/commands/registry/bundle-package.d.ts +41 -0
  57. package/dist/cli/commands/registry/bundle-package.d.ts.map +1 -0
  58. package/dist/cli/commands/registry/bundle-package.js +54 -0
  59. package/dist/cli/commands/registry/bundle-package.js.map +1 -0
  60. package/dist/cli/commands/registry/command-registry.d.ts +42 -18
  61. package/dist/cli/commands/registry/command-registry.d.ts.map +1 -1
  62. package/dist/cli/commands/registry/command-registry.js +10 -19
  63. package/dist/cli/commands/registry/command-registry.js.map +1 -1
  64. package/dist/cli/commands/registry/install.d.ts +0 -16
  65. package/dist/cli/commands/registry/install.d.ts.map +1 -1
  66. package/dist/cli/commands/registry/install.js +1 -17
  67. package/dist/cli/commands/registry/install.js.map +1 -1
  68. package/dist/cli/commands/registry/start.d.ts +1 -1
  69. package/dist/cli/commands/registry/start.d.ts.map +1 -1
  70. package/dist/cli/commands/registry/start.js +3 -5
  71. package/dist/cli/commands/registry/start.js.map +1 -1
  72. package/dist/cli/commands/review/review.js +14 -7
  73. package/dist/cli/commands/review/review.js.map +1 -1
  74. package/dist/cli/commands/review/rules/no-deprecated-content-base.js +1 -3
  75. package/dist/cli/commands/review/rules/no-deprecated-content-base.js.map +1 -1
  76. package/dist/cli/commands/review/rules/no-direct-peer-dependencies.js +1 -3
  77. package/dist/cli/commands/review/rules/no-direct-peer-dependencies.js.map +1 -1
  78. package/dist/cli/commands/review/rules/no-typescript-entry-point.js +1 -3
  79. package/dist/cli/commands/review/rules/no-typescript-entry-point.js.map +1 -1
  80. package/dist/cli/commands/review/rules/prefer-open-ended-peer-dependencies.js +5 -12
  81. package/dist/cli/commands/review/rules/prefer-open-ended-peer-dependencies.js.map +1 -1
  82. package/dist/cli/commands/review/rules/require-compatible-launch-darkly-sdk.js +5 -12
  83. package/dist/cli/commands/review/rules/require-compatible-launch-darkly-sdk.js.map +1 -1
  84. package/dist/cli/commands/review/rules/require-explicit-side-effects.js +1 -3
  85. package/dist/cli/commands/review/rules/require-explicit-side-effects.js.map +1 -1
  86. package/dist/cli/commands/review/rules/require-one-collection-version.js +1 -3
  87. package/dist/cli/commands/review/rules/require-one-collection-version.js.map +1 -1
  88. package/dist/cli/commands/review/rules/require-servicetitan-scope.js +1 -3
  89. package/dist/cli/commands/review/rules/require-servicetitan-scope.js.map +1 -1
  90. package/dist/cli/commands/review/rules/require-tsconfig-references.js +1 -3
  91. package/dist/cli/commands/review/rules/require-tsconfig-references.js.map +1 -1
  92. package/dist/cli/commands/review/utils/compare-version.js +8 -19
  93. package/dist/cli/commands/review/utils/compare-version.js.map +1 -1
  94. package/dist/cli/commands/run-task.d.ts +1 -0
  95. package/dist/cli/commands/run-task.d.ts.map +1 -1
  96. package/dist/cli/commands/run-task.js +20 -6
  97. package/dist/cli/commands/run-task.js.map +1 -1
  98. package/dist/cli/commands/start.d.ts.map +1 -1
  99. package/dist/cli/commands/start.js +37 -14
  100. package/dist/cli/commands/start.js.map +1 -1
  101. package/dist/cli/commands/stylelint.js +13 -4
  102. package/dist/cli/commands/stylelint.js.map +1 -1
  103. package/dist/cli/commands/styles-check.js +13 -4
  104. package/dist/cli/commands/styles-check.js.map +1 -1
  105. package/dist/cli/commands/test/runners/jest.js +1 -3
  106. package/dist/cli/commands/test/runners/jest.js.map +1 -1
  107. package/dist/cli/commands/test/tests.js +13 -4
  108. package/dist/cli/commands/test/tests.js.map +1 -1
  109. package/dist/cli/commands/types.d.ts +1 -6
  110. package/dist/cli/commands/types.d.ts.map +1 -1
  111. package/dist/cli/commands/types.js +2 -20
  112. package/dist/cli/commands/types.js.map +1 -1
  113. package/dist/cli/commands/upload-sourcemaps.js +17 -13
  114. package/dist/cli/commands/upload-sourcemaps.js.map +1 -1
  115. package/dist/cli/index.js +1 -0
  116. package/dist/cli/index.js.map +1 -1
  117. package/dist/cli/tasks/cli-task.d.ts +3 -0
  118. package/dist/cli/tasks/cli-task.d.ts.map +1 -1
  119. package/dist/cli/tasks/cli-task.js +41 -9
  120. package/dist/cli/tasks/cli-task.js.map +1 -1
  121. package/dist/cli/tasks/swc-compile-package/get-swc-options.d.ts +9 -1
  122. package/dist/cli/tasks/swc-compile-package/get-swc-options.d.ts.map +1 -1
  123. package/dist/cli/tasks/swc-compile-package/get-swc-options.js +18 -2
  124. package/dist/cli/tasks/swc-compile-package/get-swc-options.js.map +1 -1
  125. package/dist/cli/tasks/swc-compile-package/swc-compile-package.d.ts +3 -1
  126. package/dist/cli/tasks/swc-compile-package/swc-compile-package.d.ts.map +1 -1
  127. package/dist/cli/tasks/swc-compile-package/swc-compile-package.js +17 -3
  128. package/dist/cli/tasks/swc-compile-package/swc-compile-package.js.map +1 -1
  129. package/dist/cli/tasks/task.d.ts +2 -1
  130. package/dist/cli/tasks/task.d.ts.map +1 -1
  131. package/dist/cli/tasks/task.js +6 -3
  132. package/dist/cli/tasks/task.js.map +1 -1
  133. package/dist/cli/tasks/tsc-compile/tsc-compile.js +1 -3
  134. package/dist/cli/tasks/tsc-compile/tsc-compile.js.map +1 -1
  135. package/dist/cli/utils/cli-git.d.ts +7 -0
  136. package/dist/cli/utils/cli-git.d.ts.map +1 -1
  137. package/dist/cli/utils/cli-git.js +30 -0
  138. package/dist/cli/utils/cli-git.js.map +1 -1
  139. package/dist/cli/utils/cli-npm.d.ts.map +1 -1
  140. package/dist/cli/utils/cli-npm.js +8 -1
  141. package/dist/cli/utils/cli-npm.js.map +1 -1
  142. package/dist/cli/utils/cli-os.d.ts +7 -1
  143. package/dist/cli/utils/cli-os.d.ts.map +1 -1
  144. package/dist/cli/utils/cli-os.js +42 -0
  145. package/dist/cli/utils/cli-os.js.map +1 -1
  146. package/dist/cli/utils/compile.d.ts.map +1 -1
  147. package/dist/cli/utils/compile.js +7 -4
  148. package/dist/cli/utils/compile.js.map +1 -1
  149. package/dist/cli/utils/copy-files.js +1 -0
  150. package/dist/cli/utils/copy-files.js.map +1 -1
  151. package/dist/cli/utils/index.d.ts +1 -1
  152. package/dist/cli/utils/index.d.ts.map +1 -1
  153. package/dist/cli/utils/index.js +1 -1
  154. package/dist/cli/utils/index.js.map +1 -1
  155. package/dist/cli/utils/process-tree.js +2 -6
  156. package/dist/cli/utils/process-tree.js.map +1 -1
  157. package/dist/cli/utils/resolve-bundler.d.ts.map +1 -1
  158. package/dist/cli/utils/resolve-bundler.js +2 -1
  159. package/dist/cli/utils/resolve-bundler.js.map +1 -1
  160. package/dist/cli/utils/ts-config.d.ts +1 -1
  161. package/dist/cli/utils/ts-config.d.ts.map +1 -1
  162. package/dist/cli/utils/ts-config.js +1 -3
  163. package/dist/cli/utils/ts-config.js.map +1 -1
  164. package/dist/cli/utils/with-exponential-backoff.d.ts +7 -0
  165. package/dist/cli/utils/with-exponential-backoff.d.ts.map +1 -0
  166. package/dist/cli/utils/with-exponential-backoff.js +28 -0
  167. package/dist/cli/utils/with-exponential-backoff.js.map +1 -0
  168. package/dist/core/constants.d.ts +2 -0
  169. package/dist/core/constants.d.ts.map +1 -1
  170. package/dist/core/constants.js +6 -1
  171. package/dist/core/constants.js.map +1 -1
  172. package/dist/postinstall.js +118 -0
  173. package/dist/scripts/generate-bin-wrappers.js +203 -0
  174. package/dist/storybook-config/swc.d.ts +6 -0
  175. package/dist/storybook-config/swc.d.ts.map +1 -1
  176. package/dist/storybook-config/webpack-final.d.ts.map +1 -1
  177. package/dist/storybook-config/webpack-final.js +2 -1
  178. package/dist/storybook-config/webpack-final.js.map +1 -1
  179. package/dist/telemetry/index.d.ts +3 -0
  180. package/dist/telemetry/index.d.ts.map +1 -0
  181. package/dist/telemetry/index.js +21 -0
  182. package/dist/telemetry/index.js.map +1 -0
  183. package/dist/telemetry/telemetry.d.ts +15 -0
  184. package/dist/telemetry/telemetry.d.ts.map +1 -0
  185. package/dist/telemetry/telemetry.js +176 -0
  186. package/dist/telemetry/telemetry.js.map +1 -0
  187. package/dist/utils/exit-when-parent-exits.d.ts +6 -0
  188. package/dist/utils/exit-when-parent-exits.d.ts.map +1 -0
  189. package/dist/utils/exit-when-parent-exits.js +37 -0
  190. package/dist/utils/exit-when-parent-exits.js.map +1 -0
  191. package/dist/utils/find-up.d.ts +1 -1
  192. package/dist/utils/find-up.d.ts.map +1 -1
  193. package/dist/utils/find-up.js +2 -2
  194. package/dist/utils/find-up.js.map +1 -1
  195. package/dist/utils/get-configuration.d.ts +6 -3
  196. package/dist/utils/get-configuration.d.ts.map +1 -1
  197. package/dist/utils/get-configuration.js +10 -2
  198. package/dist/utils/get-configuration.js.map +1 -1
  199. package/dist/utils/index.d.ts +1 -0
  200. package/dist/utils/index.d.ts.map +1 -1
  201. package/dist/utils/index.js +1 -0
  202. package/dist/utils/index.js.map +1 -1
  203. package/dist/utils/log.js +1 -3
  204. package/dist/utils/log.js.map +1 -1
  205. package/dist/vite/build-shared-dependencies.d.ts.map +1 -1
  206. package/dist/vite/build-shared-dependencies.js +2 -0
  207. package/dist/vite/build-shared-dependencies.js.map +1 -1
  208. package/dist/vite/config/base-config.d.ts.map +1 -1
  209. package/dist/vite/config/base-config.js +12 -1
  210. package/dist/vite/config/base-config.js.map +1 -1
  211. package/dist/vite/config/create-filtering-logger.d.ts.map +1 -1
  212. package/dist/vite/config/create-filtering-logger.js +6 -2
  213. package/dist/vite/config/create-filtering-logger.js.map +1 -1
  214. package/dist/vite/config/create-vite-config.js +7 -2
  215. package/dist/vite/config/create-vite-config.js.map +1 -1
  216. package/dist/vite/config/load-config-file.js +8 -19
  217. package/dist/vite/config/load-config-file.js.map +1 -1
  218. package/dist/vite/index.d.ts +2 -0
  219. package/dist/vite/index.d.ts.map +1 -1
  220. package/dist/vite/index.html +2 -2
  221. package/dist/vite/index.js +16 -0
  222. package/dist/vite/index.js.map +1 -1
  223. package/dist/vite/plugins/chain-source-maps-plugin.js +1 -1
  224. package/dist/vite/plugins/chain-source-maps-plugin.js.map +1 -1
  225. package/dist/vite/plugins/clean-plugin.js +1 -1
  226. package/dist/vite/plugins/clean-plugin.js.map +1 -1
  227. package/dist/vite/plugins/css-injector-plugin.js +1 -1
  228. package/dist/vite/plugins/css-injector-plugin.js.map +1 -1
  229. package/dist/vite/plugins/design-system-guard-plugin.d.ts.map +1 -1
  230. package/dist/vite/plugins/design-system-guard-plugin.js +10 -5
  231. package/dist/vite/plugins/design-system-guard-plugin.js.map +1 -1
  232. package/dist/vite/plugins/dev-server-routing-plugin.js +1 -1
  233. package/dist/vite/plugins/dev-server-routing-plugin.js.map +1 -1
  234. package/dist/vite/plugins/externals-plugin.d.ts.map +1 -1
  235. package/dist/vite/plugins/externals-plugin.js +11 -5
  236. package/dist/vite/plugins/externals-plugin.js.map +1 -1
  237. package/dist/vite/plugins/html-plugin.d.ts.map +1 -1
  238. package/dist/vite/plugins/html-plugin.js +5 -3
  239. package/dist/vite/plugins/html-plugin.js.map +1 -1
  240. package/dist/vite/plugins/ignore-modules-plugin.d.ts +2 -2
  241. package/dist/vite/plugins/ignore-modules-plugin.d.ts.map +1 -1
  242. package/dist/vite/plugins/ignore-modules-plugin.js +36 -24
  243. package/dist/vite/plugins/ignore-modules-plugin.js.map +1 -1
  244. package/dist/vite/plugins/index.d.ts +3 -0
  245. package/dist/vite/plugins/index.d.ts.map +1 -1
  246. package/dist/vite/plugins/index.js +3 -0
  247. package/dist/vite/plugins/index.js.map +1 -1
  248. package/dist/vite/plugins/less-tilde-plugin.d.ts +8 -0
  249. package/dist/vite/plugins/less-tilde-plugin.d.ts.map +1 -0
  250. package/dist/vite/plugins/less-tilde-plugin.js +53 -0
  251. package/dist/vite/plugins/less-tilde-plugin.js.map +1 -0
  252. package/dist/vite/plugins/magic-comments-plugin/magic-comments-plugin.js +1 -1
  253. package/dist/vite/plugins/magic-comments-plugin/magic-comments-plugin.js.map +1 -1
  254. package/dist/vite/plugins/metadata-plugin.js +1 -1
  255. package/dist/vite/plugins/metadata-plugin.js.map +1 -1
  256. package/dist/vite/plugins/moment-locales-plugin.d.ts +1 -1
  257. package/dist/vite/plugins/moment-locales-plugin.d.ts.map +1 -1
  258. package/dist/vite/plugins/moment-locales-plugin.js +30 -14
  259. package/dist/vite/plugins/moment-locales-plugin.js.map +1 -1
  260. package/dist/vite/plugins/react-refresh-plugin/index.d.ts +2 -0
  261. package/dist/vite/plugins/react-refresh-plugin/index.d.ts.map +1 -0
  262. package/dist/vite/plugins/react-refresh-plugin/index.js +20 -0
  263. package/dist/vite/plugins/react-refresh-plugin/index.js.map +1 -0
  264. package/dist/vite/plugins/react-refresh-plugin/react-refresh-plugin.d.ts +4 -0
  265. package/dist/vite/plugins/react-refresh-plugin/react-refresh-plugin.d.ts.map +1 -0
  266. package/dist/vite/plugins/react-refresh-plugin/react-refresh-plugin.js +143 -0
  267. package/dist/vite/plugins/react-refresh-plugin/react-refresh-plugin.js.map +1 -0
  268. package/dist/vite/plugins/react-refresh-plugin/refresh-runtime.js +113 -0
  269. package/dist/vite/plugins/shared-dependencies-plugin/shared-dependencies-plugin.d.ts.map +1 -1
  270. package/dist/vite/plugins/shared-dependencies-plugin/shared-dependencies-plugin.js +14 -11
  271. package/dist/vite/plugins/shared-dependencies-plugin/shared-dependencies-plugin.js.map +1 -1
  272. package/dist/vite/plugins/style-urls-plugin.js +1 -1
  273. package/dist/vite/plugins/style-urls-plugin.js.map +1 -1
  274. package/dist/vite/plugins/virtual-modules-plugin.d.ts.map +1 -1
  275. package/dist/vite/plugins/virtual-modules-plugin.js +9 -6
  276. package/dist/vite/plugins/virtual-modules-plugin.js.map +1 -1
  277. package/dist/vite/plugins/window-externals-plugin.d.ts +22 -0
  278. package/dist/vite/plugins/window-externals-plugin.d.ts.map +1 -0
  279. package/dist/vite/plugins/window-externals-plugin.js +74 -0
  280. package/dist/vite/plugins/window-externals-plugin.js.map +1 -0
  281. package/dist/webpack/bundle-webpack.d.ts.map +1 -1
  282. package/dist/webpack/bundle-webpack.js +6 -1
  283. package/dist/webpack/bundle-webpack.js.map +1 -1
  284. package/dist/webpack/configs/optimization-config.js +17 -12
  285. package/dist/webpack/configs/optimization-config.js.map +1 -1
  286. package/dist/webpack/configs/output-config.js +1 -1
  287. package/dist/webpack/configs/output-config.js.map +1 -1
  288. package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.js +1 -3
  289. package/dist/webpack/configs/plugins/ignore-plugin/ignore-plugin.js.map +1 -1
  290. package/dist/webpack/loaders/expose-loader/__tests__/__mocks__/configuration.expose-loader.js +13 -0
  291. package/dist/webpack/loaders/expose-loader/__tests__/__mocks__/index.js +1 -0
  292. package/dist/webpack/utils/index.d.ts +1 -0
  293. package/dist/webpack/utils/index.d.ts.map +1 -1
  294. package/dist/webpack/utils/index.js +1 -0
  295. package/dist/webpack/utils/index.js.map +1 -1
  296. package/dist/webpack/utils/normalize-proxy-config.d.ts +6 -0
  297. package/dist/webpack/utils/normalize-proxy-config.d.ts.map +1 -0
  298. package/dist/webpack/utils/normalize-proxy-config.js +52 -0
  299. package/dist/webpack/utils/normalize-proxy-config.js.map +1 -0
  300. package/package.json +32 -26
  301. package/src/cli/commands/__tests__/build.test.ts +81 -20
  302. package/src/cli/commands/__tests__/bundle-package.test.ts +65 -0
  303. package/src/cli/commands/__tests__/command.test.ts +154 -0
  304. package/src/cli/commands/__tests__/init.test.ts +1 -1
  305. package/src/cli/commands/__tests__/install.test.ts +5 -72
  306. package/src/cli/commands/__tests__/mfe-check.test.ts +26 -5
  307. package/src/cli/commands/__tests__/run-task.test.ts +20 -1
  308. package/src/cli/commands/__tests__/start.test.ts +77 -16
  309. package/src/cli/commands/build.ts +15 -6
  310. package/src/cli/commands/bundle-package.ts +20 -0
  311. package/src/cli/commands/command.ts +64 -0
  312. package/src/cli/commands/init.ts +0 -1
  313. package/src/cli/commands/install.ts +5 -21
  314. package/src/cli/commands/mfe-check.ts +6 -10
  315. package/src/cli/commands/registry/build.ts +3 -2
  316. package/src/cli/commands/registry/bundle-package.ts +22 -0
  317. package/src/cli/commands/registry/command-registry.ts +2 -0
  318. package/src/cli/commands/registry/install.ts +1 -6
  319. package/src/cli/commands/registry/start.ts +3 -2
  320. package/src/cli/commands/run-task.ts +8 -2
  321. package/src/cli/commands/start.ts +17 -6
  322. package/src/cli/commands/types.ts +2 -6
  323. package/src/cli/index.ts +3 -0
  324. package/src/cli/tasks/__tests__/cli-task.test.ts +181 -69
  325. package/src/cli/tasks/__tests__/task.test.ts +40 -45
  326. package/src/cli/tasks/cli-task.ts +43 -2
  327. package/src/cli/tasks/swc-compile-package/__tests__/get-swc-options.test.ts +46 -4
  328. package/src/cli/tasks/swc-compile-package/__tests__/swc-compile-package.test.ts +25 -4
  329. package/src/cli/tasks/swc-compile-package/get-swc-options.ts +14 -1
  330. package/src/cli/tasks/swc-compile-package/swc-compile-package.ts +6 -2
  331. package/src/cli/tasks/task.ts +8 -2
  332. package/src/cli/tasks/tsc-compile/__tests__/tsc-compile.test.ts +8 -32
  333. package/src/cli/tasks/tsc-compile-package/__tests__/tsc-compile-package.test.ts +10 -19
  334. package/src/cli/utils/__tests__/cli-git.test.ts +54 -3
  335. package/src/cli/utils/__tests__/cli-npm.test.ts +33 -0
  336. package/src/cli/utils/__tests__/cli-os.test.ts +183 -4
  337. package/src/cli/utils/__tests__/compile.test.ts +37 -2
  338. package/src/cli/utils/__tests__/copy-files.test.ts +1 -1
  339. package/src/cli/utils/__tests__/with-exponential-backoff.test.ts +119 -0
  340. package/src/cli/utils/cli-git.ts +27 -1
  341. package/src/cli/utils/cli-npm.ts +19 -4
  342. package/src/cli/utils/cli-os.ts +44 -0
  343. package/src/cli/utils/compile.ts +8 -1
  344. package/src/cli/utils/copy-files.ts +1 -1
  345. package/src/cli/utils/index.ts +1 -1
  346. package/src/cli/utils/resolve-bundler.ts +2 -1
  347. package/src/cli/utils/ts-config.ts +1 -1
  348. package/src/cli/utils/with-exponential-backoff.ts +28 -0
  349. package/src/core/constants.ts +2 -0
  350. package/src/storybook-config/__tests__/vite-final.test.ts +6 -0
  351. package/src/storybook-config/__tests__/webpack-final.test.ts +26 -12
  352. package/src/storybook-config/webpack-final.ts +10 -4
  353. package/src/telemetry/__tests__/telemetry.test.ts +326 -0
  354. package/src/telemetry/index.ts +2 -0
  355. package/src/telemetry/telemetry.ts +134 -0
  356. package/src/utils/__tests__/exit-when-parent-exits.test.ts +87 -0
  357. package/src/utils/__tests__/find-up.test.ts +49 -0
  358. package/src/utils/__tests__/get-configuration.test.ts +62 -0
  359. package/src/utils/exit-when-parent-exits.ts +33 -0
  360. package/src/utils/find-up.ts +2 -2
  361. package/src/utils/get-configuration.ts +14 -5
  362. package/src/utils/index.ts +1 -0
  363. package/src/vite/__tests__/build-shared-dependencies.test.ts +39 -5
  364. package/src/vite/build-shared-dependencies.ts +2 -1
  365. package/src/vite/config/__tests__/base-config.test.ts +12 -4
  366. package/src/vite/config/__tests__/create-css-config.test.ts +2 -6
  367. package/src/vite/config/__tests__/create-filtering-logger.test.ts +3 -2
  368. package/src/vite/config/__tests__/create-vite-config.test.ts +6 -3
  369. package/src/vite/config/base-config.ts +13 -1
  370. package/src/vite/config/create-filtering-logger.ts +8 -2
  371. package/src/vite/config/create-vite-config.ts +6 -3
  372. package/src/vite/index.html +2 -2
  373. package/src/vite/index.ts +2 -0
  374. package/src/vite/plugins/__tests__/chain-source-maps-plugin.test.ts +1 -1
  375. package/src/vite/plugins/__tests__/clean-plugin.test.ts +1 -1
  376. package/src/vite/plugins/__tests__/css-injector-plugin.test.ts +1 -1
  377. package/src/vite/plugins/__tests__/design-system-guard-plugin.test.ts +15 -3
  378. package/src/vite/plugins/__tests__/dev-server-routing-plugin.test.ts +1 -1
  379. package/src/vite/plugins/__tests__/externals-plugin.test.ts +24 -3
  380. package/src/vite/plugins/__tests__/html-plugin.test.ts +10 -3
  381. package/src/vite/plugins/__tests__/html-template.test.ts +10 -2
  382. package/src/vite/plugins/__tests__/ignore-modules-plugin.test.ts +30 -6
  383. package/src/vite/plugins/__tests__/less-tilde-plugin.test.ts +91 -0
  384. package/src/vite/plugins/__tests__/metadata-plugin.test.ts +1 -1
  385. package/src/vite/plugins/__tests__/moment-locales-plugin.test.ts +35 -25
  386. package/src/vite/plugins/__tests__/style-urls-plugin.test.ts +1 -1
  387. package/src/vite/plugins/__tests__/virtual-modules-plugin.test.ts +20 -9
  388. package/src/vite/plugins/__tests__/window-externals-plugin.test.ts +128 -0
  389. package/src/vite/plugins/chain-source-maps-plugin.ts +1 -1
  390. package/src/vite/plugins/clean-plugin.ts +1 -1
  391. package/src/vite/plugins/css-injector-plugin.ts +1 -1
  392. package/src/vite/plugins/design-system-guard-plugin.ts +11 -8
  393. package/src/vite/plugins/dev-server-routing-plugin.ts +1 -1
  394. package/src/vite/plugins/externals-plugin.ts +15 -6
  395. package/src/vite/plugins/html-plugin.ts +4 -2
  396. package/src/vite/plugins/ignore-modules-plugin.ts +32 -23
  397. package/src/vite/plugins/index.ts +3 -0
  398. package/src/vite/plugins/less-tilde-plugin.ts +64 -0
  399. package/src/vite/plugins/magic-comments-plugin/magic-comments-plugin.ts +1 -1
  400. package/src/vite/plugins/metadata-plugin.ts +1 -1
  401. package/src/vite/plugins/moment-locales-plugin.ts +24 -14
  402. package/src/vite/plugins/react-refresh-plugin/README.md +165 -0
  403. package/src/vite/plugins/react-refresh-plugin/__tests__/react-refresh-plugin.test.ts +366 -0
  404. package/src/vite/plugins/react-refresh-plugin/__tests__/refresh-runtime.test.ts +193 -0
  405. package/src/vite/plugins/react-refresh-plugin/index.ts +1 -0
  406. package/src/vite/plugins/react-refresh-plugin/react-refresh-plugin.ts +144 -0
  407. package/src/vite/plugins/react-refresh-plugin/refresh-runtime.js +113 -0
  408. package/src/vite/plugins/shared-dependencies-plugin/__tests__/shared-dependencies-plugin.test.ts +21 -16
  409. package/src/vite/plugins/shared-dependencies-plugin/shared-dependencies-plugin.ts +13 -12
  410. package/src/vite/plugins/style-urls-plugin.ts +1 -1
  411. package/src/vite/plugins/virtual-modules-plugin.ts +8 -7
  412. package/src/vite/plugins/window-externals-plugin.ts +94 -0
  413. package/src/webpack/__tests__/bundle-webpack.test.ts +32 -0
  414. package/src/webpack/__tests__/create-webpack-config-shared-dependencies.test.ts +27 -1
  415. package/src/webpack/__tests__/create-webpack-config-web-component.test.ts +17 -5
  416. package/src/webpack/__tests__/create-webpack-config.test.ts +10 -6
  417. package/src/webpack/bundle-webpack.ts +7 -1
  418. package/src/webpack/configs/optimization-config.ts +22 -11
  419. package/src/webpack/configs/output-config.ts +1 -1
  420. package/src/webpack/utils/__tests__/normalize-proxy-config.test.ts +121 -0
  421. package/src/webpack/utils/index.ts +1 -0
  422. package/src/webpack/utils/normalize-proxy-config.ts +59 -0
  423. package/tsconfig/types.d.ts +10 -0
  424. package/dist/cli/utils/get-bundle-command.d.ts +0 -3
  425. package/dist/cli/utils/get-bundle-command.d.ts.map +0 -1
  426. package/dist/cli/utils/get-bundle-command.js +0 -16
  427. package/dist/cli/utils/get-bundle-command.js.map +0 -1
  428. package/src/cli/utils/__tests__/get-bundle-command.test.ts +0 -23
  429. package/src/cli/utils/get-bundle-command.ts +0 -5
@@ -1,6 +1,8 @@
1
1
  import { createPackage } from '../../../__mocks__';
2
- import { Package, PackageType, getPackages, log } from '../../../utils';
3
- import { compile, lernaExec, typeCheck, watchStdout } from '../../utils';
2
+ import { Attributes } from '../../../telemetry';
3
+ import { getConfiguration, getPackages, log, Package, PackageType } from '../../../utils';
4
+ import { compile, lernaExec, ProcessTree, typeCheck, watchStdout } from '../../utils';
5
+ import { Command } from '../command';
4
6
  import { entry } from '../registry/start';
5
7
  import { Start } from '../start';
6
8
 
@@ -31,18 +33,29 @@ jest.mock('../../utils', () => ({
31
33
  }));
32
34
 
33
35
  describe(`[startup] ${Start.name}`, () => {
36
+ const commandProto = Command.prototype as unknown as {
37
+ recordStart: (command: string, attributes?: Attributes) => void;
38
+ recordEnd: (error?: unknown) => Promise<void>;
39
+ };
40
+
34
41
  let args: ConstructorParameters<typeof Start>[0];
35
42
  let packages: Package[];
43
+ let recordStart: jest.SpyInstance;
44
+ let recordEnd: jest.SpyInstance;
36
45
 
37
46
  beforeEach(() => {
38
47
  args = {};
39
48
  packages = [];
49
+ jest.restoreAllMocks();
40
50
  jest.clearAllMocks();
51
+ jest.mocked(getConfiguration).mockReturnValue({});
41
52
  jest.mocked(getPackages).mockImplementation(() => packages);
42
53
  jest.mocked(watchStdout).mockImplementation((_process, _indicator, handler) => {
43
54
  handler(packages.length);
44
55
  return jest.fn();
45
56
  });
57
+ recordStart = jest.spyOn(commandProto, 'recordStart').mockImplementation(() => {});
58
+ recordEnd = jest.spyOn(commandProto, 'recordEnd').mockResolvedValue(undefined);
46
59
  });
47
60
 
48
61
  const subject = () => new Start(args).execute();
@@ -106,6 +119,41 @@ describe(`[startup] ${Start.name}`, () => {
106
119
  expect(entry.greedy).toBe(true);
107
120
  });
108
121
 
122
+ test('sets process.env.STARTUP_PARENT_PID', async () => {
123
+ await subject();
124
+
125
+ expect(process.env.STARTUP_PARENT_PID).toBe(String(process.pid));
126
+ });
127
+
128
+ describe('telemetry', () => {
129
+ beforeEach(() => packages.push(createPackage({ type: PackageType.TSC })));
130
+
131
+ test('records the command start', async () => {
132
+ await subject();
133
+
134
+ expect(recordStart).toHaveBeenCalledWith('start', { bundler: expect.any(String) });
135
+ });
136
+
137
+ describe('when start fails', () => {
138
+ const error = new Error('watch failed');
139
+
140
+ beforeEach(() => {
141
+ jest.spyOn(log, 'error').mockImplementation(jest.fn());
142
+ jest.spyOn(ProcessTree.prototype, 'run').mockRejectedValue(error);
143
+ });
144
+
145
+ test('records the failure', async () => {
146
+ await subject().catch(() => {});
147
+
148
+ expect(recordEnd).toHaveBeenCalledWith(error);
149
+ });
150
+
151
+ test('propagates the error', async () => {
152
+ await expect(subject()).rejects.toBe(error);
153
+ });
154
+ });
155
+ });
156
+
109
157
  describe('with TSC package', () => {
110
158
  beforeEach(() => packages.push(createPackage({ type: PackageType.TSC })));
111
159
 
@@ -121,7 +169,7 @@ describe(`[startup] ${Start.name}`, () => {
121
169
  });
122
170
  });
123
171
 
124
- describe('with Webpack package', () => {
172
+ describe('with bundle package', () => {
125
173
  beforeEach(() => packages.push(createPackage({ type: PackageType.Bundle })));
126
174
 
127
175
  itPreparesThePackages();
@@ -132,11 +180,11 @@ describe(`[startup] ${Start.name}`, () => {
132
180
  await subject();
133
181
 
134
182
  expect(lernaExec).toHaveBeenCalledWith({
135
- 'cmd': 'startup bundle-webpack',
183
+ 'cmd': 'startup bundle-package',
136
184
  'scope': packages.map(({ name }) => name),
137
185
  'parallel': true,
138
186
  'stream': true,
139
- '--': ['--exposed-dependencies', '--use-watch-config'],
187
+ '--': ['--exposed-dependencies', '--use-watch-config', '--bundler webpack'],
140
188
  });
141
189
  });
142
190
 
@@ -144,24 +192,37 @@ describe(`[startup] ${Start.name}`, () => {
144
192
  await subject();
145
193
 
146
194
  expect(lernaExec).toHaveBeenCalledWith({
147
- 'cmd': 'startup bundle-webpack',
195
+ 'cmd': 'startup bundle-package',
148
196
  'scope': packages.map(({ name }) => name),
149
197
  'parallel': true,
150
198
  'stream': true,
151
- '--': ['--watch'],
199
+ '--': ['--watch', '--bundler webpack'],
152
200
  });
153
201
  });
154
202
 
155
- describe('with --bundler=vite', () => {
156
- beforeEach(() => (args.bundler = 'vite'));
157
-
158
- test('bundles with Vite in watch mode', async () => {
203
+ function itBundlesWithVite() {
204
+ test('bundles with vite', async () => {
159
205
  await subject();
160
206
 
161
207
  expect(lernaExec).toHaveBeenCalledWith(
162
- expect.objectContaining({ cmd: 'startup bundle-vite' })
208
+ expect.objectContaining({
209
+ 'cmd': 'startup bundle-package',
210
+ '--': ['--watch', '--bundler vite'],
211
+ })
163
212
  );
164
213
  });
214
+ }
215
+
216
+ describe('with --bundler=vite', () => {
217
+ beforeEach(() => (args.bundler = 'vite'));
218
+
219
+ itBundlesWithVite();
220
+ });
221
+
222
+ describe('with cli.bundler set to vite', () => {
223
+ beforeEach(() => jest.mocked(getConfiguration).mockReturnValue({ bundler: 'vite' }));
224
+
225
+ itBundlesWithVite();
165
226
  });
166
227
 
167
228
  describe('with "code-coverage"', () => {
@@ -172,8 +233,8 @@ describe(`[startup] ${Start.name}`, () => {
172
233
 
173
234
  expect(lernaExec).toHaveBeenCalledWith(
174
235
  expect.objectContaining({
175
- 'cmd': 'startup bundle-webpack',
176
- '--': ['--watch', '--code-coverage'],
236
+ 'cmd': 'startup bundle-package',
237
+ '--': ['--watch', '--code-coverage', '--bundler webpack'],
177
238
  })
178
239
  );
179
240
  });
@@ -187,8 +248,8 @@ describe(`[startup] ${Start.name}`, () => {
187
248
 
188
249
  expect(lernaExec).toHaveBeenCalledWith(
189
250
  expect.objectContaining({
190
- 'cmd': 'startup bundle-webpack',
191
- '--': ['--watch', `--config "${args.config}"`],
251
+ 'cmd': 'startup bundle-package',
252
+ '--': ['--watch', `--config "${args.config}"`, '--bundler webpack'],
192
253
  })
193
254
  );
194
255
  });
@@ -1,5 +1,5 @@
1
1
  import { getPackages, logErrors, PackageType } from '../../utils';
2
- import { checkArgs, compile, getBundleCommand, lernaExec, ProcessTree, typeCheck } from '../utils';
2
+ import { checkArgs, compile, lernaExec, ProcessTree, resolveBundler, typeCheck } from '../utils';
3
3
  import { kendoUILicense } from './kendo-ui-license';
4
4
  import type { entry } from './registry/build';
5
5
  import { Command } from './types';
@@ -30,6 +30,8 @@ export class Build extends Command<typeof entry> {
30
30
  return;
31
31
  }
32
32
 
33
+ this.recordStart('build', { bundler: resolveBundler(this.args) });
34
+
33
35
  if (this.args.cdnPath) {
34
36
  process.env.CLIENT_CDN_PATH = this.args.cdnPath;
35
37
  }
@@ -38,7 +40,7 @@ export class Build extends Command<typeof entry> {
38
40
  const bundleScope = packages
39
41
  .filter(({ type }) => type === PackageType.Bundle)
40
42
  .map(({ name }) => name);
41
- const bundleCmd = getBundleCommand(this.args);
43
+ const bundlerArg = [`--bundler ${resolveBundler(this.args)}`];
42
44
  const precompileScope = packages
43
45
  .filter(({ scripts }) => !!scripts?.precompile)
44
46
  .map(({ name }) => name);
@@ -77,11 +79,11 @@ export class Build extends Command<typeof entry> {
77
79
  return Promise.resolve();
78
80
  }
79
81
  return lernaExec({
80
- 'cmd': bundleCmd,
82
+ 'cmd': 'startup bundle-package',
81
83
  'scope': bundleScope,
82
84
  'parallel': true,
83
85
  'stream': true,
84
- '--': ['--exposed-dependencies'],
86
+ '--': ['--exposed-dependencies', ...bundlerArg],
85
87
  });
86
88
  },
87
89
  {
@@ -100,7 +102,7 @@ export class Build extends Command<typeof entry> {
100
102
  }
101
103
 
102
104
  return lernaExec({
103
- 'cmd': bundleCmd,
105
+ 'cmd': 'startup bundle-package',
104
106
  'scope': bundleScope,
105
107
  'stream': true,
106
108
  '--': [
@@ -108,12 +110,19 @@ export class Build extends Command<typeof entry> {
108
110
  ...[this.args.codeCoverage ? '--code-coverage' : undefined],
109
111
  ...[this.args.stat ? '--stat' : undefined],
110
112
  ...[this.args.preview ? '--preview' : undefined],
113
+ ...bundlerArg,
111
114
  ].filter(item => !!item) as string[],
112
115
  });
113
116
  },
114
117
  { dependsOn: [BuildProcesses.BundleExposedDependencies] }
115
118
  );
116
119
 
117
- await processTree.run();
120
+ try {
121
+ await processTree.run();
122
+ } catch (error) {
123
+ await this.recordEnd(error);
124
+ throw error;
125
+ }
126
+ this.recordEnd();
118
127
  }
119
128
  }
@@ -0,0 +1,20 @@
1
+ import { bundleConstants } from '../../core';
2
+ import { getConfiguration } from '../../utils';
3
+ import { entry } from './registry/bundle-package';
4
+ import { Command } from './types';
5
+
6
+ export class BundlePackage extends Command<typeof entry> {
7
+ async execute() {
8
+ // Local cli.bundler overrides project-wide default in this.args.bundler
9
+ const bundler =
10
+ getConfiguration().bundler ?? this.args.bundler ?? bundleConstants.defaultBundler;
11
+
12
+ if (bundler === 'vite') {
13
+ const { BundleVite } = await import('./bundle-vite');
14
+ await new BundleVite(this.args).execute();
15
+ } else {
16
+ const { BundleWebpack } = await import('./bundle-webpack');
17
+ await new BundleWebpack(this.args).execute();
18
+ }
19
+ }
20
+ }
@@ -0,0 +1,64 @@
1
+ import { randomUUID } from 'crypto';
2
+ import { Attributes, telemetry } from '../../telemetry';
3
+ import { CommandName, exitWhenParentExits } from '../../utils';
4
+ import { CommandEntry, InferArgs } from './types';
5
+
6
+ const NS_PER_MS = 1_000_000;
7
+
8
+ interface CommandRun {
9
+ command: string;
10
+ runId: string;
11
+ startedAt: number;
12
+ attributes?: Attributes;
13
+ }
14
+
15
+ export abstract class Command<T extends CommandEntry = CommandEntry, U = unknown> {
16
+ private commandRun?: CommandRun;
17
+
18
+ constructor(protected readonly args: InferArgs<NonNullable<T['options']>, U>) {}
19
+
20
+ watchForParentExit(name: CommandName): void {
21
+ if ('watch' in this.args && this.args.watch === true) {
22
+ exitWhenParentExits(name);
23
+ }
24
+ }
25
+
26
+ protected recordStart(command: string, attributes?: Attributes): void {
27
+ if (this.commandRun) {
28
+ return;
29
+ }
30
+ this.commandRun = {
31
+ command,
32
+ runId: randomUUID(),
33
+ startedAt: globalThis.performance.now(),
34
+ attributes,
35
+ };
36
+ telemetry.info('command.started', {
37
+ ...attributes,
38
+ command,
39
+ runId: this.commandRun.runId,
40
+ });
41
+ }
42
+
43
+ protected recordEnd(error?: unknown): Promise<void> {
44
+ const run = this.commandRun;
45
+ if (!run) {
46
+ return Promise.resolve();
47
+ }
48
+ this.commandRun = undefined;
49
+ const attributes = {
50
+ ...run.attributes,
51
+ command: run.command,
52
+ runId: run.runId,
53
+ duration: Math.round((globalThis.performance.now() - run.startedAt) * NS_PER_MS),
54
+ };
55
+ if (error !== undefined) {
56
+ telemetry.error('command.finished', error, attributes);
57
+ } else {
58
+ telemetry.info('command.finished', attributes);
59
+ }
60
+ return telemetry.flush();
61
+ }
62
+
63
+ abstract execute(): Promise<void>;
64
+ }
@@ -39,7 +39,6 @@ export class Init extends Command<typeof entry> {
39
39
 
40
40
  fs.rmSync(path.join(destination, '.git'), { recursive: true, force: true });
41
41
  fs.rmSync(path.join(destination, '.github', 'CODEOWNERS'));
42
- fs.rmSync(path.join(destination, 'package-lock.json'));
43
42
  return true;
44
43
  }
45
44
  }
@@ -1,29 +1,13 @@
1
- import { execSync } from 'child_process';
2
- import { getStartupVersion } from '../../core';
3
- import { log, logErrors } from '../../utils';
1
+ import { logErrors } from '../../utils';
4
2
  import type { entry } from './registry/install';
5
3
  import { Command } from './types';
6
4
 
7
5
  export class Install extends Command<typeof entry> {
8
6
  @logErrors
7
+ // eslint-disable-next-line @typescript-eslint/require-await
9
8
  async execute() {
10
- if (!this.args.quiet) {
11
- log.info(`startup cli v${getStartupVersion()}`);
12
- }
13
-
14
- const options = [
15
- this.args.fix ? '--fix' : '',
16
- this.args.quiet ? '--quiet' : '',
17
- this.args.token === true ? '--token' : '',
18
- this.args.token === false ? '--no-token' : '',
19
- ].filter(option => !!option);
20
-
21
- const command = `npx --yes @servicetitan/install ${options.join(' ')}`.trim();
22
-
23
- log.debug('install', command);
24
-
25
- execSync(command, { stdio: 'inherit' });
26
-
27
- return Promise.resolve(); // stops "async method has no 'await' expression" lint error
9
+ throw new Error(
10
+ 'The `startup install` command has been removed. Run `npx --yes @servicetitan/install` directly instead.'
11
+ );
28
12
  }
29
13
  }
@@ -2,7 +2,10 @@ import { getPackageManager } from '@servicetitan/install';
2
2
  import { getVersionMismatches } from '@servicetitan/startup-utils';
3
3
  import path from 'node:path';
4
4
  import { getExposedDependencies, Metadata } from '../../core';
5
+ import type { Configuration } from '../../utils';
5
6
  import {
7
+ getSharedDependencies,
8
+ isExposeSharedDependencies,
6
9
  isWebComponent,
7
10
  loadSharedDependencies,
8
11
  log,
@@ -16,13 +19,7 @@ import { Command } from './types';
16
19
  interface HostPackageJSON {
17
20
  name: string;
18
21
  dependencies: Record<string, string>;
19
- cli?: {
20
- 'web-component'?: boolean | string | object;
21
- 'webpack'?: {
22
- 'expose-shared-dependencies'?: boolean;
23
- 'shared-dependencies'?: Record<string, string>;
24
- };
25
- };
22
+ cli?: Configuration;
26
23
  }
27
24
 
28
25
  interface HostData extends HostPackageJSON {
@@ -82,7 +79,7 @@ export class MfeCheck extends Command<typeof entry> {
82
79
  const mfeSharedDependencies = mfeMetadata.sharedDependencies;
83
80
  const hostSharedDependencies = loadSharedDependencies(
84
81
  hostData.dependencies,
85
- hostData.cli?.webpack?.['shared-dependencies']
82
+ getSharedDependencies(hostData)
86
83
  );
87
84
  const packageManager = getPackageManager();
88
85
  const workspacePackage = packageManager.getWorkspacePackage(hostData.location);
@@ -99,8 +96,7 @@ export class MfeCheck extends Command<typeof entry> {
99
96
  );
100
97
 
101
98
  const isHostMfe = isWebComponent(hostData);
102
- const isSharedDependenciesEnabled =
103
- hostData.cli?.webpack?.['expose-shared-dependencies'] === true;
99
+ const isSharedDependenciesEnabled = isExposeSharedDependencies(hostData);
104
100
  const compatible = !isHostMfe && !mismatchResult && isSharedDependenciesEnabled;
105
101
 
106
102
  return {
@@ -1,3 +1,4 @@
1
+ import { bundleConstants } from '../../../core';
1
2
  import type { CommandEntry } from '../types';
2
3
  import { defineEntry } from './define-entry';
3
4
 
@@ -6,9 +7,9 @@ export const entry = defineEntry({
6
7
  greedy: true,
7
8
  options: {
8
9
  bundler: {
9
- choices: ['vite', 'webpack'] as const,
10
+ choices: bundleConstants.bundlers,
10
11
  description: 'Bundler',
11
- defaultDescription: 'webpack',
12
+ defaultDescription: bundleConstants.defaultBundler,
12
13
  },
13
14
  cdnPath: { string: true, description: 'Base url for application assets' },
14
15
  codeCoverage: { boolean: true, description: 'Instrument code for coverage analysis?' },
@@ -0,0 +1,22 @@
1
+ import { bundleConstants } from '../../../core';
2
+ import type { CommandEntry } from '../types';
3
+ import { defineEntry } from './define-entry';
4
+
5
+ /*
6
+ * Internal dispatcher invoked by `start`/`build` per package. Its options are the union of
7
+ * bundle-vite and bundle-webpack so it can forward them to whichever bundler it delegates to,
8
+ * plus the run's --bundler default.
9
+ */
10
+ export const entry = defineEntry({
11
+ options: {
12
+ bundler: { choices: bundleConstants.bundlers, hidden: true },
13
+ codeCoverage: { boolean: true, hidden: true },
14
+ config: { string: true, hidden: true },
15
+ exposedDependencies: { boolean: true, hidden: true },
16
+ preview: { boolean: true, hidden: true },
17
+ printConfig: { boolean: true, hidden: true },
18
+ stat: { boolean: true, hidden: true },
19
+ useWatchConfig: { boolean: true, hidden: true },
20
+ watch: { boolean: true, hidden: true },
21
+ },
22
+ } satisfies CommandEntry);
@@ -1,6 +1,7 @@
1
1
  import { CommandName } from '../../../utils';
2
2
  import { Command, CommandEntry, Newable } from '../types';
3
3
  import { entry as build } from './build';
4
+ import { entry as bundlePackage } from './bundle-package';
4
5
  import { entry as bundleVite } from './bundle-vite';
5
6
  import { entry as bundleWebpack } from './bundle-webpack';
6
7
  import { entry as clean } from './clean';
@@ -64,6 +65,7 @@ function makeEntry<K extends CommandName, T extends CommandEntry>(
64
65
  */
65
66
  export const commandRegistry = {
66
67
  ...makeEntry(CommandName.build, build),
68
+ ...makeEntry(CommandName['bundle-package'], bundlePackage),
67
69
  ...makeEntry(CommandName['bundle-vite'], bundleVite),
68
70
  ...makeEntry(CommandName['bundle-webpack'], bundleWebpack),
69
71
  ...makeEntry(CommandName.clean, clean),
@@ -3,10 +3,5 @@ import { defineEntry } from './define-entry';
3
3
 
4
4
  export const entry = defineEntry({
5
5
  allowRunFromGlobal: true,
6
- description: 'Install project dependencies',
7
- options: {
8
- fix: { boolean: true, description: 'Update and dedupe package-lock.json', hidden: true },
9
- quiet: { boolean: true, description: 'Suppress output', hidden: true },
10
- token: { boolean: true, description: 'Configure npm token' },
11
- },
6
+ description: 'Removed. Run `npx --yes @servicetitan/install` directly instead.',
12
7
  } satisfies CommandEntry);
@@ -1,3 +1,4 @@
1
+ import { bundleConstants } from '../../../core';
1
2
  import type { CommandEntry } from '../types';
2
3
  import { defineEntry } from './define-entry';
3
4
 
@@ -6,9 +7,9 @@ export const entry = defineEntry({
6
7
  greedy: true,
7
8
  options: {
8
9
  bundler: {
9
- choices: ['vite', 'webpack'] as const,
10
+ choices: bundleConstants.bundlers,
10
11
  description: 'Bundler',
11
- defaultDescription: 'webpack',
12
+ defaultDescription: bundleConstants.defaultBundler,
12
13
  },
13
14
  codeCoverage: { boolean: true, description: 'Instrument code for coverage analysis?' },
14
15
  config: { string: true, hidden: true, description: 'Use specified configuration' },
@@ -12,15 +12,21 @@ const tasks: Record<string, new (args: { [key: string]: unknown }) => Task> = {
12
12
  };
13
13
 
14
14
  export class RunTask extends Command<typeof entry> {
15
+ watchForParentExit(): void {
16
+ // No-op: the task being run handles its own parent-exit watch.
17
+ }
18
+
15
19
  @logErrors
16
20
  async execute() {
17
21
  const { _ = [], taskName = this.args._?.[0], taskArgs = [], ...restOptions } = this.args;
18
22
 
19
23
  if (taskName && taskName in tasks) {
20
- await new tasks[taskName]({
24
+ const task = new tasks[taskName]({
21
25
  _: [..._, ...taskArgs],
22
26
  ...restOptions,
23
- }).execute();
27
+ });
28
+ task.watchForParentExit();
29
+ await task.execute();
24
30
  return;
25
31
  }
26
32
 
@@ -2,10 +2,10 @@ import { getPackages, logErrors, PackageType } from '../../utils';
2
2
  import {
3
3
  checkArgs,
4
4
  compile,
5
- getBundleCommand,
6
5
  lernaExec,
7
6
  pipeStdout,
8
7
  ProcessTree,
8
+ resolveBundler,
9
9
  typeCheck,
10
10
  watchStdout,
11
11
  } from '../utils';
@@ -28,6 +28,9 @@ export class Start extends Command<typeof entry> {
28
28
  async execute() {
29
29
  checkArgs(this.args, { obsolete: ['--esbuild', '--experimental-bundlers'] });
30
30
 
31
+ // Used by sub-processes to detect this process dying
32
+ process.env.STARTUP_PARENT_PID = String(process.pid);
33
+
31
34
  const useTsc = this.args.useTsc;
32
35
 
33
36
  const packages = getPackages({
@@ -39,11 +42,13 @@ export class Start extends Command<typeof entry> {
39
42
  return;
40
43
  }
41
44
 
45
+ this.recordStart('start', { bundler: resolveBundler(this.args) });
46
+
42
47
  const scope = packages.map(({ name }) => name);
43
48
  const bundleScope = packages
44
49
  .filter(({ type }) => type === PackageType.Bundle)
45
50
  .map(({ name }) => name);
46
- const bundleCmd = getBundleCommand(this.args);
51
+ const bundlerArg = [`--bundler ${resolveBundler(this.args)}`];
47
52
  const precompileScope = packages
48
53
  .filter(({ scripts }) => !!scripts?.precompile)
49
54
  .map(({ name }) => name);
@@ -126,11 +131,11 @@ export class Start extends Command<typeof entry> {
126
131
  return Promise.resolve();
127
132
  }
128
133
  return lernaExec({
129
- 'cmd': bundleCmd,
134
+ 'cmd': 'startup bundle-package',
130
135
  'scope': bundleScope,
131
136
  'parallel': true,
132
137
  'stream': true,
133
- '--': ['--exposed-dependencies', '--use-watch-config'],
138
+ '--': ['--exposed-dependencies', '--use-watch-config', ...bundlerArg],
134
139
  });
135
140
  },
136
141
  { dependsOn: [StartProcesses.Compile, StartProcesses.PreparePackage] }
@@ -142,7 +147,7 @@ export class Start extends Command<typeof entry> {
142
147
  return Promise.resolve();
143
148
  }
144
149
  return lernaExec({
145
- 'cmd': bundleCmd,
150
+ 'cmd': 'startup bundle-package',
146
151
  'scope': bundleScope,
147
152
  'parallel': true,
148
153
  'stream': true,
@@ -150,12 +155,18 @@ export class Start extends Command<typeof entry> {
150
155
  '--watch',
151
156
  this.args.config ? `--config "${this.args.config}"` : undefined,
152
157
  this.args.codeCoverage ? '--code-coverage' : undefined,
158
+ ...bundlerArg,
153
159
  ].filter(item => !!item) as string[],
154
160
  });
155
161
  },
156
162
  { dependsOn: [StartProcesses.BundleExposedDependencies] }
157
163
  );
158
164
 
159
- await processTree.run();
165
+ try {
166
+ await processTree.run();
167
+ } catch (error) {
168
+ await this.recordEnd(error);
169
+ throw error;
170
+ }
160
171
  }
161
172
  }
@@ -56,10 +56,6 @@ export interface CommandEntry {
56
56
  options?: CommandOptions;
57
57
  }
58
58
 
59
- export abstract class Command<T extends CommandEntry = CommandEntry, U = unknown> {
60
- constructor(protected readonly args: InferArgs<NonNullable<T['options']>, U>) {}
61
-
62
- abstract execute(): Promise<void>;
63
- }
64
-
65
59
  export type Newable<T> = new (...args: any[]) => T;
60
+
61
+ export { Command } from './command';
package/src/cli/index.ts CHANGED
@@ -69,6 +69,9 @@ async function handleCommand(name: CommandName, argv: any) {
69
69
  const CommandClass = await entry.load();
70
70
  // eslint-disable-next-line @typescript-eslint/naming-convention
71
71
  const command = new CommandClass({ ...argv, _: argv._.slice(1) });
72
+
73
+ command.watchForParentExit(name);
74
+
72
75
  command.execute().catch(() => {
73
76
  process.exit(1);
74
77
  });