@servicetitan/startup 32.2.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 (239) 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/tests.d.ts +14 -5
  81. package/dist/cli/commands/test/tests.d.ts.map +1 -1
  82. package/dist/cli/commands/test/tests.js +26 -13
  83. package/dist/cli/commands/test/tests.js.map +1 -1
  84. package/dist/cli/commands/types.d.ts +13 -4
  85. package/dist/cli/commands/types.d.ts.map +1 -1
  86. package/dist/cli/commands/types.js +28 -0
  87. package/dist/cli/commands/types.js.map +1 -1
  88. package/dist/cli/commands/upload-sourcemaps.d.ts +3 -5
  89. package/dist/cli/commands/upload-sourcemaps.d.ts.map +1 -1
  90. package/dist/cli/commands/upload-sourcemaps.js +5 -20
  91. package/dist/cli/commands/upload-sourcemaps.js.map +1 -1
  92. package/dist/cli/index.js +48 -39
  93. package/dist/cli/index.js.map +1 -1
  94. package/dist/cli/tasks/swc-compile-package.d.ts +2 -2
  95. package/dist/cli/tasks/swc-compile-package.d.ts.map +1 -1
  96. package/dist/cli/tasks/swc-compile-package.js.map +1 -1
  97. package/dist/cli/tasks/tsc-compile-package.d.ts +2 -2
  98. package/dist/cli/tasks/tsc-compile-package.d.ts.map +1 -1
  99. package/dist/cli/tasks/tsc-compile-package.js +1 -1
  100. package/dist/cli/tasks/tsc-compile-package.js.map +1 -1
  101. package/dist/cli/tasks/tsc-compile.d.ts +2 -2
  102. package/dist/cli/tasks/tsc-compile.d.ts.map +1 -1
  103. package/dist/cli/tasks/tsc-compile.js.map +1 -1
  104. package/dist/cli/utils/bundle.js +1 -1
  105. package/dist/cli/utils/bundle.js.map +1 -1
  106. package/dist/cli/utils/cli-npm.d.ts +14 -0
  107. package/dist/cli/utils/cli-npm.d.ts.map +1 -1
  108. package/dist/cli/utils/cli-npm.js +44 -0
  109. package/dist/cli/utils/cli-npm.js.map +1 -1
  110. package/dist/cli/utils/cli-os.d.ts +2 -2
  111. package/dist/cli/utils/cli-os.d.ts.map +1 -1
  112. package/dist/cli/utils/cli-os.js +13 -9
  113. package/dist/cli/utils/cli-os.js.map +1 -1
  114. package/dist/cli/utils/eslint.d.ts +2 -1
  115. package/dist/cli/utils/eslint.d.ts.map +1 -1
  116. package/dist/cli/utils/eslint.js.map +1 -1
  117. package/dist/cli/utils/index.d.ts +1 -0
  118. package/dist/cli/utils/index.d.ts.map +1 -1
  119. package/dist/cli/utils/index.js +1 -0
  120. package/dist/cli/utils/index.js.map +1 -1
  121. package/dist/cli/utils/is-tty.d.ts +2 -0
  122. package/dist/cli/utils/is-tty.d.ts.map +1 -0
  123. package/dist/cli/utils/is-tty.js +15 -0
  124. package/dist/cli/utils/is-tty.js.map +1 -0
  125. package/dist/cli/utils/maybe-create-git-folder.d.ts +1 -1
  126. package/dist/cli/utils/maybe-create-git-folder.d.ts.map +1 -1
  127. package/dist/cli/utils/maybe-create-git-folder.js +5 -5
  128. package/dist/cli/utils/maybe-create-git-folder.js.map +1 -1
  129. package/dist/cli/utils/process-tree.d.ts.map +1 -1
  130. package/dist/cli/utils/process-tree.js +2 -2
  131. package/dist/cli/utils/process-tree.js.map +1 -1
  132. package/dist/cli/utils/set-node-options.d.ts.map +1 -1
  133. package/dist/cli/utils/set-node-options.js +2 -1
  134. package/dist/cli/utils/set-node-options.js.map +1 -1
  135. package/dist/utils/find-packages.d.ts +1 -0
  136. package/dist/utils/find-packages.d.ts.map +1 -1
  137. package/dist/utils/find-packages.js.map +1 -1
  138. package/dist/utils/format-relative-date.d.ts +2 -0
  139. package/dist/utils/format-relative-date.d.ts.map +1 -0
  140. package/dist/utils/format-relative-date.js +60 -0
  141. package/dist/utils/format-relative-date.js.map +1 -0
  142. package/dist/utils/get-configuration.d.ts +1 -0
  143. package/dist/utils/get-configuration.d.ts.map +1 -1
  144. package/dist/utils/get-configuration.js +1 -0
  145. package/dist/utils/get-configuration.js.map +1 -1
  146. package/dist/utils/get-packages.d.ts +3 -5
  147. package/dist/utils/get-packages.d.ts.map +1 -1
  148. package/dist/utils/get-packages.js +1 -4
  149. package/dist/utils/get-packages.js.map +1 -1
  150. package/dist/utils/get-startup-version.d.ts.map +1 -1
  151. package/dist/utils/get-startup-version.js +1 -1
  152. package/dist/utils/get-startup-version.js.map +1 -1
  153. package/dist/utils/index.d.ts +1 -0
  154. package/dist/utils/index.d.ts.map +1 -1
  155. package/dist/utils/index.js +1 -0
  156. package/dist/utils/index.js.map +1 -1
  157. package/dist/webpack/configs/loaders/style-loader.d.ts +1 -1
  158. package/dist/webpack/configs/loaders/style-loader.d.ts.map +1 -1
  159. package/dist/webpack/configs/loaders/style-loader.js +2 -2
  160. package/dist/webpack/configs/loaders/style-loader.js.map +1 -1
  161. package/dist/webpack/configs/optimization-config.js +5 -5
  162. package/dist/webpack/configs/optimization-config.js.map +1 -1
  163. package/dist/webpack/configs/output-config.d.ts.map +1 -1
  164. package/dist/webpack/configs/output-config.js +14 -7
  165. package/dist/webpack/configs/output-config.js.map +1 -1
  166. package/dist/webpack/configs/plugins/assets-manifest-plugin.d.ts.map +1 -1
  167. package/dist/webpack/configs/plugins/assets-manifest-plugin.js +10 -3
  168. package/dist/webpack/configs/plugins/assets-manifest-plugin.js.map +1 -1
  169. package/package.json +9 -8
  170. package/src/cli/commands/__tests__/build.test.ts +1 -1
  171. package/src/cli/commands/__tests__/bundle-package.test.ts +22 -2
  172. package/src/cli/commands/__tests__/install.test.ts +42 -4
  173. package/src/cli/commands/__tests__/lint.test.ts +1 -1
  174. package/src/cli/commands/__tests__/mfe-list.test.ts +394 -0
  175. package/src/cli/commands/__tests__/mfe-publish.test.ts +25 -0
  176. package/src/cli/commands/__tests__/start.test.ts +1 -1
  177. package/src/cli/commands/build.ts +14 -10
  178. package/src/cli/commands/bundle-package.ts +19 -13
  179. package/src/cli/commands/clean.ts +2 -4
  180. package/src/cli/commands/convert-eslint-config.ts +3 -5
  181. package/src/cli/commands/eslint.ts +3 -5
  182. package/src/cli/commands/get-command.ts +2 -0
  183. package/src/cli/commands/index.ts +0 -1
  184. package/src/cli/commands/init.ts +7 -8
  185. package/src/cli/commands/install.ts +24 -11
  186. package/src/cli/commands/kendo-ui-license.ts +4 -6
  187. package/src/cli/commands/lint.ts +19 -19
  188. package/src/cli/commands/mfe-list.ts +173 -0
  189. package/src/cli/commands/mfe-package-clean.ts +25 -4
  190. package/src/cli/commands/mfe-package-publish.ts +33 -4
  191. package/src/cli/commands/mfe-publish.ts +37 -6
  192. package/src/cli/commands/prepare-package.ts +3 -5
  193. package/src/cli/commands/review/review.ts +9 -9
  194. package/src/cli/commands/run-task.ts +15 -11
  195. package/src/cli/commands/start.ts +12 -10
  196. package/src/cli/commands/styles-check.ts +2 -2
  197. package/src/cli/commands/test/__tests__/tests.test.ts +1 -1
  198. package/src/cli/commands/test/tests.ts +20 -10
  199. package/src/cli/commands/types.ts +14 -4
  200. package/src/cli/commands/upload-sourcemaps.ts +3 -5
  201. package/src/cli/index.ts +59 -36
  202. package/src/cli/tasks/swc-compile-package.ts +2 -2
  203. package/src/cli/tasks/tsc-compile-package.ts +4 -3
  204. package/src/cli/tasks/tsc-compile.ts +2 -2
  205. package/src/cli/utils/__tests__/bundle.test.ts +13 -0
  206. package/src/cli/utils/__tests__/cli-npm.test.ts +89 -0
  207. package/src/cli/utils/__tests__/is-tty.test.ts +17 -0
  208. package/src/cli/utils/__tests__/maybe-create-git-folder.test.ts +10 -17
  209. package/src/cli/utils/__tests__/set-node-options.test.ts +10 -10
  210. package/src/cli/utils/bundle.ts +1 -1
  211. package/src/cli/utils/cli-npm.ts +34 -0
  212. package/src/cli/utils/cli-os.ts +12 -25
  213. package/src/cli/utils/eslint.ts +2 -1
  214. package/src/cli/utils/index.ts +1 -0
  215. package/src/cli/utils/is-tty.ts +3 -0
  216. package/src/cli/utils/maybe-create-git-folder.ts +4 -7
  217. package/src/cli/utils/process-tree.ts +4 -2
  218. package/src/cli/utils/set-node-options.ts +2 -1
  219. package/src/utils/__tests__/format-relative-date.test.ts +61 -0
  220. package/src/utils/__tests__/get-packages.test.ts +3 -0
  221. package/src/utils/find-packages.ts +1 -0
  222. package/src/utils/format-relative-date.ts +33 -0
  223. package/src/utils/get-configuration.ts +1 -0
  224. package/src/utils/get-packages.ts +3 -9
  225. package/src/utils/get-startup-version.ts +1 -3
  226. package/src/utils/index.ts +1 -0
  227. package/src/webpack/__mocks__/style-rules.ts +3 -3
  228. package/src/webpack/__tests__/create-webpack-config-shared-dependencies.test.ts +6 -14
  229. package/src/webpack/__tests__/create-webpack-config-web-component.test.ts +52 -29
  230. package/src/webpack/configs/loaders/style-loader.ts +5 -2
  231. package/src/webpack/configs/optimization-config.ts +5 -5
  232. package/src/webpack/configs/output-config.ts +10 -5
  233. package/src/webpack/configs/plugins/assets-manifest-plugin.ts +11 -4
  234. package/dist/cli/commands/get-user-commands.d.ts +0 -7
  235. package/dist/cli/commands/get-user-commands.d.ts.map +0 -1
  236. package/dist/cli/commands/get-user-commands.js +0 -27
  237. package/dist/cli/commands/get-user-commands.js.map +0 -1
  238. package/src/cli/commands/__tests__/get-user-commands.test.ts +0 -27
  239. package/src/cli/commands/get-user-commands.ts +0 -19
@@ -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
- }