@servicetitan/docs-uikit 36.1.1-beta.1 → 36.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.
- package/docs/BREAKING_CHANGES.mdx +2 -2
- package/docs/ai-marketplace.mdx +93 -0
- package/docs/eslint-config.mdx +78 -0
- package/docs/eslint-plugin.mdx +172 -0
- package/docs/install.mdx +70 -5
- package/docs/launchdarkly-service.mdx +49 -4
- package/docs/lazy-module.mdx +1 -1
- package/docs/microfrontends/hosting.mdx +4 -6
- package/docs/microfrontends/sharing-dependencies.mdx +17 -15
- package/docs/startup/build.mdx +310 -0
- package/docs/startup/clean.mdx +1 -1
- package/docs/startup/review.mdx +15 -11
- package/docs/startup/start.mdx +73 -0
- package/docs/startup/startup.mdx +5 -40
- package/package.json +3 -2
- package/docs/startup/build/build.mdx +0 -199
- package/docs/startup/build/vite.mdx +0 -255
- package/docs/startup/build/webpack.mdx +0 -117
- package/docs/startup/start/start.mdx +0 -48
- package/docs/startup/start/vite.mdx +0 -90
- package/docs/startup/start/webpack.mdx +0 -39
|
@@ -27,11 +27,7 @@ By default, MFEs and hosts share the following dependencies (see [here](https://
|
|
|
27
27
|
MFE's are not required to use all the default dependencies; `startup` and `Loader` ignore any that aren't used.
|
|
28
28
|
:::
|
|
29
29
|
|
|
30
|
-
To customize which dependencies are shared, set `cli.shared-dependencies` to an object that maps dependencies to `SharedDependencies.{name}`. By convention `{name}` is the camel-cased package name.
|
|
31
|
-
|
|
32
|
-
:::note
|
|
33
|
-
In versions before **[INSERT-VERSION-HERE]**, this setting was under `cli.webpack.shared-dependencies`. The old location still works for backward compatibility.
|
|
34
|
-
:::
|
|
30
|
+
To customize which dependencies are shared, set `cli.webpack.shared-dependencies` to an object that maps dependencies to `SharedDependencies.{name}`. By convention `{name}` is the camel-cased package name.
|
|
35
31
|
|
|
36
32
|
- Use the special **defaults** key with the empty string to incorporate the default list.
|
|
37
33
|
- To exclude a default dependency, map it to the empty string.
|
|
@@ -43,9 +39,11 @@ To add a dependency, use the special **defaults** key to first include the defau
|
|
|
43
39
|
```json title="package.json"
|
|
44
40
|
{
|
|
45
41
|
"cli": {
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
|
|
42
|
+
"webpack": {
|
|
43
|
+
"shared-dependencies": {
|
|
44
|
+
"defaults": "", // add default list
|
|
45
|
+
"lodash": "SharedDependencies.Lodash" // add lodash
|
|
46
|
+
}
|
|
49
47
|
}
|
|
50
48
|
}
|
|
51
49
|
}
|
|
@@ -67,9 +65,11 @@ To omit an default dependency, map it to the empty string. For example, to omit
|
|
|
67
65
|
```json title="package.json"
|
|
68
66
|
{
|
|
69
67
|
"cli": {
|
|
70
|
-
"
|
|
71
|
-
"
|
|
72
|
-
|
|
68
|
+
"webpack": {
|
|
69
|
+
"shared-dependencies": {
|
|
70
|
+
"defaults": "", // add default list
|
|
71
|
+
"@servicetitan/design-system": "" // drop @servicetitan/design-system
|
|
72
|
+
}
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -82,10 +82,12 @@ To completely customize the list of shared dependencies, omit the **defaults** k
|
|
|
82
82
|
```json title="package.json"
|
|
83
83
|
{
|
|
84
84
|
"cli": {
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
|
|
88
|
-
|
|
85
|
+
"webpack": {
|
|
86
|
+
"shared-dependencies": {
|
|
87
|
+
"@servicetitan/anvil2": "SharedDependencies.ServiceTitan.Anvil2",
|
|
88
|
+
"react": "SharedDependencies.React",
|
|
89
|
+
"react-dom": "SharedDependencies.ReactDOM"
|
|
90
|
+
}
|
|
89
91
|
}
|
|
90
92
|
}
|
|
91
93
|
}
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: build
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Build packages for production to the `dist/bundle` folders. It bundles them in production mode and optimizes the build for the best performance. The builds are minified and the filenames include the hashes. Apps are ready to be deployed.
|
|
6
|
+
|
|
7
|
+
## Options
|
|
8
|
+
|
|
9
|
+
| Option | Description |
|
|
10
|
+
| :----------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
11
|
+
| `--scope <glob>` | Include only packages with names matching the given glob. |
|
|
12
|
+
| `--ignore <glob>` | Exclude packages with names matching the given glob. |
|
|
13
|
+
| `--cdn-path <url>` | Specify the base path for all the assets within the application. |
|
|
14
|
+
| `--stat` | Generate bundle report with [webpack-bundle-analyzer](https://github.com/webpack-contrib/webpack-bundle-analyzer). Starting `v22.3.0` works for [MFEs](../microfrontends) too. |
|
|
15
|
+
| `--code-coverage` | Add [instrumentation](https://github.com/JS-DevTools/coverage-istanbul-loader) to bundled code in order to collect code coverage |
|
|
16
|
+
| `--use-tsc` | Use TSC for TypeScript compilation |
|
|
17
|
+
|
|
18
|
+
## Build Steps
|
|
19
|
+
|
|
20
|
+
The `build` command executes these steps:
|
|
21
|
+
|
|
22
|
+
1. Activate Kendo UI license.
|
|
23
|
+
1. Run package **precompile** scripts, if any.
|
|
24
|
+
1. Compile Typescript.
|
|
25
|
+
1. Generate TypeScript definitions from CSS, LESS, and SASS modules, and copy assets and style files to the output folder.
|
|
26
|
+
1. Run type check via [TypeScript project references](https://www.typescriptlang.org/docs/handbook/project-references.html).
|
|
27
|
+
1. Bundle application and MFE packages.
|
|
28
|
+
|
|
29
|
+
:::note
|
|
30
|
+
`startup` doesn't support dependencies between the Webpack bundles.
|
|
31
|
+
:::
|
|
32
|
+
|
|
33
|
+
### Precompile Script
|
|
34
|
+
|
|
35
|
+
✨ New in **v34.0.0** ✨
|
|
36
|
+
|
|
37
|
+
The `build` command runs the `precompile` script defined in each package's `package.json` before compiling TypeScript. This allows packages to execute custom setup tasks during the build process. If a package doesn't define a `precompile` script, this step is skipped.
|
|
38
|
+
|
|
39
|
+
## Package Setup
|
|
40
|
+
|
|
41
|
+
Because `startup` compiles and builds in separate steps, packages must export compiled Javascript instead of the TypeScript source files. E.g.,
|
|
42
|
+
|
|
43
|
+
```json title="package.json"
|
|
44
|
+
{
|
|
45
|
+
"exports": "./dist/index.js",
|
|
46
|
+
"main": "./dist/index.js",
|
|
47
|
+
"typings": "./dist/index.d.ts"
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
And, to ensure packages are compiled in the correct order, [TypeScript project references](https://www.typescriptlang.org/docs/handbook/project-references.html) must accurately describe the dependencies between packages. E.g.,
|
|
52
|
+
|
|
53
|
+
```json title="tsconfig.json"
|
|
54
|
+
{
|
|
55
|
+
"references": [
|
|
56
|
+
{ "path": "../component-a" },
|
|
57
|
+
{ "path": "../component-b" },
|
|
58
|
+
{ "path": "../component-c" }
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
:::note
|
|
64
|
+
The Webpack documentation suggests using a configuration that enters through `./src/index.ts`, and using `ts-loader` to process `.ts` and `.tsx` files. However, because `startup` precompiles Typescript, this is redundant and webpack must be configured to load the compiled Javascript.
|
|
65
|
+
:::
|
|
66
|
+
|
|
67
|
+
## CSS Modules
|
|
68
|
+
|
|
69
|
+
`Startup` supports [CSS Modules](https://github.com/css-modules/css-modules) alongside regular stylesheets using the `[name].module.{css,less,scss}` file naming convention. CSS Modules provide locally scoped class names that prevent global CSS collisions, making styles more predictable and easier to refactor.
|
|
70
|
+
|
|
71
|
+
## SVG Transformation
|
|
72
|
+
|
|
73
|
+
By default, SVGs are loaded as assets. Depending on the file size, the asset is converted to a base64 URI string, or emitted as separate file. E.g.,
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
import MySVG from './my.svg';
|
|
77
|
+
|
|
78
|
+
function MyImage() {
|
|
79
|
+
return <img src={MySVG} />;
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Importing SVGs as React Components
|
|
84
|
+
|
|
85
|
+
By default `startup` imports SVGs from `@servicetitan/anvil2` as React components. E.g.,
|
|
86
|
+
|
|
87
|
+
```tsx
|
|
88
|
+
import { Button } from '@servicetitan/anvil2';
|
|
89
|
+
import CheckIcon from '@servicetitan/anvil2/assets/icons/material/round/check.svg';
|
|
90
|
+
|
|
91
|
+
export function CheckButton() {
|
|
92
|
+
return <Button icon={CheckIcon} />;
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
To import SVGs from other sources as React components, append `?component` to the import statement. E.g.,
|
|
97
|
+
|
|
98
|
+
```tsx
|
|
99
|
+
import { Button } from '@servicetitan/anvil2';
|
|
100
|
+
import CheckIcon from './assets/check.svg?component';
|
|
101
|
+
|
|
102
|
+
export function CheckButton() {
|
|
103
|
+
return <Button icon={CheckIcon} />;
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Importing Anvil 2 SVGs as Assets
|
|
108
|
+
|
|
109
|
+
By default `startup` imports SVGs from `@servicetitan/anvil2` as React components.
|
|
110
|
+
To import an Anvil 2 SVG as an asset, append `?asset` to the import statement. E.g.,
|
|
111
|
+
|
|
112
|
+
```tsx
|
|
113
|
+
import CheckIcon from '@servicetitan/anvil2/assets/icons/material/round/check.svg?asset';
|
|
114
|
+
|
|
115
|
+
function CheckImage() {
|
|
116
|
+
return <img src={CheckIcon} />;
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Configuration
|
|
121
|
+
|
|
122
|
+
### Library Packages
|
|
123
|
+
|
|
124
|
+
Set `cli.webpack` to `false` to disable Webpack for non-application packages, such as component and utility libraries.
|
|
125
|
+
|
|
126
|
+
```json title="package.json"
|
|
127
|
+
{
|
|
128
|
+
"cli": {
|
|
129
|
+
"webpack": false
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Type Checking
|
|
135
|
+
|
|
136
|
+
Use package-specific `tsconfig.json` and `tsconfig.build.json` files to set or override type checking options. E.g.,
|
|
137
|
+
|
|
138
|
+
```json title="tsconfig.json"
|
|
139
|
+
{
|
|
140
|
+
"extends": "@servicetitan/startup/tsconfig/base",
|
|
141
|
+
"compilerOptions": {
|
|
142
|
+
"outDir": "dist",
|
|
143
|
+
"rootDir": "src"
|
|
144
|
+
// Other type checking options (https://www.typescriptlang.org/tsconfig/)
|
|
145
|
+
},
|
|
146
|
+
"include": ["src/**/*"]
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Use `tsconfig.build.json` that extends from `tsconfig.json` to exclude tests, stories, and mocks from type checking. E.g.,
|
|
151
|
+
|
|
152
|
+
```json title="tsconfig.build.json"
|
|
153
|
+
{
|
|
154
|
+
"extends": "./tsconfig.json",
|
|
155
|
+
"exclude": ["**/__tests__/*", "**/*.test.*", "**/__mocks__/*", "**/*.stories.*"],
|
|
156
|
+
"references": [
|
|
157
|
+
{ "path": "../feature-a" },
|
|
158
|
+
{ "path": "../feature-b" },
|
|
159
|
+
{ "path": "../feature-c" }
|
|
160
|
+
]
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
:::caution
|
|
165
|
+
Project references must be duplicated in `tsconfig.build.json` because [references are not inherited](https://github.com/microsoft/TypeScript/issues/27098).
|
|
166
|
+
:::
|
|
167
|
+
|
|
168
|
+
### TypeScript Compilation (SWC)
|
|
169
|
+
|
|
170
|
+
:::info
|
|
171
|
+
`Startup` only maps a subset of TypeScript settings from `tsconfig.json` to SWC options. See [cliOptions](https://github.com/search?q=repo%3Aservicetitan%2Fuikit+%22cliOptions%3A%22+-path%3A**%2F*.test.ts&type=code) and [swcOptions](https://github.com/search?q=repo%3Aservicetitan%2Fuikit+%22swcOptions%3A%22+-path%3A**%2F*.test.ts&type=code) for the details.
|
|
172
|
+
:::
|
|
173
|
+
|
|
174
|
+
Use `cli.swc-compile-package` to set or override SWC options. E.g.,
|
|
175
|
+
|
|
176
|
+
```json title="package.json"
|
|
177
|
+
{
|
|
178
|
+
"cli": {
|
|
179
|
+
"swc-compile-package": {
|
|
180
|
+
"cliOptions": {
|
|
181
|
+
// CLI options (https://swc.rs/docs/usage/cli)
|
|
182
|
+
},
|
|
183
|
+
"swcOptions": {
|
|
184
|
+
// Compilation options (https://swc.rs/docs/configuration/compilation)
|
|
185
|
+
// Module options (https://swc.rs/docs/configuration/modules)
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### TypeScript Compilation (TSC)
|
|
193
|
+
|
|
194
|
+
:::caution
|
|
195
|
+
Compilation via TSC is deprecated.
|
|
196
|
+
:::
|
|
197
|
+
|
|
198
|
+
Use package-specific `tsconfig.json` and `tsconfig.build.json` files to set or override compiler options. See [Type checking](#type-checking) for more information.
|
|
199
|
+
|
|
200
|
+
### Minimization
|
|
201
|
+
|
|
202
|
+
By default `startup` configures webpack to minimize production bundles conservatively,
|
|
203
|
+
so that projects gain the benefits of reduced bundle sizes while retaining the highest
|
|
204
|
+
fidelity for source map debugging.
|
|
205
|
+
It uses [TerserWebpackPlugin](https://webpack.js.org/plugins/terser-webpack-plugin) to minimize JS bundles
|
|
206
|
+
and [CssMinimizerWebpackPlugin](https://webpack.js.org/plugins/css-minimizer-webpack-plugin)
|
|
207
|
+
to minimize CSS bundles.
|
|
208
|
+
|
|
209
|
+
- To turn off minimizing, set `cli.webpack.minify.js` or `cli.webpack.minify.css`, or both, to `false`.
|
|
210
|
+
- To override the default Terser options set `cli.webpack.minify.js` to an object containing
|
|
211
|
+
[`terserOptions`](https://webpack.js.org/plugins/terser-webpack-plugin/#terseroptions).
|
|
212
|
+
- To override the default CssMinimizerWebpackPlugin options, set `cli.webpack.minify.css` to an object containing
|
|
213
|
+
[CssMinimizerWebpackPlugin options](https://webpack.js.org/plugins/css-minimizer-webpack-plugin/#options).
|
|
214
|
+
|
|
215
|
+
For example,
|
|
216
|
+
|
|
217
|
+
```json title="package.json"
|
|
218
|
+
{
|
|
219
|
+
"cli": {
|
|
220
|
+
"webpack": {
|
|
221
|
+
"minify": {
|
|
222
|
+
"js": {
|
|
223
|
+
// terser-webpack-plugin terserOptions
|
|
224
|
+
// https://webpack.js.org/plugins/terser-webpack-plugin/#terseroptions
|
|
225
|
+
},
|
|
226
|
+
"css": {
|
|
227
|
+
// css-minimizer-webpack-plugin options
|
|
228
|
+
// https://webpack.js.org/plugins/css-minimizer-webpack-plugin/#options
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Webpack
|
|
237
|
+
|
|
238
|
+
To further customize Webpack settings, create files named `webpack.*.config.js` in the package's root directory (the directory with its `package.json`).
|
|
239
|
+
|
|
240
|
+
Use `webpack.dev.config.js` to customize development builds and use `webpack.prod.config.js` to customize production builds. In the config file,
|
|
241
|
+
|
|
242
|
+
- Import `createWebpackConfig` from `@servicetitan/startup`.
|
|
243
|
+
- Call it with the custom Webpack options.
|
|
244
|
+
- Return the result as the default export.
|
|
245
|
+
|
|
246
|
+
For example, to customize the Webpack's **output** path,
|
|
247
|
+
|
|
248
|
+
```js title="webpack.dev.config.js"
|
|
249
|
+
const path = require('path');
|
|
250
|
+
const { createWebpackConfig } = require('@servicetitan/startup');
|
|
251
|
+
|
|
252
|
+
module.exports = createWebpackConfig({
|
|
253
|
+
configuration: {
|
|
254
|
+
mode: 'development',
|
|
255
|
+
output: { path: path.resolve(__dirname, '../../wwwroot') },
|
|
256
|
+
},
|
|
257
|
+
});
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
:::caution
|
|
261
|
+
For MFEs the approach is slightly different, see [Customizing Webpack for MFEs](#customizing-webpack-for-mfes)
|
|
262
|
+
:::
|
|
263
|
+
|
|
264
|
+
#### createWebpackConfig
|
|
265
|
+
|
|
266
|
+
`createWebpackConfig` takes an object with two fields, `configuration` and `plugins`.
|
|
267
|
+
|
|
268
|
+
| Field | Description |
|
|
269
|
+
| :-------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
270
|
+
| `configuration` | Merged with the defaults to produce the final webpack configuration. For production builds, **configuration.mode** must be set to "production". For development builds, set it to "development". |
|
|
271
|
+
| `plugins` | `HtmlWebpackPlugin` and `MiniCssExtractPlugin` subkeys are merged with the default configurations for the corresponding plugins. |
|
|
272
|
+
|
|
273
|
+
For example,
|
|
274
|
+
|
|
275
|
+
```js title="webpack.prod.config.js"
|
|
276
|
+
const { createWebpackConfig } = require('@servicetitan/startup');
|
|
277
|
+
|
|
278
|
+
module.exports = createWebpackConfig({
|
|
279
|
+
configuration: {
|
|
280
|
+
mode: 'production',
|
|
281
|
+
},
|
|
282
|
+
plugins: {
|
|
283
|
+
HtmlWebpackPlugin: {
|
|
284
|
+
favicon: './favicon.ico',
|
|
285
|
+
title: 'Enterprise Hub',
|
|
286
|
+
},
|
|
287
|
+
},
|
|
288
|
+
});
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
:::caution
|
|
292
|
+
Remember, you must set `configuration.mode` to "production" in `webpack.prod.config.js`.
|
|
293
|
+
:::
|
|
294
|
+
|
|
295
|
+
#### Customizing Webpack for MFEs
|
|
296
|
+
|
|
297
|
+
Because `startup` runs Webpack multiple times to create MFEs bundles, a slightly different approach is required for MFEs.
|
|
298
|
+
Don't call `createWebpackConfig` and just return an object with the same `configuration` and `plugins` fields described [above](#createwebpackconfig).
|
|
299
|
+
E.g.,
|
|
300
|
+
|
|
301
|
+
```js title="webpack.dev.config.js"
|
|
302
|
+
const path = require('path');
|
|
303
|
+
|
|
304
|
+
module.exports = {
|
|
305
|
+
configuration: {
|
|
306
|
+
mode: 'development',
|
|
307
|
+
output: { path: path.resolve(__dirname, '../../wwwroot') },
|
|
308
|
+
},
|
|
309
|
+
};
|
|
310
|
+
```
|
package/docs/startup/clean.mdx
CHANGED
|
@@ -5,7 +5,7 @@ title: clean
|
|
|
5
5
|
Resets project workspace to a fresh state by clearing build caches and removing untracked files.
|
|
6
6
|
|
|
7
7
|
It runs tools like `nx reset` and `jest --clearCache` to clear project and test
|
|
8
|
-
caches, clears the
|
|
8
|
+
caches, clears the package manager and npx caches, and then uses `git clean -fdX` to delete
|
|
9
9
|
all files ignored by Git (such as build outputs and temporary files).
|
|
10
10
|
|
|
11
11
|
```sh
|
package/docs/startup/review.mdx
CHANGED
|
@@ -12,7 +12,7 @@ This helps maintain consistency, avoid dependency hell, and enforce best practic
|
|
|
12
12
|
npx startup review
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
- Run from the root of your workspace (where your root `package.json` and
|
|
15
|
+
- Run from the root of your workspace (where your root `package.json` and lock file are located).
|
|
16
16
|
- The command will scan all packages (as defined by your workspace configuration) and report any errors or warnings found by the enabled rules.
|
|
17
17
|
|
|
18
18
|
---
|
|
@@ -20,7 +20,7 @@ npx startup review
|
|
|
20
20
|
## How It Works
|
|
21
21
|
|
|
22
22
|
1. **Workspace Discovery**: Finds all packages in your monorepo using your workspace configuration.
|
|
23
|
-
2. **Dependency Analysis**: Builds a dependency graph and collects all installed versions from `package-lock.json
|
|
23
|
+
2. **Dependency Analysis**: Builds a dependency graph and collects all installed versions from the lock file (`package-lock.json` or `pnpm-lock.yaml`).
|
|
24
24
|
3. **Rule Execution**: Runs each enabled rule against your project and packages.
|
|
25
25
|
4. **Reporting**: Outputs a summary of all problems found, grouped by file and severity.
|
|
26
26
|
|
|
@@ -37,7 +37,7 @@ npx startup review
|
|
|
37
37
|
## Troubleshooting
|
|
38
38
|
|
|
39
39
|
- Make sure you run the command from the workspace root.
|
|
40
|
-
- If you see unexpected results, check your configuration and ensure your
|
|
40
|
+
- If you see unexpected results, check your configuration and ensure your lock file is up to date.
|
|
41
41
|
|
|
42
42
|
---
|
|
43
43
|
|
|
@@ -424,18 +424,20 @@ npm pkg set sideEffects=false -w @servicetitan/package
|
|
|
424
424
|
|
|
425
425
|
### require-npmrc
|
|
426
426
|
|
|
427
|
-
Checks that your project contains a `.npmrc` file with
|
|
427
|
+
Checks that your project contains a `.npmrc` file with the following required and recommended settings:
|
|
428
428
|
|
|
429
429
|
```text title=".npmrc"
|
|
430
430
|
legacy-peer-deps=true
|
|
431
431
|
```
|
|
432
432
|
|
|
433
|
-
Setting
|
|
433
|
+
| Setting | Description |
|
|
434
|
+
| :----------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
435
|
+
| `legacy-peer-deps` | (Recommended) Tells npm to use the older, more permissive peer dependency resolution algorithm (as in npm v6). This can help avoid installation failures when packages in your dependency tree have conflicting or unmet peer dependencies, which is common in large monorepos or when using older packages. |
|
|
434
436
|
|
|
435
437
|
#### ✅ Autofix
|
|
436
438
|
|
|
437
439
|
This rule supports autofix.
|
|
438
|
-
It creates or updates your `.npmrc` file to include
|
|
440
|
+
It creates or updates your `.npmrc` file to include the missing settings. E.g.,
|
|
439
441
|
|
|
440
442
|
```sh
|
|
441
443
|
npm config set --location=project legacy-peer-deps=true
|
|
@@ -536,24 +538,26 @@ To manually hoist packages to the root `node_modules`:
|
|
|
536
538
|
|
|
537
539
|
Where `<name>` is the package name and `<version>` is the package version to hoist.
|
|
538
540
|
|
|
539
|
-
2. Update the
|
|
541
|
+
2. Update the lock file:
|
|
540
542
|
|
|
541
543
|
```sh
|
|
542
544
|
npm install --legacy-peer-deps --package-lock-only --prefer-dedupe
|
|
543
545
|
```
|
|
544
546
|
|
|
545
|
-
|
|
547
|
+
Or, for pnpm projects:
|
|
546
548
|
|
|
547
549
|
```sh
|
|
548
|
-
|
|
550
|
+
pnpm install --lockfile-only
|
|
549
551
|
```
|
|
550
552
|
|
|
551
|
-
|
|
553
|
+
3. Remove the package(s) from the root `package.json`. E.g.,
|
|
552
554
|
|
|
553
555
|
```sh
|
|
554
|
-
npm
|
|
556
|
+
npm pkg delete dependencies[<name>]
|
|
555
557
|
```
|
|
556
558
|
|
|
559
|
+
4. Update the lock file a final time using the same command from step 2.
|
|
560
|
+
|
|
557
561
|
---
|
|
558
562
|
|
|
559
563
|
### require-tsconfig-references
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: start
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Serves applications and [MFEs](../microfrontends) during development, watches source files, and automatically reloads pages on changes.
|
|
6
|
+
|
|
7
|
+
:::tip
|
|
8
|
+
To serve an application without `start`, [build](./build) it, then point any static http server to the output **bundle** directory, where the browser will find `index.html`. For example, to serve with [`http-server`](https://www.npmjs.com/package/http-server)
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
npx -yes http-server packages/application/dist/bundle
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
:::
|
|
15
|
+
|
|
16
|
+
## Options
|
|
17
|
+
|
|
18
|
+
| Option | Description |
|
|
19
|
+
| :---------------- | :------------------------------------------------------------------------------------------------------------------------------- |
|
|
20
|
+
| `--scope <glob>` | Include only packages with names matching the given glob. |
|
|
21
|
+
| `--ignore <glob>` | Exclude packages with names matching the given glob. |
|
|
22
|
+
| `--code-coverage` | Add [instrumentation](https://github.com/JS-DevTools/coverage-istanbul-loader) to bundled code in order to collect code coverage |
|
|
23
|
+
| `--use-tsc` | Use TSC for TypeScript compilation |
|
|
24
|
+
|
|
25
|
+
## Start Steps
|
|
26
|
+
|
|
27
|
+
The `start` command executes the same steps as the `build` command, then watches for changes and automatically reruns each step as needed.
|
|
28
|
+
|
|
29
|
+
See [Build Steps](./build#build-steps).
|
|
30
|
+
|
|
31
|
+
## Configuration
|
|
32
|
+
|
|
33
|
+
### Port
|
|
34
|
+
|
|
35
|
+
Use `cli.webpack.port` to select the port to use for a package. By default, packages are served from the first available port starting from 8080.
|
|
36
|
+
|
|
37
|
+
```json title="package.json"
|
|
38
|
+
{
|
|
39
|
+
"cli": {
|
|
40
|
+
"webpack": {
|
|
41
|
+
"port": 8888
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
✨ New in **v35.2.0** ✨
|
|
48
|
+
|
|
49
|
+
You can also override the port at runtime using the `PORT` environment variable. This takes precedence over `cli.webpack.port` and is useful for tools like .NET Aspire that need to assign dynamic ports.
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
PORT=3000 npm start
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### DevServer
|
|
56
|
+
|
|
57
|
+
Use `cli.webpack.devServer` to set or override `webpack-dev-server` options.
|
|
58
|
+
|
|
59
|
+
```json title="package.json"
|
|
60
|
+
{
|
|
61
|
+
"cli": {
|
|
62
|
+
"webpack": {
|
|
63
|
+
"devServer": {
|
|
64
|
+
// webpack-dev-server options (https://webpack.js.org/configuration/dev-server/#devserver)
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
:::tip
|
|
72
|
+
Set `cli.webpack.devServer` to `false` to disable `webpack-dev-server` altogether.
|
|
73
|
+
:::
|
package/docs/startup/startup.mdx
CHANGED
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
title: Startup
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
import Tabs from '@theme/Tabs';
|
|
6
|
-
import TabItem from '@theme/TabItem';
|
|
7
|
-
|
|
8
5
|
#### [CHANGELOG (@servicetitan/startup)](https://github.com/servicetitan/uikit/blob/master/packages/startup/CHANGELOG.md)
|
|
9
6
|
|
|
10
7
|
[@servicetitan/startup](https://github.com/servicetitan/uikit/tree/master/packages/startup) is a command-line interface (CLI) to create multi-package Lerna projects with the support of TypeScript Project References and React. It offers a modern build setup with no configuration.
|
|
@@ -23,19 +20,6 @@ It's overwhelming how many development dependencies are required to work with th
|
|
|
23
20
|
|
|
24
21
|
Updating build tooling is typically a daunting and time-consuming task. When new versions of [@servicetitan/startup](https://github.com/servicetitan/uikit/tree/master/packages/startup) are released, you just need to bump its version.
|
|
25
22
|
|
|
26
|
-
## Bundlers
|
|
27
|
-
|
|
28
|
-
`startup` supports two bundlers:
|
|
29
|
-
|
|
30
|
-
- **Webpack** — the default bundler.
|
|
31
|
-
- **Vite** — opt-in via `--use-vite` (✨ New in **[INSERT-VERSION-HERE]** ✨).
|
|
32
|
-
|
|
33
|
-
See [build](./build) and [start](./start) for bundler-specific configuration.
|
|
34
|
-
|
|
35
|
-
:::tip
|
|
36
|
-
Already on webpack and want to switch? See [Migrating to Vite](https://docs.st.dev/docs/frontend/vite-migration) for a step-by-step guide.
|
|
37
|
-
:::
|
|
38
|
-
|
|
39
23
|
## Commands
|
|
40
24
|
|
|
41
25
|
- [build](./build) build project for production
|
|
@@ -87,18 +71,9 @@ Use `cli.NODE_OPTIONS` or `cli.*.NODE_OPTIONS` to set or override Node options f
|
|
|
87
71
|
|
|
88
72
|
✨ New in **v34.1.0** ✨
|
|
89
73
|
|
|
90
|
-
`@servicetitan/startup` provides utility functions to configure Storybook 10 or later with the same
|
|
91
|
-
|
|
92
|
-
<Tabs
|
|
93
|
-
defaultValue="webpack"
|
|
94
|
-
values={[
|
|
95
|
-
{ label: 'Webpack', value: 'webpack' },
|
|
96
|
-
{ label: 'Vite', value: 'vite' },
|
|
97
|
-
]}
|
|
98
|
-
>
|
|
99
|
-
<TabItem value="webpack">
|
|
74
|
+
`@servicetitan/startup` provides utility functions to configure Storybook 10 or later with the same webpack and SWC settings used by the [build](./build) and [start](./start) commands.
|
|
100
75
|
|
|
101
|
-
|
|
76
|
+
To use, import `webpackFinal` and `swc` from `@servicetitan/startup/storybook-config` in your Storybook `main.ts` configuration:
|
|
102
77
|
|
|
103
78
|
```ts title=".storybook/main.ts"
|
|
104
79
|
import type { StorybookConfig } from '@storybook/react-webpack5';
|
|
@@ -117,7 +92,7 @@ const config: StorybookConfig = {
|
|
|
117
92
|
export default config;
|
|
118
93
|
```
|
|
119
94
|
|
|
120
|
-
|
|
95
|
+
### Custom overrides
|
|
121
96
|
|
|
122
97
|
You can also pass custom webpack overrides to `webpackFinal`:
|
|
123
98
|
|
|
@@ -141,17 +116,7 @@ const config: StorybookConfig = {
|
|
|
141
116
|
export default config;
|
|
142
117
|
```
|
|
143
118
|
|
|
144
|
-
For details about the structure and options available in webpack overrides, see the [createWebpackConfig](./build
|
|
145
|
-
|
|
146
|
-
</TabItem>
|
|
147
|
-
<TabItem value="vite">
|
|
148
|
-
|
|
149
|
-
:::caution
|
|
150
|
-
Storybook Vite configuration is not yet supported. This is planned for a future release.
|
|
151
|
-
:::
|
|
152
|
-
|
|
153
|
-
</TabItem>
|
|
154
|
-
</Tabs>
|
|
119
|
+
For details about the structure and options available in webpack overrides, see the [createWebpackConfig](./build#createwebpackconfig) section in the build documentation.
|
|
155
120
|
|
|
156
121
|
## Cypress Component Testing Configuration
|
|
157
122
|
|
|
@@ -197,7 +162,7 @@ export default defineConfig({
|
|
|
197
162
|
});
|
|
198
163
|
```
|
|
199
164
|
|
|
200
|
-
For details about the structure and options available in webpack overrides, see the [createWebpackConfig](./build
|
|
165
|
+
For details about the structure and options available in webpack overrides, see the [createWebpackConfig](./build#createwebpackconfig) section in the build documentation.
|
|
201
166
|
|
|
202
167
|
### TypeScript Types
|
|
203
168
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/docs-uikit",
|
|
3
|
-
"version": "36.
|
|
3
|
+
"version": "36.2.0",
|
|
4
4
|
"description": "Documentation content for Uikit packages published at docs.st.dev",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -15,5 +15,6 @@
|
|
|
15
15
|
},
|
|
16
16
|
"cli": {
|
|
17
17
|
"webpack": false
|
|
18
|
-
}
|
|
18
|
+
},
|
|
19
|
+
"gitHead": "87254b2caf60b20eb46c33b40ffb4dd05ad3e0f7"
|
|
19
20
|
}
|