@servicetitan/startup 23.5.2 → 24.0.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 (174) hide show
  1. package/dist/cli/commands/build.d.ts.map +1 -1
  2. package/dist/cli/commands/build.js +4 -5
  3. package/dist/cli/commands/build.js.map +1 -1
  4. package/dist/cli/commands/bundle-package.js +1 -1
  5. package/dist/cli/commands/bundle-package.js.map +1 -1
  6. package/dist/cli/commands/eslint.js +1 -1
  7. package/dist/cli/commands/eslint.js.map +1 -1
  8. package/dist/cli/commands/init.js +2 -2
  9. package/dist/cli/commands/init.js.map +1 -1
  10. package/dist/cli/commands/install.js +1 -1
  11. package/dist/cli/commands/install.js.map +1 -1
  12. package/dist/cli/commands/kendo-ui-license.js +1 -1
  13. package/dist/cli/commands/kendo-ui-license.js.map +1 -1
  14. package/dist/cli/commands/lint.d.ts +1 -1
  15. package/dist/cli/commands/lint.d.ts.map +1 -1
  16. package/dist/cli/commands/lint.js +9 -11
  17. package/dist/cli/commands/lint.js.map +1 -1
  18. package/dist/cli/commands/mfe-publish.js +12 -9
  19. package/dist/cli/commands/mfe-publish.js.map +1 -1
  20. package/dist/cli/commands/prepare-package.js +1 -1
  21. package/dist/cli/commands/prepare-package.js.map +1 -1
  22. package/dist/cli/commands/start.d.ts.map +1 -1
  23. package/dist/cli/commands/start.js +5 -6
  24. package/dist/cli/commands/start.js.map +1 -1
  25. package/dist/cli/commands/styles-check.d.ts.map +1 -1
  26. package/dist/cli/commands/styles-check.js +3 -1
  27. package/dist/cli/commands/styles-check.js.map +1 -1
  28. package/dist/cli/commands/tests.js +1 -1
  29. package/dist/cli/commands/tests.js.map +1 -1
  30. package/dist/cli/index.js.map +1 -1
  31. package/dist/cli/utils/bundle.js +7 -6
  32. package/dist/cli/utils/bundle.js.map +1 -1
  33. package/dist/cli/utils/cli-npm.js.map +1 -1
  34. package/dist/cli/utils/cli-os.d.ts +1 -0
  35. package/dist/cli/utils/cli-os.d.ts.map +1 -1
  36. package/dist/cli/utils/cli-os.js.map +1 -1
  37. package/dist/cli/utils/eslint.js +3 -3
  38. package/dist/cli/utils/eslint.js.map +1 -1
  39. package/dist/cli/utils/get-module-type.js.map +1 -1
  40. package/dist/cli/utils/index.d.ts +1 -0
  41. package/dist/cli/utils/index.d.ts.map +1 -1
  42. package/dist/cli/utils/index.js +1 -0
  43. package/dist/cli/utils/index.js.map +1 -1
  44. package/dist/cli/utils/is-module-installed.js.map +1 -1
  45. package/dist/cli/utils/lerna-exec.d.ts +11 -0
  46. package/dist/cli/utils/lerna-exec.d.ts.map +1 -0
  47. package/dist/cli/utils/lerna-exec.js +47 -0
  48. package/dist/cli/utils/lerna-exec.js.map +1 -0
  49. package/dist/cli/utils/publish.js.map +1 -1
  50. package/dist/cli/utils/set-node-options.js.map +1 -1
  51. package/dist/cli/utils/tcm.js +2 -2
  52. package/dist/cli/utils/tcm.js.map +1 -1
  53. package/dist/cli/utils/tsc.js +2 -2
  54. package/dist/cli/utils/tsc.js.map +1 -1
  55. package/dist/utils/get-configuration.d.ts +3 -3
  56. package/dist/utils/get-configuration.d.ts.map +1 -1
  57. package/dist/utils/get-configuration.js +1 -1
  58. package/dist/utils/get-configuration.js.map +1 -1
  59. package/dist/utils/get-destination-folders.js.map +1 -1
  60. package/dist/utils/get-folders.js.map +1 -1
  61. package/dist/utils/get-package-data.js.map +1 -1
  62. package/dist/utils/get-packages.js +1 -1
  63. package/dist/utils/get-packages.js.map +1 -1
  64. package/dist/utils/load-shared-dependencies.d.ts.map +1 -1
  65. package/dist/utils/load-shared-dependencies.js +1 -0
  66. package/dist/utils/load-shared-dependencies.js.map +1 -1
  67. package/dist/utils/log.js.map +1 -1
  68. package/dist/utils/read-json.js.map +1 -1
  69. package/dist/utils/to-array.js.map +1 -1
  70. package/dist/webpack/__mocks__/style-rules.d.ts +1 -1
  71. package/dist/webpack/__mocks__/style-rules.d.ts.map +1 -1
  72. package/dist/webpack/__mocks__/style-rules.js.map +1 -1
  73. package/dist/webpack/configs/amd-config.d.ts +1 -1
  74. package/dist/webpack/configs/amd-config.d.ts.map +1 -1
  75. package/dist/webpack/configs/cache-config.d.ts +1 -1
  76. package/dist/webpack/configs/cache-config.d.ts.map +1 -1
  77. package/dist/webpack/configs/cache-config.js.map +1 -1
  78. package/dist/webpack/configs/dev-server-config.d.ts +1 -1
  79. package/dist/webpack/configs/dev-server-config.d.ts.map +1 -1
  80. package/dist/webpack/configs/dev-server-config.js.map +1 -1
  81. package/dist/webpack/configs/devtool-config.d.ts +1 -1
  82. package/dist/webpack/configs/devtool-config.d.ts.map +1 -1
  83. package/dist/webpack/configs/devtool-config.js.map +1 -1
  84. package/dist/webpack/configs/entry.config.d.ts +1 -1
  85. package/dist/webpack/configs/entry.config.d.ts.map +1 -1
  86. package/dist/webpack/configs/entry.config.js.map +1 -1
  87. package/dist/webpack/configs/externals-config.d.ts +1 -1
  88. package/dist/webpack/configs/externals-config.d.ts.map +1 -1
  89. package/dist/webpack/configs/externals-config.js.map +1 -1
  90. package/dist/webpack/configs/module-config.d.ts +1 -1
  91. package/dist/webpack/configs/module-config.d.ts.map +1 -1
  92. package/dist/webpack/configs/optimization-config.d.ts +1 -1
  93. package/dist/webpack/configs/optimization-config.d.ts.map +1 -1
  94. package/dist/webpack/configs/optimization-config.js +6 -0
  95. package/dist/webpack/configs/optimization-config.js.map +1 -1
  96. package/dist/webpack/configs/output-config.d.ts +1 -1
  97. package/dist/webpack/configs/output-config.d.ts.map +1 -1
  98. package/dist/webpack/configs/output-config.js.map +1 -1
  99. package/dist/webpack/configs/plugins/assets-manifest-plugin.js.map +1 -1
  100. package/dist/webpack/configs/plugins/bundle-analyser-plugin.js.map +1 -1
  101. package/dist/webpack/configs/plugins/define-exposed-dependencies-plugin.js.map +1 -1
  102. package/dist/webpack/configs/plugins/define-web-component-name-plugin.js.map +1 -1
  103. package/dist/webpack/configs/plugins/filter-warnings-plugin.js.map +1 -1
  104. package/dist/webpack/configs/plugins/html-plugin.js.map +1 -1
  105. package/dist/webpack/configs/plugins/ignore-plugin/check-resource.js.map +1 -1
  106. package/dist/webpack/configs/plugins/mini-css-extract-plugin.js.map +1 -1
  107. package/dist/webpack/configs/plugins/provide-react-plugin.js.map +1 -1
  108. package/dist/webpack/configs/plugins/ts-checker-plugin.js.map +1 -1
  109. package/dist/webpack/configs/plugins/virtual-modules-plugin.js +2 -2
  110. package/dist/webpack/configs/plugins/virtual-modules-plugin.js.map +1 -1
  111. package/dist/webpack/configs/plugins-config.d.ts +1 -1
  112. package/dist/webpack/configs/plugins-config.d.ts.map +1 -1
  113. package/dist/webpack/configs/resolve-config.d.ts +1 -1
  114. package/dist/webpack/configs/resolve-config.d.ts.map +1 -1
  115. package/dist/webpack/configs/rules/css-rules.d.ts.map +1 -1
  116. package/dist/webpack/configs/rules/css-rules.js +5 -4
  117. package/dist/webpack/configs/rules/css-rules.js.map +1 -1
  118. package/dist/webpack/configs/rules/svg-rules.js +4 -4
  119. package/dist/webpack/configs/rules/svg-rules.js.map +1 -1
  120. package/dist/webpack/configs/rules/tsx-rules.js.map +1 -1
  121. package/dist/webpack/configs/rules-config.d.ts +1 -1
  122. package/dist/webpack/configs/rules-config.d.ts.map +1 -1
  123. package/dist/webpack/configs/rules-config.js +1 -0
  124. package/dist/webpack/configs/rules-config.js.map +1 -1
  125. package/dist/webpack/configs/stats-config.d.ts +1 -1
  126. package/dist/webpack/configs/stats-config.d.ts.map +1 -1
  127. package/dist/webpack/configs/utils/generate-metadata.js.map +1 -1
  128. package/dist/webpack/create-webpack-config.js.map +1 -1
  129. package/dist/webpack/loaders/expose-loader/index.js.map +1 -1
  130. package/dist/webpack/loaders/expose-loader/runtime/get-global-this.js.map +1 -1
  131. package/dist/webpack/loaders/expose-loader/utils/contextify-request.js.map +1 -1
  132. package/dist/webpack/loaders/expose-loader/utils/stringify-request.js.map +1 -1
  133. package/dist/webpack/utils/bundle.js.map +1 -1
  134. package/dist/webpack/utils/feature-cohort.js.map +1 -1
  135. package/dist/webpack/utils/get-caller-filename.js.map +1 -1
  136. package/dist/webpack/utils/split-by-entry.js.map +1 -1
  137. package/dist/webpack/utils/testing/compile.js.map +1 -1
  138. package/dist/webpack/utils/testing/get-compiler.js.map +1 -1
  139. package/dist/webpack/utils/testing/get-module-source.js.map +1 -1
  140. package/dist/webpack/utils/testing/normalize-errors.js.map +1 -1
  141. package/dist/webpack/utils/testing/read-asset.js.map +1 -1
  142. package/package.json +27 -28
  143. package/src/cli/commands/__tests__/build.test.ts +10 -12
  144. package/src/cli/commands/__tests__/init.test.ts +1 -1
  145. package/src/cli/commands/__tests__/kendo-ui-license.test.ts +1 -3
  146. package/src/cli/commands/__tests__/lint.test.ts +5 -7
  147. package/src/cli/commands/__tests__/mfe-publish.test.ts +8 -8
  148. package/src/cli/commands/__tests__/start.test.ts +9 -11
  149. package/src/cli/commands/__tests__/styles-check.test.ts +19 -5
  150. package/src/cli/commands/build.ts +4 -6
  151. package/src/cli/commands/lint.ts +10 -15
  152. package/src/cli/commands/mfe-publish.ts +4 -4
  153. package/src/cli/commands/start.ts +5 -7
  154. package/src/cli/commands/styles-check.ts +7 -1
  155. package/src/cli/utils/__tests__/bundle.test.ts +4 -4
  156. package/src/cli/utils/__tests__/cli-os.test.ts +1 -1
  157. package/src/cli/utils/__tests__/lerna-exec.test.ts +64 -0
  158. package/src/cli/utils/index.ts +1 -0
  159. package/src/cli/utils/lerna-exec.ts +37 -0
  160. package/src/utils/__tests__/get-configuration.test.ts +1 -1
  161. package/src/utils/__tests__/log.test.ts +3 -3
  162. package/src/utils/load-shared-dependencies.ts +1 -0
  163. package/src/webpack/__tests__/create-webpack-config-shared-dependencies.test.ts +9 -1
  164. package/src/webpack/__tests__/create-webpack-config-web-component.test.ts +2 -2
  165. package/src/webpack/configs/optimization-config.ts +6 -0
  166. package/src/webpack/configs/plugins/virtual-modules-plugin.ts +4 -2
  167. package/src/webpack/configs/rules/css-rules.ts +9 -5
  168. package/src/webpack/configs/rules-config.ts +1 -0
  169. package/src/webpack/utils/testing/get-compiler.ts +1 -1
  170. package/template-react18/packages/application/package.json +3 -3
  171. package/template-react18/packages/feature-a/package.json +3 -3
  172. package/template-react18/packages/feature-b/package.json +3 -3
  173. package/template-react18/packages/feature-c/package.json +3 -3
  174. package/tsconfig/base.json +3 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servicetitan/startup",
3
- "version": "23.5.2",
3
+ "version": "24.0.0",
4
4
  "description": "",
5
5
  "homepage": "https://docs.st.dev/docs/frontend/startup",
6
6
  "repository": {
@@ -27,70 +27,69 @@
27
27
  "@types/cpx": "~1.5.2",
28
28
  "@types/eslint": "~8.56.3",
29
29
  "@types/less": "~3.0.3",
30
- "@types/mini-css-extract-plugin": "~2.4.0",
31
30
  "@types/moment-locales-webpack-plugin": "~1.2.2",
32
31
  "@types/sass": "~1.43.1",
33
- "@types/webpack-assets-manifest": "~5.1.0",
32
+ "@types/webpack-assets-manifest": "~5.1.4",
34
33
  "@types/webpack-dev-server": "~3.11.5",
35
34
  "@types/yargs": "~17.0.24"
36
35
  },
37
36
  "dependencies": {
38
- "@babel/preset-env": "~7.24.5",
37
+ "@babel/preset-env": "~7.24.6",
39
38
  "@jest/core": "~29.7.0",
40
39
  "@jest/types": "~29.6.3",
41
- "@lerna/exec": "~5.6.2",
42
- "@servicetitan/eslint-config": "23.5.2",
43
- "@servicetitan/stylelint-config": "23.5.2",
40
+ "@servicetitan/eslint-config": "24.0.0",
41
+ "@servicetitan/stylelint-config": "24.0.0",
44
42
  "@svgr/webpack": "^8.1.0",
45
- "@swc/core": "1.5.0",
43
+ "@swc/core": "1.5.7",
46
44
  "@types/debug": "^4.1.12",
47
45
  "@types/jest": "~29.5.12",
48
46
  "chalk": "~4.1.2",
49
47
  "chokidar": "~3.6.0",
50
48
  "cpx": "~1.5.0",
51
- "css-loader": "~6.10.0",
49
+ "css-loader": "~7.1.2",
52
50
  "debug": "^4.3.4",
53
51
  "deepmerge": "~4.3.1",
54
52
  "esbuild-loader": "~4.1.0",
55
53
  "eslint": "~8.57.0",
56
54
  "execa": "~5.1.1",
57
55
  "fork-ts-checker-webpack-plugin": "~9.0.2",
58
- "glob": "~10.3.12",
56
+ "glob": "~10.4.1",
59
57
  "html-webpack-plugin": "~5.6.0",
60
58
  "identity-obj-proxy": "~3.0.0",
61
59
  "jest": "~29.7.0",
62
60
  "jest-circus": "~29.7.0",
63
61
  "jest-environment-jsdom": "^29.7.0",
64
62
  "jest-fetch-mock": "~3.0.3",
65
- "lerna": "~5.6.2",
63
+ "lerna": "~8.1.3",
66
64
  "less": "~4.2.0",
67
65
  "less-loader": "~12.2.0",
68
66
  "less-plugin-npm-import": "~2.1.0",
69
67
  "memfs": "~4.9.2",
70
- "mini-css-extract-plugin": "~2.7.6",
68
+ "mini-css-extract-plugin": "~2.9.0",
71
69
  "moment": "^2.30.1",
72
70
  "moment-locales-webpack-plugin": "~1.2.0",
73
71
  "portfinder": "~1.0.32",
72
+ "postcss": "~8.4.38",
74
73
  "prettier": "~2.7.1",
75
- "sass": "~1.66.1",
76
- "sass-loader": "~12.6.0",
77
- "source-map-loader": "~3.0.1",
78
- "style-loader": "~3.3.3",
74
+ "sass": "~1.77.2",
75
+ "sass-loader": "~14.2.1",
76
+ "source-map-loader": "~5.0.0",
77
+ "style-loader": "~4.0.0",
79
78
  "stylelint": "~14.16.1",
80
- "swc-loader": "0.2.3",
81
- "ts-jest": "~29.1.2",
82
- "ts-loader": "~9.4.4",
83
- "ts-node": "~10.9.1",
84
- "typed-css-modules": "~0.8.1",
85
- "typescript": "~4.7.4",
79
+ "swc-loader": "0.2.6",
80
+ "ts-jest": "~29.1.4",
81
+ "ts-loader": "~9.5.1",
82
+ "ts-node": "~10.9.2",
83
+ "typed-css-modules": "~0.9.1",
84
+ "typescript": "~5.4.5",
86
85
  "username": "~5.1.0",
87
- "webpack": "~5.78.0",
88
- "webpack-assets-manifest": "~5.1.0",
89
- "webpack-bundle-analyzer": "^4.9.0",
86
+ "webpack": "~5.91.0",
87
+ "webpack-assets-manifest": "~5.2.1",
88
+ "webpack-bundle-analyzer": "^4.10.2",
90
89
  "webpack-dev-server": "~3.11.2",
91
90
  "webpack-filter-warnings-plugin": "~1.2.1",
92
- "webpack-merge": "~5.9.0",
93
- "webpack-virtual-modules": "~0.5.0",
91
+ "webpack-merge": "~5.10.0",
92
+ "webpack-virtual-modules": "~0.6.1",
94
93
  "worker-loader": "~3.0.8",
95
94
  "xhr-mock": "~2.5.1",
96
95
  "yargs": "~17.7.2"
@@ -101,5 +100,5 @@
101
100
  "cli": {
102
101
  "webpack": false
103
102
  },
104
- "gitHead": "db3072704335e30ef5cfc943cd1efa2538949512"
103
+ "gitHead": "7cd2407a9025cfb84bddbd1241eaa7fd40311cb8"
105
104
  }
@@ -1,18 +1,16 @@
1
- const exec = require('@lerna/exec');
2
1
  import { Package, PackageType, getPackages } from '../../../utils';
3
2
  import { createPackage } from '../../../__mocks__';
4
- import { tsc } from '../../utils';
3
+ import { lernaExec, tsc } from '../../utils';
5
4
  import { kendoUILicense } from '../kendo-ui-license';
6
5
 
7
6
  import { Build } from '../build';
8
7
 
9
- jest.mock('@lerna/exec', () => jest.fn());
10
8
  jest.mock('../../../utils', () => ({
11
9
  ...jest.requireActual('../../../utils'),
12
10
  getPackages: jest.fn(),
13
11
  }));
14
- jest.mock('../../utils', () => ({ tsc: jest.fn() }));
15
- jest.mock('../kendo-ui-license', () => ({ kendoUILicense: jest.fn() }));
12
+ jest.mock('../../utils');
13
+ jest.mock('../kendo-ui-license');
16
14
 
17
15
  describe(`[startup] ${Build.name}`, () => {
18
16
  let args: ConstructorParameters<typeof Build>[0];
@@ -31,7 +29,7 @@ describe(`[startup] ${Build.name}`, () => {
31
29
  test('prepares the package', async () => {
32
30
  await subject();
33
31
 
34
- expect(exec).toHaveBeenCalledWith({
32
+ expect(lernaExec).toHaveBeenCalledWith({
35
33
  cmd: 'startup prepare-package',
36
34
  scope: packages.map(({ name }) => name),
37
35
  stream: true,
@@ -65,7 +63,7 @@ describe(`[startup] ${Build.name}`, () => {
65
63
  test('bundles the package', async () => {
66
64
  await subject();
67
65
 
68
- expect(exec).toHaveBeenCalledWith({
66
+ expect(lernaExec).toHaveBeenCalledWith({
69
67
  'cmd': 'startup bundle-package',
70
68
  'scope': packages.map(({ name }) => name),
71
69
  'stream': true,
@@ -79,7 +77,7 @@ describe(`[startup] ${Build.name}`, () => {
79
77
  test('enables code-coverage', async () => {
80
78
  await subject();
81
79
 
82
- expect(exec).toHaveBeenCalledWith(
80
+ expect(lernaExec).toHaveBeenCalledWith(
83
81
  expect.objectContaining({
84
82
  '--': ['--code-coverage'],
85
83
  })
@@ -93,7 +91,7 @@ describe(`[startup] ${Build.name}`, () => {
93
91
  test('enables esbuild loader', async () => {
94
92
  await subject();
95
93
 
96
- expect(exec).toHaveBeenCalledWith(
94
+ expect(lernaExec).toHaveBeenCalledWith(
97
95
  expect.objectContaining({
98
96
  '--': ['--esbuild'],
99
97
  })
@@ -107,7 +105,7 @@ describe(`[startup] ${Build.name}`, () => {
107
105
  test('enables swc-loader', async () => {
108
106
  await subject();
109
107
 
110
- expect(exec).toHaveBeenCalledWith(
108
+ expect(lernaExec).toHaveBeenCalledWith(
111
109
  expect.objectContaining({
112
110
  '--': ['--experimental-bundlers'],
113
111
  })
@@ -121,7 +119,7 @@ describe(`[startup] ${Build.name}`, () => {
121
119
  test('generates build report', async () => {
122
120
  await subject();
123
121
 
124
- expect(exec).toHaveBeenCalledWith(
122
+ expect(lernaExec).toHaveBeenCalledWith(
125
123
  expect.objectContaining({
126
124
  '--': ['--stat'],
127
125
  })
@@ -135,7 +133,7 @@ describe(`[startup] ${Build.name}`, () => {
135
133
  test('uses specified config file', async () => {
136
134
  await subject();
137
135
 
138
- expect(exec).toHaveBeenCalledWith(
136
+ expect(lernaExec).toHaveBeenCalledWith(
139
137
  expect.objectContaining({ '--': [`--config "${args.config}"`] })
140
138
  );
141
139
  });
@@ -68,7 +68,7 @@ describe(`[startup] ${Init.name}`, () => {
68
68
  beforeEach(() => vol.fromJSON({ [args.output!]: '' }));
69
69
 
70
70
  test('raises error', async () => {
71
- await expect(subject()).rejects.toThrowError(/is not a directory/);
71
+ await expect(subject()).rejects.toThrow(/is not a directory/);
72
72
  });
73
73
  });
74
74
  });
@@ -75,9 +75,7 @@ describe(`${kendoUILicense.name}`, () => {
75
75
  beforeEach(() => (execa as any).mockRejectedValue({ exitCode }));
76
76
 
77
77
  test('throws error', async () => {
78
- await expect(subject()).rejects.toThrowError(
79
- `command failed with exit code ${exitCode}`
80
- );
78
+ await expect(subject()).rejects.toThrow(`command failed with exit code ${exitCode}`);
81
79
  });
82
80
  });
83
81
  });
@@ -1,13 +1,11 @@
1
- const lernaExec = require('@lerna/exec');
2
1
  import { Lint } from '../lint';
3
- import { eslint } from '../../utils';
2
+ import { eslint, lernaExec } from '../../utils';
4
3
  import { getPackages } from '../../../utils';
5
4
 
6
- jest.mock('@lerna/exec', () => jest.fn());
7
- jest.mock('execa', () => jest.fn());
5
+ jest.mock('execa');
8
6
  jest.mock('stylelint', () => ({ lint: jest.fn(() => ({ output: '' })) }));
9
7
 
10
- jest.mock('../../utils', () => ({ eslint: jest.fn() }));
8
+ jest.mock('../../utils');
11
9
  jest.mock('../../../utils', () => ({
12
10
  log: { info: jest.fn() },
13
11
  getConfiguration: jest.fn(() => ({})),
@@ -57,7 +55,7 @@ describe(`[startup] ${Lint.name}`, () => {
57
55
  });
58
56
 
59
57
  function itRunsLernaExec() {
60
- test('runs @lerna/exec instead of eslint', async () => {
58
+ test('runs lernaExec instead of eslint', async () => {
61
59
  await subject();
62
60
 
63
61
  expect(eslint).not.toHaveBeenCalled();
@@ -82,7 +80,7 @@ describe(`[startup] ${Lint.name}`, () => {
82
80
  await subject();
83
81
 
84
82
  expect(lernaExec).toHaveBeenCalledWith(
85
- expect.objectContaining({ args: ['--fix'] })
83
+ expect.objectContaining({ '--': ['--fix'] })
86
84
  );
87
85
  });
88
86
  });
@@ -1,12 +1,12 @@
1
- const exec = require('@lerna/exec');
2
1
  import { fs, vol } from 'memfs';
2
+ import { lernaExec } from '../../utils';
3
3
  import { Package, PackageType, getPackages } from '../../../utils';
4
4
  import { createPackage } from '../../../__mocks__';
5
5
 
6
6
  import { MFEPublish } from '../mfe-publish';
7
7
 
8
8
  jest.mock('fs', () => fs);
9
- jest.mock('@lerna/exec', () => jest.fn());
9
+ jest.mock('../../utils');
10
10
  jest.mock('../../../utils', () => ({
11
11
  ...jest.requireActual('../../../utils'),
12
12
  getPackages: jest.fn(),
@@ -69,7 +69,7 @@ describe(`[startup] ${MFEPublish.name}`, () => {
69
69
  test('publishes the package', async () => {
70
70
  await subject();
71
71
 
72
- expect(exec).toHaveBeenCalledWith({
72
+ expect(lernaExec).toHaveBeenCalledWith({
73
73
  'cmd': 'startup mfe-package-publish',
74
74
  'scope': packages.map(({ name }) => name),
75
75
  'stream': true,
@@ -89,7 +89,7 @@ describe(`[startup] ${MFEPublish.name}`, () => {
89
89
  test('cleans the package', async () => {
90
90
  await subject();
91
91
 
92
- expect(exec).toHaveBeenCalledWith(
92
+ expect(lernaExec).toHaveBeenCalledWith(
93
93
  expect.objectContaining({ cmd: 'startup mfe-package-clean' })
94
94
  );
95
95
  });
@@ -113,7 +113,7 @@ describe(`[startup] ${MFEPublish.name}`, () => {
113
113
  test(`runs publish with "${expected ?? `--${name} ${value}`}"`, async () => {
114
114
  await subject();
115
115
 
116
- expect(exec).toHaveBeenCalledWith(
116
+ expect(lernaExec).toHaveBeenCalledWith(
117
117
  expect.objectContaining({ '--': [expected ?? `--${name} ${value}`] })
118
118
  );
119
119
  });
@@ -139,7 +139,7 @@ describe(`[startup] ${MFEPublish.name}`, () => {
139
139
  test('publishes the packages', async () => {
140
140
  await subject();
141
141
 
142
- expect(exec).toHaveBeenCalledWith(
142
+ expect(lernaExec).toHaveBeenCalledWith(
143
143
  expect.objectContaining({ scope: packages.map(({ name }) => name) })
144
144
  );
145
145
  });
@@ -150,7 +150,7 @@ describe(`[startup] ${MFEPublish.name}`, () => {
150
150
  test('publishes specified packages', async () => {
151
151
  await subject();
152
152
 
153
- expect(exec).toHaveBeenCalledWith(
153
+ expect(lernaExec).toHaveBeenCalledWith(
154
154
  expect.objectContaining({ scope: [packages[0].name] })
155
155
  );
156
156
  });
@@ -162,7 +162,7 @@ describe(`[startup] ${MFEPublish.name}`, () => {
162
162
  test('publishes the specified packages', async () => {
163
163
  await subject();
164
164
 
165
- expect(exec).toHaveBeenCalledWith(
165
+ expect(lernaExec).toHaveBeenCalledWith(
166
166
  expect.objectContaining({
167
167
  scope: packages.slice(1).map(({ name }) => name),
168
168
  })
@@ -1,16 +1,14 @@
1
- const exec = require('@lerna/exec');
2
1
  import { Package, PackageType, getPackages } from '../../../utils';
3
2
  import { createPackage } from '../../../__mocks__';
4
- import { tsc, tscWatch } from '../../utils';
3
+ import { lernaExec, tsc, tscWatch } from '../../utils';
5
4
 
6
5
  import { Start } from '../start';
7
6
 
8
- jest.mock('@lerna/exec', () => jest.fn());
9
7
  jest.mock('../../../utils', () => ({
10
8
  ...jest.requireActual('../../../utils'),
11
9
  getPackages: jest.fn(),
12
10
  }));
13
- jest.mock('../../utils', () => ({ tsc: jest.fn(), tscWatch: jest.fn() }));
11
+ jest.mock('../../utils');
14
12
 
15
13
  describe(`[startup] ${Start.name}`, () => {
16
14
  let args: ConstructorParameters<typeof Start>[0];
@@ -29,13 +27,13 @@ describe(`[startup] ${Start.name}`, () => {
29
27
  test('prepares the package, then again in watch mode', async () => {
30
28
  await subject();
31
29
 
32
- expect(exec).toHaveBeenCalledWith({
30
+ expect(lernaExec).toHaveBeenCalledWith({
33
31
  cmd: 'startup prepare-package',
34
32
  scope: packages.map(({ name }) => name),
35
33
  stream: true,
36
34
  });
37
35
 
38
- expect(exec).toHaveBeenCalledWith({
36
+ expect(lernaExec).toHaveBeenCalledWith({
39
37
  'cmd': 'startup prepare-package',
40
38
  'scope': packages.map(({ name }) => name),
41
39
  'parallel': true,
@@ -66,7 +64,7 @@ describe(`[startup] ${Start.name}`, () => {
66
64
  test('bundles the package in watch mode', async () => {
67
65
  await subject();
68
66
 
69
- expect(exec).toHaveBeenCalledWith({
67
+ expect(lernaExec).toHaveBeenCalledWith({
70
68
  'cmd': 'startup bundle-package',
71
69
  'scope': packages.map(({ name }) => name),
72
70
  'parallel': true,
@@ -81,7 +79,7 @@ describe(`[startup] ${Start.name}`, () => {
81
79
  test('enables code-coverage', async () => {
82
80
  await subject();
83
81
 
84
- expect(exec).toHaveBeenCalledWith(
82
+ expect(lernaExec).toHaveBeenCalledWith(
85
83
  expect.objectContaining({
86
84
  '--': ['--watch', '--code-coverage'],
87
85
  })
@@ -95,7 +93,7 @@ describe(`[startup] ${Start.name}`, () => {
95
93
  test('enables esbuild loader', async () => {
96
94
  await subject();
97
95
 
98
- expect(exec).toHaveBeenCalledWith(
96
+ expect(lernaExec).toHaveBeenCalledWith(
99
97
  expect.objectContaining({
100
98
  '--': ['--watch', '--esbuild'],
101
99
  })
@@ -109,7 +107,7 @@ describe(`[startup] ${Start.name}`, () => {
109
107
  test('enables swc-loader', async () => {
110
108
  await subject();
111
109
 
112
- expect(exec).toHaveBeenCalledWith(
110
+ expect(lernaExec).toHaveBeenCalledWith(
113
111
  expect.objectContaining({
114
112
  '--': ['--watch', '--experimental-bundlers'],
115
113
  })
@@ -123,7 +121,7 @@ describe(`[startup] ${Start.name}`, () => {
123
121
  test('uses specified config', async () => {
124
122
  await subject();
125
123
 
126
- expect(exec).toHaveBeenCalledWith(
124
+ expect(lernaExec).toHaveBeenCalledWith(
127
125
  expect.objectContaining({
128
126
  '--': ['--watch', `--config "${args.config}"`],
129
127
  })
@@ -2,10 +2,12 @@ import { fs, vol } from 'memfs';
2
2
  import path from 'path';
3
3
  import {
4
4
  getFolders,
5
+ getPackageData,
5
6
  isBundle,
6
7
  isLegacy,
7
8
  isStyleCheckDisabled,
8
9
  isWebComponent,
10
+ loadSharedDependencies,
9
11
  log,
10
12
  } from '../../../utils';
11
13
 
@@ -15,10 +17,12 @@ jest.mock('fs', () => fs);
15
17
  jest.mock('../../../utils', () => ({
16
18
  ...jest.requireActual('../../../utils'),
17
19
  getFolders: jest.fn(),
20
+ getPackageData: jest.fn(),
18
21
  isBundle: jest.fn(),
19
22
  isLegacy: jest.fn(),
20
23
  isStyleCheckDisabled: jest.fn(),
21
24
  isWebComponent: jest.fn(),
25
+ loadSharedDependencies: jest.fn(),
22
26
  log: { error: jest.fn(), info: jest.fn(), warning: jest.fn() },
23
27
  }));
24
28
 
@@ -29,16 +33,26 @@ describe(`[startup] ${StylesCheck.name}`, () => {
29
33
  jest.resetAllMocks();
30
34
  jest.mocked(isBundle).mockReturnValue(true);
31
35
  jest.mocked(getFolders).mockReturnValue({ source: 'src', destination: 'dist' });
36
+ jest.mocked(getPackageData).mockReturnValue({ dependencies: {}, sharedDependencies: {} });
37
+ jest.mocked(loadSharedDependencies).mockReturnValue({});
32
38
  });
33
39
 
34
40
  afterEach(() => vol.reset());
35
41
 
36
- test("warns that application doesn't have design-system.css", async () => {
37
- await subject();
42
+ describe('when application has design-system as a dependency', () => {
43
+ beforeEach(() => {
44
+ jest.mocked(loadSharedDependencies).mockReturnValue({
45
+ '@servicetitan/design-system': '1.0.0',
46
+ });
47
+ });
38
48
 
39
- expect(log.warning).toHaveBeenCalledWith(
40
- expect.stringContaining("application doesn't have design-system.css")
41
- );
49
+ test("warns that application doesn't have design-system.css", async () => {
50
+ await subject();
51
+
52
+ expect(log.warning).toHaveBeenCalledWith(
53
+ expect.stringContaining("application doesn't have design-system.css")
54
+ );
55
+ });
42
56
  });
43
57
 
44
58
  describe('with a legacy package', () => {
@@ -1,7 +1,5 @@
1
- const exec = require('@lerna/exec');
2
-
3
1
  import { getPackages, logErrors, PackageType, splitPackagesByType } from '../../utils';
4
- import { tsc } from '../utils';
2
+ import { lernaExec, tsc } from '../utils';
5
3
  import { Command, kendoUILicense } from '.';
6
4
 
7
5
  interface Args {
@@ -33,7 +31,7 @@ export class Build implements Command {
33
31
  }
34
32
 
35
33
  if (packagesWithPreparation.length) {
36
- await exec({
34
+ await lernaExec({
37
35
  cmd: 'startup prepare-package',
38
36
  scope: packagesWithPreparation.map(({ name }) => name),
39
37
  stream: true,
@@ -46,7 +44,7 @@ export class Build implements Command {
46
44
 
47
45
  if (packages[PackageType.Webpack].length) {
48
46
  await kendoUILicense();
49
- await exec({
47
+ await lernaExec({
50
48
  'cmd': 'startup bundle-package',
51
49
  'scope': packages[PackageType.Webpack].map(({ name }) => name),
52
50
  'stream': true,
@@ -56,7 +54,7 @@ export class Build implements Command {
56
54
  ...[this.args.esbuild ? '--esbuild' : undefined],
57
55
  ...[this.args['experimental-bundlers'] ? '--experimental-bundlers' : undefined],
58
56
  ...[this.args.stat ? '--stat' : undefined],
59
- ].filter(item => item),
57
+ ].filter(item => !!item) as string[],
60
58
  });
61
59
  }
62
60
  }
@@ -10,9 +10,7 @@ import {
10
10
  logErrors,
11
11
  } from '../../utils';
12
12
  import { Command } from '.';
13
- import { eslint } from '../utils';
14
-
15
- const exec = require('@lerna/exec');
13
+ import { eslint, lernaExec } from '../utils';
16
14
 
17
15
  interface Args {
18
16
  // eslint-disable-next-line @typescript-eslint/naming-convention
@@ -23,7 +21,7 @@ interface Args {
23
21
  scope?: string | string[];
24
22
  /** Packages to skip */
25
23
  ignore?: string | string[];
26
- /** Use \@lerna/exec to run eslint separately for each package? */
24
+ /** Run eslint separately for each package? */
27
25
  isolated?: boolean;
28
26
  }
29
27
 
@@ -45,10 +43,9 @@ export class Lint implements Command {
45
43
  const { fix, ignore, isolated, scope } = this.args;
46
44
  const { paths } = this;
47
45
 
48
- log.info('Running the eslint...');
49
-
50
46
  const useESLint = !isolated && !scope?.length && !ignore?.length;
51
47
  if (this.paths.length || useESLint) {
48
+ log.info('Running eslint...');
52
49
  await eslint({ fix, paths });
53
50
  return;
54
51
  }
@@ -56,11 +53,11 @@ export class Lint implements Command {
56
53
  const packages = getPackages({ scope, ignore });
57
54
  const args = fix ? ['--fix'] : [];
58
55
 
59
- await exec({
60
- cmd: 'startup eslint',
61
- scope: packages.map(({ name }) => name),
62
- bail: false,
63
- args,
56
+ await lernaExec({
57
+ 'cmd': 'startup eslint',
58
+ 'scope': packages.map(({ name }) => name),
59
+ 'bail': false,
60
+ '--': args,
64
61
  });
65
62
  }
66
63
 
@@ -74,7 +71,7 @@ export class Lint implements Command {
74
71
  const { fix } = this.args;
75
72
  const { paths } = this;
76
73
 
77
- log.info('Running the stylelint...');
74
+ log.info('Running stylelint...');
78
75
  const allowedExtensions = ['css', 'scss', 'less'];
79
76
  const glob = `**/*.{${allowedExtensions.join(',')}}`;
80
77
  let files = paths.reduce((result, path) => {
@@ -112,11 +109,9 @@ export class Lint implements Command {
112
109
  private async checkStyles() {
113
110
  const { ignore, scope } = this.args;
114
111
 
115
- log.info('Running the style check...');
116
-
117
112
  const packages = getPackages({ ignore, scope });
118
113
 
119
- await exec({
114
+ await lernaExec({
120
115
  cmd: 'startup styles-check',
121
116
  scope: packages.map(({ name }) => name),
122
117
  stream: true,
@@ -1,5 +1,4 @@
1
- const exec = require('@lerna/exec');
2
- const path = require('path');
1
+ import path from 'path';
3
2
 
4
3
  import {
5
4
  getPackages,
@@ -10,6 +9,7 @@ import {
10
9
  isWebComponent,
11
10
  log,
12
11
  } from '../../utils';
12
+ import { lernaExec } from '../utils';
13
13
  import { gitGetBranch, gitGetCommitHash } from '../utils/cli-git';
14
14
  import {
15
15
  npmGetPackageVersionDates,
@@ -65,7 +65,7 @@ export class MFEPublish implements Command {
65
65
  throw new Error('no packages found for publication');
66
66
  }
67
67
 
68
- await exec({
68
+ await lernaExec({
69
69
  'cmd': `startup mfe-package-${this.args.clean ? 'clean' : 'publish'}`,
70
70
  'scope': packages.map(({ name }) => name),
71
71
  'stream': true,
@@ -78,7 +78,7 @@ export class MFEPublish implements Command {
78
78
  ...[this.args.force ? '--force' : undefined],
79
79
  ...[this.args.count ? `--count ${this.args.count}` : undefined],
80
80
  ...[this.args.registry ? `--registry ${this.args.registry}` : undefined],
81
- ].filter(item => item),
81
+ ].filter(item => !!item) as string[],
82
82
  });
83
83
  }
84
84
  }
@@ -1,7 +1,5 @@
1
- const exec = require('@lerna/exec');
2
-
3
1
  import { getPackages, logErrors, PackageType, splitPackagesByType } from '../../utils';
4
- import { tsc, tscWatch } from '../utils';
2
+ import { lernaExec, tsc, tscWatch } from '../utils';
5
3
  import { Command } from '.';
6
4
 
7
5
  interface Args {
@@ -27,7 +25,7 @@ export class Start implements Command {
27
25
  ];
28
26
 
29
27
  if (packagesWithPreparation.length) {
30
- await exec({
28
+ await lernaExec({
31
29
  cmd: 'startup prepare-package',
32
30
  scope: packagesWithPreparation.map(({ name }) => name),
33
31
  stream: true,
@@ -41,7 +39,7 @@ export class Start implements Command {
41
39
  await Promise.all([
42
40
  ...(packagesWithPreparation.length
43
41
  ? [
44
- exec({
42
+ lernaExec({
45
43
  'cmd': 'startup prepare-package',
46
44
  'scope': packagesWithPreparation.map(({ name }) => name),
47
45
  'parallel': true,
@@ -53,7 +51,7 @@ export class Start implements Command {
53
51
  ...(packages[PackageType.TSC].length ? [tscWatch(packages[PackageType.TSC])] : []),
54
52
  ...(packages[PackageType.Webpack].length
55
53
  ? [
56
- exec({
54
+ lernaExec({
57
55
  'cmd': 'startup bundle-package',
58
56
  'scope': packages[PackageType.Webpack].map(({ name }) => name),
59
57
  'parallel': true,
@@ -66,7 +64,7 @@ export class Start implements Command {
66
64
  this.args['experimental-bundlers']
67
65
  ? '--experimental-bundlers'
68
66
  : undefined,
69
- ].filter(item => item),
67
+ ].filter(item => !!item) as string[],
70
68
  }),
71
69
  ]
72
70
  : []),
@@ -3,10 +3,12 @@ import path from 'path';
3
3
  import process from 'process';
4
4
  import {
5
5
  getFolders,
6
+ getPackageData,
6
7
  isBundle,
7
8
  isLegacy,
8
9
  isStyleCheckDisabled,
9
10
  isWebComponent,
11
+ loadSharedDependencies,
10
12
  log,
11
13
  } from '../../utils';
12
14
  import { Command } from './index';
@@ -101,7 +103,11 @@ function checkStylesLib(_files: FileInfo[]) {
101
103
  }
102
104
 
103
105
  function checkStylesApp(files: FileInfo[]) {
104
- if (!files.some(f => f.relativePath === designSystem)) {
106
+ const { dependencies, sharedDependencies } = getPackageData();
107
+ if (
108
+ loadSharedDependencies(dependencies, sharedDependencies)['@servicetitan/design-system'] &&
109
+ !files.some(f => f.relativePath === designSystem)
110
+ ) {
105
111
  log.warning(
106
112
  "application doesn't have design-system.css. Please check https://docs.st.dev/docs/frontend/micro-frontends#host-configuration"
107
113
  );