@servicetitan/docs-uikit 36.3.1 → 37.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.
- package/docs/BREAKING_CHANGES.mdx +9 -1
- package/docs/ai-marketplace.mdx +8 -4
- package/docs/datadog-rum.mdx +346 -43
- package/docs/eslint-config.mdx +10 -10
- package/docs/install.mdx +11 -7
- package/docs/lazy-module.mdx +1 -1
- package/docs/microfrontends/hosting.mdx +7 -5
- package/docs/microfrontends/sharing-dependencies.mdx +15 -17
- package/docs/startup/build/build.mdx +280 -0
- package/docs/startup/build/optional-peer-dependencies.mdx +131 -0
- package/docs/startup/build/vite.mdx +291 -0
- package/docs/startup/build/webpack.mdx +127 -0
- package/docs/startup/clean.mdx +1 -1
- package/docs/startup/lint.mdx +1 -1
- package/docs/startup/mfe-list.mdx +2 -2
- package/docs/startup/review.mdx +36 -11
- package/docs/startup/start/start.mdx +48 -0
- package/docs/startup/start/vite.mdx +109 -0
- package/docs/startup/start/webpack.mdx +49 -0
- package/docs/startup/startup.mdx +114 -10
- package/docs/startup/test/jest.mdx +4 -4
- package/docs/startup/test/test.mdx +1 -1
- package/docs/startup/test/vitest.mdx +6 -6
- package/package.json +2 -2
- package/docs/startup/build.mdx +0 -310
- package/docs/startup/start.mdx +0 -73
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Vite
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
✨ New in **v37.0.0** ✨
|
|
6
|
+
|
|
7
|
+
Vite is an alternative bundler for `startup build`, enabled with `--bundler=vite`. It uses [Vite](https://vite.dev/) with the [Rolldown](https://rolldown.rs/) bundler and [OXC](https://oxc.rs/) minifier/transformer.
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npx startup build --bundler=vite
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
To make Vite the default, set `cli.bundler` in the project's root `package.json`:
|
|
14
|
+
|
|
15
|
+
```json title="package.json"
|
|
16
|
+
{
|
|
17
|
+
"cli": {
|
|
18
|
+
"bundler": "vite"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
The `--bundler` flag overrides it per invocation.
|
|
24
|
+
|
|
25
|
+
:::tip
|
|
26
|
+
For dev server configuration (port, proxy, HMR), see [Vite start](../start/vite).
|
|
27
|
+
:::
|
|
28
|
+
|
|
29
|
+
## Configuration Priority
|
|
30
|
+
|
|
31
|
+
Vite configuration comes from three sources, merged in order (later wins):
|
|
32
|
+
|
|
33
|
+
1. **Startup defaults**: base config built by startup
|
|
34
|
+
2. **`cli.vite` in package.json**: serializable overrides
|
|
35
|
+
3. **Config file** (`vite.dev.config.ts` / `vite.prod.config.ts`): full Vite config via [`defineConfig`](#config-files-defineconfig)
|
|
36
|
+
|
|
37
|
+
## Configuration Shortcuts
|
|
38
|
+
|
|
39
|
+
Shortcuts are convenience options available in both `cli.vite` (package.json) and config files. They map to multiple Vite config values internally.
|
|
40
|
+
|
|
41
|
+
| Shortcut | Type | Description |
|
|
42
|
+
| :---------------- | :-------------------------------- | :------------------------------------ |
|
|
43
|
+
| `omitDefault` | `string[]` | Remove default config keys or plugins |
|
|
44
|
+
| `minify` | `{ js?: boolean, css?: boolean }` | Toggle JS/CSS minification |
|
|
45
|
+
| `pluginOverrides` | `{ html?, svgr? }` | Override default plugin options |
|
|
46
|
+
|
|
47
|
+
### `omitDefault`
|
|
48
|
+
|
|
49
|
+
List of config keys or plugin names to remove from startup's defaults. Plugin names are prefixed with `plugins.`.
|
|
50
|
+
|
|
51
|
+
```json title="package.json"
|
|
52
|
+
{
|
|
53
|
+
"cli": {
|
|
54
|
+
"vite": {
|
|
55
|
+
"omitDefault": ["plugins.svgr", "css"]
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### `minify`
|
|
62
|
+
|
|
63
|
+
Boolean toggle for JS and CSS minification. Defaults to minimizing with [OXC](https://oxc.rs/docs/guide/usage/minifier) in production, unminified in development.
|
|
64
|
+
|
|
65
|
+
```json title="package.json"
|
|
66
|
+
{
|
|
67
|
+
"cli": {
|
|
68
|
+
"vite": {
|
|
69
|
+
"minify": {
|
|
70
|
+
"js": false,
|
|
71
|
+
"css": false
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
To customize minification, configure Vite directly in `vite.prod.config.ts` (or `cli.vite.config`). For example, to use Terser instead, set `build.minify: 'terser'` and pass options via `build.terserOptions`:
|
|
79
|
+
|
|
80
|
+
```ts title="vite.prod.config.ts"
|
|
81
|
+
import { defineConfig } from '@servicetitan/startup/vite';
|
|
82
|
+
|
|
83
|
+
export default defineConfig({
|
|
84
|
+
config: {
|
|
85
|
+
build: {
|
|
86
|
+
minify: 'terser',
|
|
87
|
+
terserOptions: { compress: { drop_console: true } },
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
See Vite's [`build.minify`](https://vite.dev/config/build-options.html#build-minify) for the full minifier reference.
|
|
94
|
+
|
|
95
|
+
### `pluginOverrides`
|
|
96
|
+
|
|
97
|
+
Override options for startup's built-in plugins.
|
|
98
|
+
|
|
99
|
+
#### `html`
|
|
100
|
+
|
|
101
|
+
| Option | Type | Default | Description |
|
|
102
|
+
| :--------- | :------- | :------------------------------------------------------------------------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
103
|
+
| `title` | `string` | `'ServiceTitan'` | Page title in `<title>` tag |
|
|
104
|
+
| `favicon` | `string` | `'/favicon.ico'` if present in [`publicDir`](https://vite.dev/config/shared-options.html#publicdir), otherwise none | Favicon URL for the `<link rel="icon">` tag. Use `/filename` for files in [`publicDir`](https://vite.dev/config/shared-options.html#publicdir), or a path relative to the package root. |
|
|
105
|
+
| `template` | `string` | `index.ejs` or `index.html` in the package source directory, otherwise the built-in template | Path to a custom HTML template using eta template syntax. Both `.ejs` and `.html` extensions are accepted. |
|
|
106
|
+
|
|
107
|
+
#### `svgr`
|
|
108
|
+
|
|
109
|
+
| Option | Type | Description |
|
|
110
|
+
| :------------ | :--------------------------------------------------- | :--------------------------------- |
|
|
111
|
+
| `include` | `string \| string[]` | Glob patterns to include for SVGR |
|
|
112
|
+
| `exclude` | `string \| string[]` | Glob patterns to exclude from SVGR |
|
|
113
|
+
| `svgrOptions` | [`SvgrConfig`](https://react-svgr.com/docs/options/) | Options passed to SVGR transformer |
|
|
114
|
+
|
|
115
|
+
## Vite Config (`cli.vite.config`)
|
|
116
|
+
|
|
117
|
+
For direct Vite configuration, use `cli.vite.config` in package.json. It accepts Vite's [`UserConfig`](https://vite.dev/config/) shape, minus `plugins` (not serializable in JSON).
|
|
118
|
+
|
|
119
|
+
```json title="package.json"
|
|
120
|
+
{
|
|
121
|
+
"cli": {
|
|
122
|
+
"vite": {
|
|
123
|
+
"config": {
|
|
124
|
+
"build": {
|
|
125
|
+
"target": "es2020"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
:::note
|
|
134
|
+
A custom `build.outDir` is not honored for MFEs. Their bundles must reside in `dist/bundle/<subdir>` so the host loader can resolve them.
|
|
135
|
+
:::
|
|
136
|
+
|
|
137
|
+
## Config Files (`defineConfig`)
|
|
138
|
+
|
|
139
|
+
For advanced configuration, create `vite.dev.config.ts` (development) or `vite.prod.config.ts` (production) in the package root. Config files support full Vite `UserConfig` including `plugins`.
|
|
140
|
+
|
|
141
|
+
:::tip
|
|
142
|
+
Config files at the package root fall outside the main `tsconfig.json`, so they get no type checking on build or in CI. See [type checking root-level config files](./build#root-level-config-files) to enable it.
|
|
143
|
+
:::
|
|
144
|
+
|
|
145
|
+
Import `defineConfig` from `@servicetitan/startup/vite` for type safety:
|
|
146
|
+
|
|
147
|
+
```ts title="vite.prod.config.ts"
|
|
148
|
+
import { defineConfig } from '@servicetitan/startup/vite';
|
|
149
|
+
|
|
150
|
+
export default defineConfig({
|
|
151
|
+
config: {
|
|
152
|
+
build: {
|
|
153
|
+
target: 'es2020',
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
pluginOverrides: {
|
|
157
|
+
html: {
|
|
158
|
+
title: 'My App',
|
|
159
|
+
favicon: '/brand.ico',
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
});
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Dynamic Config with Build Context
|
|
166
|
+
|
|
167
|
+
Pass a function to `defineConfig` to access the build context:
|
|
168
|
+
|
|
169
|
+
```ts title="vite.prod.config.ts"
|
|
170
|
+
import { defineConfig } from '@servicetitan/startup/vite';
|
|
171
|
+
|
|
172
|
+
export default defineConfig(context => {
|
|
173
|
+
// context.build — { name, isProduction, light, headless }
|
|
174
|
+
// context.package — { destination, isWebComponent, sharedDependencies, ... }
|
|
175
|
+
// context.options (coming soon)
|
|
176
|
+
|
|
177
|
+
return {
|
|
178
|
+
config: { ... },
|
|
179
|
+
};
|
|
180
|
+
});
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
:::tip
|
|
184
|
+
`.js` config files are also supported (`vite.dev.config.js` / `vite.prod.config.js`).
|
|
185
|
+
:::
|
|
186
|
+
|
|
187
|
+
:::tip
|
|
188
|
+
For full mutation access to the resolved config, add a Vite plugin with `enforce: 'post'` and a `config` hook as an escape hatch.
|
|
189
|
+
|
|
190
|
+
```ts title="vite.prod.config.ts"
|
|
191
|
+
import { defineConfig } from '@servicetitan/startup/vite';
|
|
192
|
+
|
|
193
|
+
export default defineConfig({
|
|
194
|
+
config: {
|
|
195
|
+
plugins: [
|
|
196
|
+
{
|
|
197
|
+
name: 'custom-config-override',
|
|
198
|
+
enforce: 'post',
|
|
199
|
+
config(resolved) {
|
|
200
|
+
resolved.build ??= {};
|
|
201
|
+
resolved.build.chunkSizeWarningLimit = 1000;
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
],
|
|
205
|
+
},
|
|
206
|
+
});
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
:::
|
|
210
|
+
|
|
211
|
+
## Custom HTML Templates
|
|
212
|
+
|
|
213
|
+
The HTML plugin uses [eta](https://eta.js.org/) as the template engine. By default it picks up `index.ejs` (or `index.html`) from the package source directory, matching webpack's `HtmlWebpackPlugin` convention, and falls back to the built-in template when neither file exists. Eta renders `.ejs` and `.html` files identically, so apps migrating from webpack keep their existing template without renaming it.
|
|
214
|
+
|
|
215
|
+
To use a template in a different location, or with a different name, configure its path via `pluginOverrides.html.template`:
|
|
216
|
+
|
|
217
|
+
```json title="package.json"
|
|
218
|
+
{
|
|
219
|
+
"cli": {
|
|
220
|
+
"vite": {
|
|
221
|
+
"pluginOverrides": {
|
|
222
|
+
"html": {
|
|
223
|
+
"title": "My App",
|
|
224
|
+
"favicon": "/brand.ico",
|
|
225
|
+
"template": "./config/host.html"
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Example eta template:
|
|
234
|
+
|
|
235
|
+
```html title="src/index.ejs"
|
|
236
|
+
<!doctype html>
|
|
237
|
+
<html>
|
|
238
|
+
<head>
|
|
239
|
+
<meta charset="utf-8" />
|
|
240
|
+
<title><%= it.title %></title>
|
|
241
|
+
<link rel="icon" href="<%= it.favicon %>" />
|
|
242
|
+
<% it.css.forEach(function(item) { %>
|
|
243
|
+
<link href="./<%= item %>" rel="stylesheet" />
|
|
244
|
+
<% }); %> <% it.js.forEach(function(item) { %>
|
|
245
|
+
<script src="./<%= item %>"></script>
|
|
246
|
+
<% }); %>
|
|
247
|
+
</head>
|
|
248
|
+
<body>
|
|
249
|
+
<div id="root"></div>
|
|
250
|
+
<script type="module">
|
|
251
|
+
import './dist/index';
|
|
252
|
+
</script>
|
|
253
|
+
</body>
|
|
254
|
+
</html>
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
:::tip
|
|
258
|
+
See [startup's default template](https://github.com/servicetitan/uikit/blob/master/packages/startup/src/vite/index.html) for a full working example, including MFE self-hosting and custom-element rendering.
|
|
259
|
+
:::
|
|
260
|
+
|
|
261
|
+
Available template variables:
|
|
262
|
+
|
|
263
|
+
| Variable | Type | Description |
|
|
264
|
+
| :--------------- | :--------- | :---------------------------------------------------------- |
|
|
265
|
+
| `title` | `string` | Page title from `pluginOverrides.html.title` |
|
|
266
|
+
| `favicon` | `string` | Favicon URL (explicit or auto-detected); may be `undefined` |
|
|
267
|
+
| `css` | `string[]` | Stylesheet entry paths to inject as `<link>` tags |
|
|
268
|
+
| `js` | `string[]` | Script entry paths to inject as `<script>` tags |
|
|
269
|
+
| `name` | `string` | Package/MFE name |
|
|
270
|
+
| `isProduction` | `boolean` | True for production builds |
|
|
271
|
+
| `isWebComponent` | `boolean` | True when building an MFE (web component) |
|
|
272
|
+
|
|
273
|
+
Use `<%= %>` for escaped output and `<%~ %>` for unescaped. See the [Eta docs](https://eta.js.org/) for the full template language reference, including conditionals, loops, and partials.
|
|
274
|
+
|
|
275
|
+
## Preview Server
|
|
276
|
+
|
|
277
|
+
Use the `--preview` flag to start preview servers for all bundled packages after a production build. Each package serves its built bundle from its output directory on its configured dev server port, opening the browser automatically.
|
|
278
|
+
|
|
279
|
+
Unlike `startup start`, preview servers serve only the built static assets: no source transformation, no hot reloading.
|
|
280
|
+
|
|
281
|
+
```sh
|
|
282
|
+
npx startup build --bundler=vite --preview
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
The preview server is useful for validating production builds locally before deploying.
|
|
286
|
+
|
|
287
|
+
## Not Yet Supported
|
|
288
|
+
|
|
289
|
+
The following features are planned but not yet available with the Vite bundler:
|
|
290
|
+
|
|
291
|
+
- `--stat`: bundle analysis report
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Webpack
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Webpack is the default bundler for `startup build`.
|
|
6
|
+
|
|
7
|
+
## Minimization
|
|
8
|
+
|
|
9
|
+
`startup` configures webpack to minimize production bundles, using
|
|
10
|
+
[TerserWebpackPlugin](https://webpack.js.org/plugins/terser-webpack-plugin) for JS bundles
|
|
11
|
+
and [CssMinimizerWebpackPlugin](https://webpack.js.org/plugins/css-minimizer-webpack-plugin)
|
|
12
|
+
for CSS bundles.
|
|
13
|
+
|
|
14
|
+
For application bundles, `startup` minimizes bundles conservatively, so that projects
|
|
15
|
+
gain the benefits of reduced bundle sizes while retaining the highest fidelity for
|
|
16
|
+
source map debugging.
|
|
17
|
+
|
|
18
|
+
(✨ New in **v37.0.0** ✨) For MFE bundles, `startup` enables Terser's `compress` and `mangle` passes to produce
|
|
19
|
+
the smallest output, relying on [source maps uploaded to Datadog](../mfe-publish#sourcemaps)
|
|
20
|
+
to map runtime errors back to source.
|
|
21
|
+
|
|
22
|
+
- To turn off minimizing, set `cli.webpack.minify.js` or `cli.webpack.minify.css`, or both, to `false`.
|
|
23
|
+
- To override the default Terser options set `cli.webpack.minify.js` to an object containing
|
|
24
|
+
[`terserOptions`](https://webpack.js.org/plugins/terser-webpack-plugin/#terseroptions).
|
|
25
|
+
- To override the default CssMinimizerWebpackPlugin options, set `cli.webpack.minify.css` to an object containing
|
|
26
|
+
[CssMinimizerWebpackPlugin options](https://webpack.js.org/plugins/css-minimizer-webpack-plugin/#options).
|
|
27
|
+
|
|
28
|
+
For example,
|
|
29
|
+
|
|
30
|
+
```json title="package.json"
|
|
31
|
+
{
|
|
32
|
+
"cli": {
|
|
33
|
+
"webpack": {
|
|
34
|
+
"minify": {
|
|
35
|
+
"js": {
|
|
36
|
+
// terser-webpack-plugin terserOptions
|
|
37
|
+
// https://webpack.js.org/plugins/terser-webpack-plugin/#terseroptions
|
|
38
|
+
},
|
|
39
|
+
"css": {
|
|
40
|
+
// css-minimizer-webpack-plugin options
|
|
41
|
+
// https://webpack.js.org/plugins/css-minimizer-webpack-plugin/#options
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Custom Configuration
|
|
50
|
+
|
|
51
|
+
To further customize Webpack settings, create files named `webpack.*.config.js` in the package's root directory (the directory with its `package.json`).
|
|
52
|
+
|
|
53
|
+
Use `webpack.dev.config.js` to customize development builds and use `webpack.prod.config.js` to customize production builds. In the config file,
|
|
54
|
+
|
|
55
|
+
- Import `createWebpackConfig` from `@servicetitan/startup`.
|
|
56
|
+
- Call it with the custom Webpack options.
|
|
57
|
+
- Return the result as the default export.
|
|
58
|
+
|
|
59
|
+
For example, to customize the Webpack's **output** path,
|
|
60
|
+
|
|
61
|
+
```js title="webpack.dev.config.js"
|
|
62
|
+
const path = require('path');
|
|
63
|
+
const { createWebpackConfig } = require('@servicetitan/startup');
|
|
64
|
+
|
|
65
|
+
module.exports = createWebpackConfig({
|
|
66
|
+
configuration: {
|
|
67
|
+
mode: 'development',
|
|
68
|
+
output: { path: path.resolve(__dirname, '../../wwwroot') },
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
:::caution
|
|
74
|
+
For MFEs the approach is slightly different, see [Customizing Webpack for MFEs](#customizing-webpack-for-mfes)
|
|
75
|
+
:::
|
|
76
|
+
|
|
77
|
+
### createWebpackConfig
|
|
78
|
+
|
|
79
|
+
`createWebpackConfig` takes an object with two fields, `configuration` and `plugins`.
|
|
80
|
+
|
|
81
|
+
| Field | Description |
|
|
82
|
+
| :-------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
83
|
+
| `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". |
|
|
84
|
+
| `plugins` | `HtmlWebpackPlugin` and `MiniCssExtractPlugin` subkeys are merged with the default configurations for the corresponding plugins. |
|
|
85
|
+
|
|
86
|
+
For example,
|
|
87
|
+
|
|
88
|
+
```js title="webpack.prod.config.js"
|
|
89
|
+
const { createWebpackConfig } = require('@servicetitan/startup');
|
|
90
|
+
|
|
91
|
+
module.exports = createWebpackConfig({
|
|
92
|
+
configuration: {
|
|
93
|
+
mode: 'production',
|
|
94
|
+
},
|
|
95
|
+
plugins: {
|
|
96
|
+
HtmlWebpackPlugin: {
|
|
97
|
+
favicon: './favicon.ico',
|
|
98
|
+
title: 'Enterprise Hub',
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
:::caution
|
|
105
|
+
Remember, you must set `configuration.mode` to "production" in `webpack.prod.config.js`.
|
|
106
|
+
:::
|
|
107
|
+
|
|
108
|
+
### Customizing Webpack for MFEs
|
|
109
|
+
|
|
110
|
+
Because `startup` runs Webpack multiple times to create MFEs bundles, a slightly different approach is required for MFEs.
|
|
111
|
+
Don't call `createWebpackConfig` and just return an object with the same `configuration` and `plugins` fields described [above](#createwebpackconfig).
|
|
112
|
+
E.g.,
|
|
113
|
+
|
|
114
|
+
```js title="webpack.dev.config.js"
|
|
115
|
+
module.exports = {
|
|
116
|
+
configuration: {
|
|
117
|
+
mode: 'development',
|
|
118
|
+
devServer: {
|
|
119
|
+
allowedHosts: 'all',
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
};
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
:::note
|
|
126
|
+
A custom `output.path` is not honored for MFEs. Their bundles must reside in `dist/bundle/<subdir>` so the host loader can resolve them.
|
|
127
|
+
:::
|
package/docs/startup/clean.mdx
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
title: clean
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
Resets project
|
|
5
|
+
Resets project 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
8
|
caches, clears the package manager and npx caches, and then uses `git clean -fdX` to delete
|
package/docs/startup/lint.mdx
CHANGED
|
@@ -45,5 +45,5 @@ Use `cli.lint` to set or override `ESLint` and `Stylelint` options. E.g,
|
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
:::caution
|
|
48
|
-
Because `lint` is a global command that runs from the
|
|
48
|
+
Because `lint` is a global command that runs from the project root, `ESLint` and `Stylelint` configurations must be in the project's root `package.json`.
|
|
49
49
|
:::
|
|
@@ -10,7 +10,7 @@ Use `mfe-list` to see what MFE versions were published and when.
|
|
|
10
10
|
npx startup mfe-list
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
It outputs, for each MFE in the current
|
|
13
|
+
It outputs, for each MFE in the current project,
|
|
14
14
|
|
|
15
15
|
- The MFE's name, current version, and total number of versions
|
|
16
16
|
- A table listing the 20 most recently published versions, with the following columns:
|
|
@@ -58,7 +58,7 @@ npx startup mfe-list @servicetitan/dispatch-center --tagged
|
|
|
58
58
|
```
|
|
59
59
|
|
|
60
60
|
:::tip
|
|
61
|
-
Use this syntax to list any MFE, not just the ones in the project
|
|
61
|
+
Use this syntax to list any MFE, not just the ones in the project.
|
|
62
62
|
:::
|
|
63
63
|
|
|
64
64
|
## Authorization
|
package/docs/startup/review.mdx
CHANGED
|
@@ -3,7 +3,7 @@ title: review
|
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
The `startup review` command is a static analysis tool for monorepos using `@servicetitan/startup`.
|
|
6
|
-
It checks your
|
|
6
|
+
It checks your project for common configuration and dependency issues using a set of pluggable rules.
|
|
7
7
|
This helps maintain consistency, avoid dependency hell, and enforce best practices across all packages in your repository.
|
|
8
8
|
|
|
9
9
|
## Usage
|
|
@@ -12,14 +12,14 @@ 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
|
|
16
|
-
- The command will scan all packages (as defined by your
|
|
15
|
+
- Run from the root of your project (where your root `package.json` and lock file are located).
|
|
16
|
+
- The command will scan all packages (as defined by your project configuration) and report any errors or warnings found by the enabled rules.
|
|
17
17
|
|
|
18
18
|
---
|
|
19
19
|
|
|
20
20
|
## How It Works
|
|
21
21
|
|
|
22
|
-
1. **Workspace Discovery**: Finds all packages in your monorepo using your
|
|
22
|
+
1. **Workspace Discovery**: Finds all packages in your monorepo using your project configuration.
|
|
23
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.
|
|
@@ -36,7 +36,7 @@ npx startup review
|
|
|
36
36
|
|
|
37
37
|
## Troubleshooting
|
|
38
38
|
|
|
39
|
-
- Make sure you run the command from the
|
|
39
|
+
- Make sure you run the command from the project root.
|
|
40
40
|
- If you see unexpected results, check your configuration and ensure your lock file is up to date.
|
|
41
41
|
|
|
42
42
|
---
|
|
@@ -234,7 +234,7 @@ npm pkg delete dependencies["react"] -w packages/lib
|
|
|
234
234
|
|
|
235
235
|
Enforces open‑ended peer dependency ranges so consumers can choose compatible versions.
|
|
236
236
|
|
|
237
|
-
Closed‑ended ranges like `^1.2.3` or `~1.2.3` are discouraged for peer dependencies because they limit consumers' ability to resolve a single compatible version across a
|
|
237
|
+
Closed‑ended ranges like `^1.2.3` or `~1.2.3` are discouraged for peer dependencies because they limit consumers' ability to resolve a single compatible version across a project. Closed-ended ranges should only be used when there is a known incompatibility with a later version.
|
|
238
238
|
|
|
239
239
|
#### ✅ Autofix
|
|
240
240
|
|
|
@@ -382,6 +382,31 @@ This rule supports autofix. It updates dependencies on `launchdarkly-js-client-s
|
|
|
382
382
|
|
|
383
383
|
---
|
|
384
384
|
|
|
385
|
+
### require-compatible-typescript
|
|
386
|
+
|
|
387
|
+
Ensures the project's resolved `typescript` version is not older than the version required by `@servicetitan/startup`.
|
|
388
|
+
|
|
389
|
+
`@servicetitan/startup` compiles and type-checks your code with its own `typescript` dependency. If the project resolves an older top-level `typescript`, builds and editor type-checking can disagree with `startup`, producing errors that don't reproduce in CI or misleading type results.
|
|
390
|
+
|
|
391
|
+
:::note
|
|
392
|
+
This rule is skipped for `pnpm` projects.
|
|
393
|
+
:::
|
|
394
|
+
|
|
395
|
+
#### ✅ Autofix
|
|
396
|
+
|
|
397
|
+
This rule supports autofix.
|
|
398
|
+
It bumps the resolved `typescript` in the lock file to the version required by `@servicetitan/startup`, without adding `typescript` as a direct dependency.
|
|
399
|
+
|
|
400
|
+
It runs
|
|
401
|
+
|
|
402
|
+
```sh
|
|
403
|
+
npm pkg set dependencies["typescript"]="<required-version>"
|
|
404
|
+
npx @servicetitan/install --fix --quiet
|
|
405
|
+
npm pkg delete dependencies["typescript"]
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
---
|
|
409
|
+
|
|
385
410
|
### require-explicit-side-effects
|
|
386
411
|
|
|
387
412
|
Warns if a package is missing the `sideEffects` property in its `package.json`.
|
|
@@ -447,7 +472,7 @@ npm config set --location=project legacy-peer-deps=true
|
|
|
447
472
|
|
|
448
473
|
### require-one-anvil-uikit-contrib-version
|
|
449
474
|
|
|
450
|
-
Ensures the same version of related `anvil-uikit-contrib` packages is installed across the
|
|
475
|
+
Ensures the same version of related `anvil-uikit-contrib` packages is installed across the project.
|
|
451
476
|
|
|
452
477
|
Different versions of related `anvil-uikit-contrib` packages may have breaking changes or incompatible APIs. If some packages use an older version while others use a newer one, you may encounter runtime errors, unexpected behavior, or subtle bugs that are difficult to diagnose.
|
|
453
478
|
|
|
@@ -484,7 +509,7 @@ It sets the version of each dependency to the [highest](#highest-versions) of th
|
|
|
484
509
|
|
|
485
510
|
### require-one-react-version
|
|
486
511
|
|
|
487
|
-
Ensures the same version of `react` and `react-dom` is used across the
|
|
512
|
+
Ensures the same version of `react` and `react-dom` is used across the project.
|
|
488
513
|
|
|
489
514
|
These two packages are fundamentally designed to work together, with `react-dom` relying heavily on the internal structures and mechanisms exposed by `react`.
|
|
490
515
|
|
|
@@ -500,7 +525,7 @@ If multiple versions tie for the most common, it uses the [highest](#highest-ver
|
|
|
500
525
|
|
|
501
526
|
### require-one-uikit-version
|
|
502
527
|
|
|
503
|
-
Ensures the same version of related `uikit` packages is installed across the
|
|
528
|
+
Ensures the same version of related `uikit` packages is installed across the project.
|
|
504
529
|
|
|
505
530
|
Different versions of related `uikit` packages may have breaking changes or incompatible APIs. If some packages use an older version while others use a newer one, you may encounter runtime errors, unexpected behavior, or subtle bugs that are difficult to diagnose.
|
|
506
531
|
|
|
@@ -562,9 +587,9 @@ To manually hoist packages to the root `node_modules`:
|
|
|
562
587
|
|
|
563
588
|
### require-tsconfig-references
|
|
564
589
|
|
|
565
|
-
Ensures that TypeScript project references are configured for all local
|
|
590
|
+
Ensures that TypeScript project references are configured for all local project dependencies.
|
|
566
591
|
|
|
567
|
-
When a package depends on another package in the
|
|
592
|
+
When a package depends on another package in the project, the `tsconfig.json` (and any config that extends it, such as `tsconfig.build.json`) should include a reference to that dependency's tsconfig. This enables incremental builds and ensures proper type checking across package boundaries.
|
|
568
593
|
|
|
569
594
|
#### ✅ Autofix
|
|
570
595
|
|
|
@@ -0,0 +1,48 @@
|
|
|
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
|
+
`startup` supports two bundlers for development: [Webpack](./webpack) (default) and [Vite](./vite) (opt-in via `--bundler=vite`).
|
|
8
|
+
|
|
9
|
+
:::tip
|
|
10
|
+
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)
|
|
11
|
+
|
|
12
|
+
```sh
|
|
13
|
+
npx -yes http-server packages/application/dist/bundle
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
:::
|
|
17
|
+
|
|
18
|
+
## Options
|
|
19
|
+
|
|
20
|
+
| Option | Webpack | Vite | Description |
|
|
21
|
+
| :----------------- | :------ | :--- | :--------------------------------------------------------------------- |
|
|
22
|
+
| `--scope <glob>` | Yes | Yes | Include only packages with names matching the given glob. |
|
|
23
|
+
| `--ignore <glob>` | Yes | Yes | Exclude packages with names matching the given glob. |
|
|
24
|
+
| `--code-coverage` | Yes | Yes | Add instrumentation to bundled code in order to collect code coverage. |
|
|
25
|
+
| `--use-tsc` | Yes | Yes | Use TSC for TypeScript compilation. |
|
|
26
|
+
| `--bundler <name>` | Yes | Yes | Select the bundler: `vite` or `webpack` (default). |
|
|
27
|
+
|
|
28
|
+
## Start Steps
|
|
29
|
+
|
|
30
|
+
The `start` command executes the same steps as the `build` command, then watches for changes and automatically reruns each step as needed.
|
|
31
|
+
|
|
32
|
+
See [Build Steps](../build#build-steps).
|
|
33
|
+
|
|
34
|
+
## Port
|
|
35
|
+
|
|
36
|
+
The dev server port can be configured per-bundler in `package.json`. See [Webpack](./webpack#port) or [Vite](./vite#port) for details.
|
|
37
|
+
|
|
38
|
+
✨ New in **v35.2.0** ✨
|
|
39
|
+
|
|
40
|
+
You can also override the port at runtime using the `PORT` environment variable. This takes precedence over bundler-specific port configuration and is useful for tools like .NET Aspire that need to assign dynamic ports.
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
PORT=3000 npm start
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Configuration
|
|
47
|
+
|
|
48
|
+
See [Webpack](./webpack) or [Vite](./vite) for bundler-specific dev server configuration.
|