@servicetitan/startup 32.1.0 → 32.3.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 (253) hide show
  1. package/dist/cli/commands/build.d.ts +36 -7
  2. package/dist/cli/commands/build.d.ts.map +1 -1
  3. package/dist/cli/commands/build.js +35 -10
  4. package/dist/cli/commands/build.js.map +1 -1
  5. package/dist/cli/commands/bundle-package.d.ts +9 -10
  6. package/dist/cli/commands/bundle-package.d.ts.map +1 -1
  7. package/dist/cli/commands/bundle-package.js +6 -22
  8. package/dist/cli/commands/bundle-package.js.map +1 -1
  9. package/dist/cli/commands/clean.d.ts +2 -2
  10. package/dist/cli/commands/clean.d.ts.map +1 -1
  11. package/dist/cli/commands/clean.js +16 -4
  12. package/dist/cli/commands/clean.js.map +1 -1
  13. package/dist/cli/commands/convert-eslint-config.d.ts +2 -2
  14. package/dist/cli/commands/convert-eslint-config.d.ts.map +1 -1
  15. package/dist/cli/commands/convert-eslint-config.js +3 -4
  16. package/dist/cli/commands/convert-eslint-config.js.map +1 -1
  17. package/dist/cli/commands/eslint.d.ts +3 -5
  18. package/dist/cli/commands/eslint.d.ts.map +1 -1
  19. package/dist/cli/commands/eslint.js +2 -18
  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 +2 -0
  23. package/dist/cli/commands/get-command.js.map +1 -1
  24. package/dist/cli/commands/index.d.ts +0 -1
  25. package/dist/cli/commands/index.d.ts.map +1 -1
  26. package/dist/cli/commands/index.js +0 -1
  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 +9 -8
  31. package/dist/cli/commands/init.js.map +1 -1
  32. package/dist/cli/commands/install.d.ts +21 -7
  33. package/dist/cli/commands/install.d.ts.map +1 -1
  34. package/dist/cli/commands/install.js +33 -11
  35. package/dist/cli/commands/install.js.map +1 -1
  36. package/dist/cli/commands/kendo-ui-license.d.ts +3 -3
  37. package/dist/cli/commands/kendo-ui-license.d.ts.map +1 -1
  38. package/dist/cli/commands/kendo-ui-license.js +17 -5
  39. package/dist/cli/commands/kendo-ui-license.js.map +1 -1
  40. package/dist/cli/commands/lint.d.ts +31 -12
  41. package/dist/cli/commands/lint.d.ts.map +1 -1
  42. package/dist/cli/commands/lint.js +34 -13
  43. package/dist/cli/commands/lint.js.map +1 -1
  44. package/dist/cli/commands/mfe-list.d.ts +46 -0
  45. package/dist/cli/commands/mfe-list.d.ts.map +1 -0
  46. package/dist/cli/commands/mfe-list.js +200 -0
  47. package/dist/cli/commands/mfe-list.js.map +1 -0
  48. package/dist/cli/commands/mfe-package-clean.d.ts +29 -5
  49. package/dist/cli/commands/mfe-package-clean.d.ts.map +1 -1
  50. package/dist/cli/commands/mfe-package-clean.js +28 -5
  51. package/dist/cli/commands/mfe-package-clean.js.map +1 -1
  52. package/dist/cli/commands/mfe-package-publish.d.ts +37 -5
  53. package/dist/cli/commands/mfe-package-publish.d.ts.map +1 -1
  54. package/dist/cli/commands/mfe-package-publish.js +36 -5
  55. package/dist/cli/commands/mfe-package-publish.js.map +1 -1
  56. package/dist/cli/commands/mfe-publish.d.ts +17 -4
  57. package/dist/cli/commands/mfe-publish.d.ts.map +1 -1
  58. package/dist/cli/commands/mfe-publish.js +37 -7
  59. package/dist/cli/commands/mfe-publish.js.map +1 -1
  60. package/dist/cli/commands/prepare-package.d.ts +3 -5
  61. package/dist/cli/commands/prepare-package.d.ts.map +1 -1
  62. package/dist/cli/commands/prepare-package.js +2 -18
  63. package/dist/cli/commands/prepare-package.js.map +1 -1
  64. package/dist/cli/commands/review/review.d.ts +14 -6
  65. package/dist/cli/commands/review/review.d.ts.map +1 -1
  66. package/dist/cli/commands/review/review.js +27 -23
  67. package/dist/cli/commands/review/review.js.map +1 -1
  68. package/dist/cli/commands/run-task.d.ts +10 -6
  69. package/dist/cli/commands/run-task.d.ts.map +1 -1
  70. package/dist/cli/commands/run-task.js +16 -13
  71. package/dist/cli/commands/run-task.js.map +1 -1
  72. package/dist/cli/commands/start.d.ts +28 -7
  73. package/dist/cli/commands/start.d.ts.map +1 -1
  74. package/dist/cli/commands/start.js +27 -10
  75. package/dist/cli/commands/start.js.map +1 -1
  76. package/dist/cli/commands/styles-check.d.ts +2 -2
  77. package/dist/cli/commands/styles-check.d.ts.map +1 -1
  78. package/dist/cli/commands/styles-check.js +2 -1
  79. package/dist/cli/commands/styles-check.js.map +1 -1
  80. package/dist/cli/commands/test/runners/vitest.js +2 -1
  81. package/dist/cli/commands/test/runners/vitest.js.map +1 -1
  82. package/dist/cli/commands/test/tests.d.ts +14 -5
  83. package/dist/cli/commands/test/tests.d.ts.map +1 -1
  84. package/dist/cli/commands/test/tests.js +26 -13
  85. package/dist/cli/commands/test/tests.js.map +1 -1
  86. package/dist/cli/commands/types.d.ts +13 -4
  87. package/dist/cli/commands/types.d.ts.map +1 -1
  88. package/dist/cli/commands/types.js +28 -0
  89. package/dist/cli/commands/types.js.map +1 -1
  90. package/dist/cli/commands/upload-sourcemaps.d.ts +3 -5
  91. package/dist/cli/commands/upload-sourcemaps.d.ts.map +1 -1
  92. package/dist/cli/commands/upload-sourcemaps.js +5 -20
  93. package/dist/cli/commands/upload-sourcemaps.js.map +1 -1
  94. package/dist/cli/index.js +48 -39
  95. package/dist/cli/index.js.map +1 -1
  96. package/dist/cli/tasks/swc-compile-package.d.ts +2 -2
  97. package/dist/cli/tasks/swc-compile-package.d.ts.map +1 -1
  98. package/dist/cli/tasks/swc-compile-package.js.map +1 -1
  99. package/dist/cli/tasks/tsc-compile-package.d.ts +2 -2
  100. package/dist/cli/tasks/tsc-compile-package.d.ts.map +1 -1
  101. package/dist/cli/tasks/tsc-compile-package.js +1 -1
  102. package/dist/cli/tasks/tsc-compile-package.js.map +1 -1
  103. package/dist/cli/tasks/tsc-compile.d.ts +2 -2
  104. package/dist/cli/tasks/tsc-compile.d.ts.map +1 -1
  105. package/dist/cli/tasks/tsc-compile.js.map +1 -1
  106. package/dist/cli/utils/bundle.js +2 -2
  107. package/dist/cli/utils/bundle.js.map +1 -1
  108. package/dist/cli/utils/cli-npm.d.ts +14 -0
  109. package/dist/cli/utils/cli-npm.d.ts.map +1 -1
  110. package/dist/cli/utils/cli-npm.js +44 -0
  111. package/dist/cli/utils/cli-npm.js.map +1 -1
  112. package/dist/cli/utils/cli-os.d.ts +2 -2
  113. package/dist/cli/utils/cli-os.d.ts.map +1 -1
  114. package/dist/cli/utils/cli-os.js +13 -9
  115. package/dist/cli/utils/cli-os.js.map +1 -1
  116. package/dist/cli/utils/eslint.d.ts +2 -1
  117. package/dist/cli/utils/eslint.d.ts.map +1 -1
  118. package/dist/cli/utils/eslint.js.map +1 -1
  119. package/dist/cli/utils/index.d.ts +1 -0
  120. package/dist/cli/utils/index.d.ts.map +1 -1
  121. package/dist/cli/utils/index.js +1 -0
  122. package/dist/cli/utils/index.js.map +1 -1
  123. package/dist/cli/utils/is-tty.d.ts +2 -0
  124. package/dist/cli/utils/is-tty.d.ts.map +1 -0
  125. package/dist/cli/utils/is-tty.js +15 -0
  126. package/dist/cli/utils/is-tty.js.map +1 -0
  127. package/dist/cli/utils/maybe-create-git-folder.d.ts +1 -1
  128. package/dist/cli/utils/maybe-create-git-folder.d.ts.map +1 -1
  129. package/dist/cli/utils/maybe-create-git-folder.js +12 -6
  130. package/dist/cli/utils/maybe-create-git-folder.js.map +1 -1
  131. package/dist/cli/utils/process-tree.d.ts.map +1 -1
  132. package/dist/cli/utils/process-tree.js +2 -2
  133. package/dist/cli/utils/process-tree.js.map +1 -1
  134. package/dist/cli/utils/set-node-options.d.ts.map +1 -1
  135. package/dist/cli/utils/set-node-options.js +2 -1
  136. package/dist/cli/utils/set-node-options.js.map +1 -1
  137. package/dist/utils/find-packages.d.ts +1 -0
  138. package/dist/utils/find-packages.d.ts.map +1 -1
  139. package/dist/utils/find-packages.js.map +1 -1
  140. package/dist/utils/format-relative-date.d.ts +2 -0
  141. package/dist/utils/format-relative-date.d.ts.map +1 -0
  142. package/dist/utils/format-relative-date.js +60 -0
  143. package/dist/utils/format-relative-date.js.map +1 -0
  144. package/dist/utils/get-configuration.d.ts +10 -3
  145. package/dist/utils/get-configuration.d.ts.map +1 -1
  146. package/dist/utils/get-configuration.js +1 -0
  147. package/dist/utils/get-configuration.js.map +1 -1
  148. package/dist/utils/get-jest-config.d.ts.map +1 -1
  149. package/dist/utils/get-jest-config.js +20 -9
  150. package/dist/utils/get-jest-config.js.map +1 -1
  151. package/dist/utils/get-packages.d.ts +3 -5
  152. package/dist/utils/get-packages.d.ts.map +1 -1
  153. package/dist/utils/get-packages.js +1 -4
  154. package/dist/utils/get-packages.js.map +1 -1
  155. package/dist/utils/get-startup-version.d.ts.map +1 -1
  156. package/dist/utils/get-startup-version.js +1 -1
  157. package/dist/utils/get-startup-version.js.map +1 -1
  158. package/dist/utils/index.d.ts +2 -0
  159. package/dist/utils/index.d.ts.map +1 -1
  160. package/dist/utils/index.js +2 -0
  161. package/dist/utils/index.js.map +1 -1
  162. package/dist/utils/omit.d.ts +2 -0
  163. package/dist/utils/omit.d.ts.map +1 -0
  164. package/dist/utils/omit.js +28 -0
  165. package/dist/utils/omit.js.map +1 -0
  166. package/dist/webpack/configs/loaders/style-loader.d.ts +1 -1
  167. package/dist/webpack/configs/loaders/style-loader.d.ts.map +1 -1
  168. package/dist/webpack/configs/loaders/style-loader.js +2 -2
  169. package/dist/webpack/configs/loaders/style-loader.js.map +1 -1
  170. package/dist/webpack/configs/optimization-config.js +5 -5
  171. package/dist/webpack/configs/optimization-config.js.map +1 -1
  172. package/dist/webpack/configs/output-config.d.ts.map +1 -1
  173. package/dist/webpack/configs/output-config.js +14 -7
  174. package/dist/webpack/configs/output-config.js.map +1 -1
  175. package/dist/webpack/configs/plugins/assets-manifest-plugin.d.ts.map +1 -1
  176. package/dist/webpack/configs/plugins/assets-manifest-plugin.js +10 -3
  177. package/dist/webpack/configs/plugins/assets-manifest-plugin.js.map +1 -1
  178. package/package.json +26 -20
  179. package/src/cli/commands/__tests__/build.test.ts +1 -1
  180. package/src/cli/commands/__tests__/bundle-package.test.ts +22 -2
  181. package/src/cli/commands/__tests__/install.test.ts +42 -4
  182. package/src/cli/commands/__tests__/lint.test.ts +1 -1
  183. package/src/cli/commands/__tests__/mfe-list.test.ts +394 -0
  184. package/src/cli/commands/__tests__/mfe-publish.test.ts +25 -0
  185. package/src/cli/commands/__tests__/start.test.ts +1 -1
  186. package/src/cli/commands/build.ts +14 -10
  187. package/src/cli/commands/bundle-package.ts +19 -13
  188. package/src/cli/commands/clean.ts +2 -4
  189. package/src/cli/commands/convert-eslint-config.ts +3 -5
  190. package/src/cli/commands/eslint.ts +3 -5
  191. package/src/cli/commands/get-command.ts +2 -0
  192. package/src/cli/commands/index.ts +0 -1
  193. package/src/cli/commands/init.ts +7 -8
  194. package/src/cli/commands/install.ts +24 -11
  195. package/src/cli/commands/kendo-ui-license.ts +4 -6
  196. package/src/cli/commands/lint.ts +19 -19
  197. package/src/cli/commands/mfe-list.ts +173 -0
  198. package/src/cli/commands/mfe-package-clean.ts +25 -4
  199. package/src/cli/commands/mfe-package-publish.ts +33 -4
  200. package/src/cli/commands/mfe-publish.ts +37 -6
  201. package/src/cli/commands/prepare-package.ts +3 -5
  202. package/src/cli/commands/review/review.ts +9 -9
  203. package/src/cli/commands/run-task.ts +15 -11
  204. package/src/cli/commands/start.ts +12 -10
  205. package/src/cli/commands/styles-check.ts +2 -2
  206. package/src/cli/commands/test/__tests__/tests.test.ts +1 -1
  207. package/src/cli/commands/test/runners/__tests__/vitest.test.ts +82 -13
  208. package/src/cli/commands/test/runners/vitest.ts +4 -2
  209. package/src/cli/commands/test/tests.ts +20 -10
  210. package/src/cli/commands/types.ts +14 -4
  211. package/src/cli/commands/upload-sourcemaps.ts +3 -5
  212. package/src/cli/index.ts +59 -36
  213. package/src/cli/tasks/swc-compile-package.ts +2 -2
  214. package/src/cli/tasks/tsc-compile-package.ts +4 -3
  215. package/src/cli/tasks/tsc-compile.ts +2 -2
  216. package/src/cli/utils/__tests__/bundle.test.ts +13 -0
  217. package/src/cli/utils/__tests__/cli-npm.test.ts +89 -0
  218. package/src/cli/utils/__tests__/is-tty.test.ts +17 -0
  219. package/src/cli/utils/__tests__/maybe-create-git-folder.test.ts +10 -17
  220. package/src/cli/utils/__tests__/set-node-options.test.ts +10 -10
  221. package/src/cli/utils/bundle.ts +2 -2
  222. package/src/cli/utils/cli-npm.ts +34 -0
  223. package/src/cli/utils/cli-os.ts +12 -25
  224. package/src/cli/utils/eslint.ts +2 -1
  225. package/src/cli/utils/index.ts +1 -0
  226. package/src/cli/utils/is-tty.ts +3 -0
  227. package/src/cli/utils/maybe-create-git-folder.ts +10 -8
  228. package/src/cli/utils/process-tree.ts +4 -2
  229. package/src/cli/utils/set-node-options.ts +2 -1
  230. package/src/utils/__tests__/format-relative-date.test.ts +61 -0
  231. package/src/utils/__tests__/get-jest-config.test.ts +44 -0
  232. package/src/utils/__tests__/get-packages.test.ts +3 -0
  233. package/src/utils/find-packages.ts +1 -0
  234. package/src/utils/format-relative-date.ts +33 -0
  235. package/src/utils/get-configuration.ts +7 -2
  236. package/src/utils/get-jest-config.ts +36 -18
  237. package/src/utils/get-packages.ts +3 -9
  238. package/src/utils/get-startup-version.ts +1 -3
  239. package/src/utils/index.ts +2 -0
  240. package/src/utils/omit.ts +12 -0
  241. package/src/webpack/__mocks__/style-rules.ts +3 -3
  242. package/src/webpack/__tests__/create-webpack-config-shared-dependencies.test.ts +6 -14
  243. package/src/webpack/__tests__/create-webpack-config-web-component.test.ts +52 -29
  244. package/src/webpack/configs/loaders/style-loader.ts +5 -2
  245. package/src/webpack/configs/optimization-config.ts +5 -5
  246. package/src/webpack/configs/output-config.ts +10 -5
  247. package/src/webpack/configs/plugins/assets-manifest-plugin.ts +11 -4
  248. package/dist/cli/commands/get-user-commands.d.ts +0 -7
  249. package/dist/cli/commands/get-user-commands.d.ts.map +0 -1
  250. package/dist/cli/commands/get-user-commands.js +0 -27
  251. package/dist/cli/commands/get-user-commands.js.map +0 -1
  252. package/src/cli/commands/__tests__/get-user-commands.test.ts +0 -27
  253. package/src/cli/commands/get-user-commands.ts +0 -19
@@ -15,7 +15,7 @@ import {
15
15
  isLegacyRoot,
16
16
  isWebComponent,
17
17
  } from '../../utils';
18
- import { webComponentStyleRules } from '../__mocks__';
18
+ import { miniCssPluginStyleRules } from '../__mocks__';
19
19
  import { generateMetadata } from '../configs/utils';
20
20
  import { getCallerFile, splitByEntry } from '../utils';
21
21
 
@@ -119,6 +119,20 @@ describe(`[startup] ${createWebpackConfig.name}`, () => {
119
119
  const subject = () => createWebpackConfig(overrides, options);
120
120
 
121
121
  describe('when package is a web component', () => {
122
+ const baseCacheGroups = {
123
+ styles: {
124
+ name: 'main',
125
+ type: 'css/mini-extract',
126
+ chunks: 'all',
127
+ enforce: true,
128
+ },
129
+ servicetitan: {
130
+ name: 'servicetitan',
131
+ test: /[\\/]node_modules[\\/]@servicetitan[\\/]/,
132
+ chunks: 'all',
133
+ },
134
+ };
135
+
122
136
  beforeEach(() => jest.mocked(isWebComponent).mockReturnValue(true));
123
137
 
124
138
  test('configures MiniCssExtractPlugIn plugin', () => {
@@ -127,7 +141,7 @@ describe(`[startup] ${createWebpackConfig.name}`, () => {
127
141
  );
128
142
  });
129
143
 
130
- Object.entries(webComponentStyleRules).forEach(([extension, rule]) => {
144
+ Object.entries(miniCssPluginStyleRules).forEach(([extension, rule]) => {
131
145
  test(`configures "${extension}" rules`, () => {
132
146
  expect(subject().module?.rules).toContainEqual(rule);
133
147
  });
@@ -139,13 +153,9 @@ describe(`[startup] ${createWebpackConfig.name}`, () => {
139
153
  );
140
154
  });
141
155
 
142
- test('configures "optimization.splitChunks.cacheGroups.styles', () => {
143
- expect((subject().optimization?.splitChunks as any).cacheGroups.styles).toEqual({
144
- name: 'main',
145
- type: 'css/mini-extract',
146
- chunks: 'all',
147
- enforce: true,
148
- });
156
+ test('configures "optimization.splitChunks.cacheGroups', () => {
157
+ // @ts-expect-error because splitChunks is polymorphic
158
+ expect(subject().optimization?.splitChunks.cacheGroups).toEqual(baseCacheGroups);
149
159
  });
150
160
 
151
161
  test('configures WEB_COMPONENT_NAME', () => {
@@ -183,6 +193,25 @@ describe(`[startup] ${createWebpackConfig.name}`, () => {
183
193
  });
184
194
  });
185
195
 
196
+ test('WebpackAssetsManifest plugin moves design system css to precede other css', () => {
197
+ const assets = {
198
+ entrypoints: {
199
+ foo: {
200
+ assets: {
201
+ css: ['main.css', 'servicetitan.css', 'common.css'],
202
+ },
203
+ },
204
+ },
205
+ };
206
+
207
+ subject();
208
+
209
+ const transform: any = jest.mocked(WebpackAssetsManifest).mock.calls[0][0]?.transform;
210
+ expect(transform(assets)).toEqual(
211
+ expect.objectContaining({ css: ['servicetitan.css', 'main.css', 'common.css'] })
212
+ );
213
+ });
214
+
186
215
  test('generates metadata when WebpackAssetsManifest plugin is done', () => {
187
216
  subject();
188
217
 
@@ -373,27 +402,21 @@ describe(`[startup] ${createWebpackConfig.name}`, () => {
373
402
  expect(subject().devtool).toBe('source-map');
374
403
  });
375
404
 
376
- test('configures "optimization.splitChunks.cacheGroups"', () => {
405
+ test('adds "common" and "kendo" to "optimization.splitChunks.cacheGroups"', () => {
377
406
  // @ts-expect-error because splitChunks is polymorphic
378
- expect(subject().optimization?.splitChunks.cacheGroups).toEqual(
379
- expect.objectContaining({
380
- common: {
381
- name: 'common',
382
- test: /[\\/]node_modules[\\/](axios|classnames|formstate|mobx|mobx-react|mobx-utils|react|react-dom|react-router|react-router-dom)[\\/]/,
383
- chunks: 'all',
384
- },
385
- kendo: {
386
- name: 'kendo',
387
- test: /[\\/]node_modules[\\/](@progress|@telerik)[\\/]/,
388
- chunks: 'all',
389
- },
390
- servicetitan: {
391
- name: 'servicetitan',
392
- test: /[\\/]node_modules[\\/]@servicetitan[\\/]/,
393
- chunks: 'all',
394
- },
395
- })
396
- );
407
+ expect(subject().optimization?.splitChunks.cacheGroups).toEqual({
408
+ ...baseCacheGroups,
409
+ common: {
410
+ name: 'common',
411
+ test: /[\\/]node_modules[\\/](axios|classnames|formstate|mobx|mobx-react|mobx-utils|react|react-dom|react-router|react-router-dom)[\\/]/,
412
+ chunks: 'all',
413
+ },
414
+ kendo: {
415
+ name: 'kendo',
416
+ test: /[\\/]node_modules[\\/](@progress|@telerik)[\\/]/,
417
+ chunks: 'all',
418
+ },
419
+ });
397
420
  });
398
421
 
399
422
  test('configures "output.uniqueName"', () => {
@@ -3,9 +3,12 @@ import { Context } from '../types';
3
3
  import { LoaderOptions } from './types';
4
4
 
5
5
  export function styleLoader(
6
- { isProduction, isWebComponent }: Context,
6
+ { isProduction, isWebComponent, emitExposedDependencies }: Context,
7
7
  { esModule }: LoaderOptions = {}
8
8
  ) {
9
- const loader = isProduction || isWebComponent ? MiniCssExtractPlugin.loader : 'style-loader';
9
+ const loader =
10
+ isProduction || isWebComponent || emitExposedDependencies
11
+ ? MiniCssExtractPlugin.loader
12
+ : 'style-loader';
10
13
  return esModule ? { loader, options: { esModule } } : loader;
11
14
  }
@@ -88,6 +88,11 @@ function webComponentConfig(optimization: ConfigWithCacheGroups, context: Contex
88
88
  chunks: 'all',
89
89
  enforce: true,
90
90
  },
91
+ servicetitan: {
92
+ name: 'servicetitan',
93
+ test: /[\\/]node_modules[\\/]@servicetitan[\\/]/,
94
+ chunks: 'all',
95
+ },
91
96
  });
92
97
 
93
98
  if (!isProduction) {
@@ -105,10 +110,5 @@ function webComponentConfig(optimization: ConfigWithCacheGroups, context: Contex
105
110
  test: /[\\/]node_modules[\\/](@progress|@telerik)[\\/]/,
106
111
  chunks: 'all',
107
112
  },
108
- servicetitan: {
109
- name: 'servicetitan',
110
- test: /[\\/]node_modules[\\/]@servicetitan[\\/]/,
111
- chunks: 'all',
112
- },
113
113
  });
114
114
  }
@@ -12,18 +12,14 @@ export function outputConfig(context: Context, _: Overrides): Result {
12
12
  const output: Config = {
13
13
  filename: '[name].bundle.js',
14
14
  path: getOutputPath(context),
15
+ clean: getClean(context),
15
16
  ...(emitExposedDependencies ? { chunkLoadingGlobal: `sharedChunk${name}` } : {}),
16
17
  };
17
18
 
18
19
  if (isProduction) {
19
20
  const cdnPath = process.env.CLIENT_CDN_PATH;
20
- const exposedDependenciesDir = getBundleType({ ...context, emitExposedDependencies: true });
21
21
  Object.assign(output, {
22
22
  filename: '[name].[contenthash].bundle.js',
23
- clean:
24
- exposedDependenciesDir && !emitExposedDependencies
25
- ? { keep: new RegExp(exposedDependenciesDir) }
26
- : true,
27
23
  ...(isWebComponent ? { uniqueName: name } : {}),
28
24
  ...(cdnPath ? { publicPath: cdnPath } : {}),
29
25
  });
@@ -32,6 +28,15 @@ export function outputConfig(context: Context, _: Overrides): Result {
32
28
  return { output };
33
29
  }
34
30
 
31
+ function getClean(context: Context): NonNullable<Config>['clean'] {
32
+ const { emitExposedDependencies } = context;
33
+ if (emitExposedDependencies) {
34
+ return true;
35
+ }
36
+ const exposedDependenciesDir = getBundleType({ ...context, emitExposedDependencies: true });
37
+ return exposedDependenciesDir ? { keep: new RegExp(exposedDependenciesDir) } : true;
38
+ }
39
+
35
40
  function getOutputPath(context: Context) {
36
41
  const { destination, emitExposedDependencies } = context;
37
42
 
@@ -26,13 +26,13 @@ export function assetsManifestPlugin(context: Context, _: Overrides) {
26
26
  entrypoints: Record<string, { assets: Record<string, string[]> }>;
27
27
  }): EntryPoints {
28
28
  const getAssetsByType = (type: string) => {
29
- return Object.values(assets.entrypoints)
30
- .map(({ assets }) => assets[type] ?? [])
31
- .flat();
29
+ return Object.values(assets.entrypoints).flatMap(
30
+ ({ assets }) => assets[type] ?? []
31
+ );
32
32
  };
33
33
 
34
34
  return {
35
- css: getAssetsByType('css'),
35
+ css: ensureDesignSystemCssIsFirst(getAssetsByType('css')),
36
36
  js: getAssetsByType('js'),
37
37
  };
38
38
  },
@@ -47,6 +47,13 @@ export function assetsManifestPlugin(context: Context, _: Overrides) {
47
47
  });
48
48
  }
49
49
 
50
+ function ensureDesignSystemCssIsFirst(cssAssets: string[]) {
51
+ const offset = cssAssets.findIndex(name => name.startsWith('servicetitan'));
52
+ return offset > 0
53
+ ? [cssAssets[offset], ...cssAssets.filter((_, index) => index !== offset)]
54
+ : cssAssets;
55
+ }
56
+
50
57
  export function getExposedDependenciesEntryPoints(context: Context) {
51
58
  const metadataPath = getExposedDependenciesMetadataPath(context);
52
59
  const metadata = readJsonSafe<Metadata>(metadataPath);
@@ -1,7 +0,0 @@
1
- interface UserCommand {
2
- name: string;
3
- description: string;
4
- }
5
- export declare function getUserCommands(): UserCommand[];
6
- export {};
7
- //# sourceMappingURL=get-user-commands.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-user-commands.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/get-user-commands.ts"],"names":[],"mappings":"AAIA,UAAU,WAAW;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,eAAe,IAQwB,WAAW,EAAE,CACnE"}
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", {
3
- value: true
4
- });
5
- Object.defineProperty(exports, "getUserCommands", {
6
- enumerable: true,
7
- get: function() {
8
- return getUserCommands;
9
- }
10
- });
11
- const _utils = require("../../utils");
12
- const _getcommand = require("./get-command");
13
- function getUserCommands() {
14
- return Object.values(_utils.CommandName).sort((a, b)=>a.localeCompare(b)).map((name)=>{
15
- var _description, _this;
16
- const Command = (0, _getcommand.getCommand)(name);
17
- // eslint-disable-next-line @typescript-eslint/naming-convention
18
- return {
19
- name,
20
- description: (_description = (_this = new Command({
21
- _: []
22
- })).description) === null || _description === void 0 ? void 0 : _description.call(_this)
23
- };
24
- }).filter(({ description })=>!!description);
25
- }
26
-
27
- //# sourceMappingURL=get-user-commands.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/cli/commands/get-user-commands.ts"],"sourcesContent":["import { CommandName } from '../../utils';\n\nimport { getCommand } from './get-command';\n\ninterface UserCommand {\n name: string;\n description: string;\n}\n\nexport function getUserCommands() {\n return Object.values(CommandName)\n .sort((a, b) => a.localeCompare(b))\n .map(name => {\n const Command = getCommand(name)!;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n return { name, description: new Command({ _: [] }).description?.() };\n })\n .filter(({ description }) => !!description) as UserCommand[];\n}\n"],"names":["getUserCommands","Object","values","CommandName","sort","a","b","localeCompare","map","name","Command","getCommand","description","_","filter"],"mappings":";;;;+BASgBA;;;eAAAA;;;uBATY;4BAED;AAOpB,SAASA;IACZ,OAAOC,OAAOC,MAAM,CAACC,kBAAW,EAC3BC,IAAI,CAAC,CAACC,GAAGC,IAAMD,EAAEE,aAAa,CAACD,IAC/BE,GAAG,CAACC,CAAAA;YAG2B,cAAA;QAF5B,MAAMC,UAAUC,IAAAA,sBAAU,EAACF;QAC3B,gEAAgE;QAChE,OAAO;YAAEA;YAAMG,WAAW,GAAE,eAAA,CAAA,QAAA,IAAIF,QAAQ;gBAAEG,GAAG,EAAE;YAAC,IAAGD,WAAW,cAAlC,mCAAA,kBAAA;QAAuC;IACvE,GACCE,MAAM,CAAC,CAAC,EAAEF,WAAW,EAAE,GAAK,CAAC,CAACA;AACvC"}
@@ -1,27 +0,0 @@
1
- /**
2
- * @jest-environment node
3
- */
4
- import { CommandName } from '../../../utils';
5
- import { getCommand } from '../get-command';
6
- import { getUserCommands } from '../get-user-commands';
7
-
8
- describe(`${getUserCommands.name}`, () => {
9
- const subject = () => getUserCommands();
10
-
11
- test('returns commands with descriptions', () => {
12
- const descriptions = Object.values(CommandName)
13
- .map(name => {
14
- const Command = getCommand(name)!;
15
- // eslint-disable-next-line @typescript-eslint/naming-convention
16
- return new Command({ _: [] }).description?.();
17
- })
18
- .filter(description => !!description);
19
-
20
- expect(subject().length).toBe(descriptions.length);
21
- });
22
-
23
- test('returns commands in ascending order by name', () => {
24
- const names = subject().map(({ name }) => name);
25
- expect(names).toEqual([...names].sort((a, b) => a.localeCompare(b)));
26
- });
27
- });
@@ -1,19 +0,0 @@
1
- import { CommandName } from '../../utils';
2
-
3
- import { getCommand } from './get-command';
4
-
5
- interface UserCommand {
6
- name: string;
7
- description: string;
8
- }
9
-
10
- export function getUserCommands() {
11
- return Object.values(CommandName)
12
- .sort((a, b) => a.localeCompare(b))
13
- .map(name => {
14
- const Command = getCommand(name)!;
15
- // eslint-disable-next-line @typescript-eslint/naming-convention
16
- return { name, description: new Command({ _: [] }).description?.() };
17
- })
18
- .filter(({ description }) => !!description) as UserCommand[];
19
- }