@servicetitan/docs-uikit 38.0.0 → 38.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/ajax-handlers/ajax-handlers.mdx +1 -0
- package/docs/install.mdx +2 -0
- package/docs/microfrontends/developing/authentication.mdx +10 -4
- package/docs/react-ioc.mdx +50 -0
- package/docs/startup/build/build.mdx +4 -0
- package/docs/startup/build/vite.mdx +57 -1
- package/docs/startup/build/webpack.mdx +4 -4
- package/docs/startup/install.mdx +2 -1
- package/docs/startup/start/vite.mdx +54 -1
- package/docs/startup/start/webpack.mdx +18 -0
- package/docs/startup/startup.mdx +8 -21
- package/package.json +2 -2
|
@@ -12,6 +12,7 @@ See [Cancelation handling](./cancelation-handling.mdx) for how to handle cancela
|
|
|
12
12
|
|
|
13
13
|
## API
|
|
14
14
|
|
|
15
|
+
- initAjaxHandlers - Use to register axios interceptors for authentication, error handling, and loading state; pass a notifier to receive error details including the full `AxiosError`.
|
|
15
16
|
- [withMicroservice](./with-microservice.mdx) - Use to wrap components and authenticate requests to protected resources with support for Bearer and Token Server authentication.
|
|
16
17
|
- [initAjaxHandlersLoginRequired](./init-ajax-handlers-login-required.mdx) - Use to register handler for invalid TokenServer session.
|
|
17
18
|
- [initAjaxHandlersParseDates](./init-ajax-handlers-parse-dates.mdx) - Use to automatically transform date strings in axios responses into JavaScript Date objects.
|
package/docs/install.mdx
CHANGED
|
@@ -62,6 +62,8 @@ pnpm support is experimental. It has been validated against several internal rep
|
|
|
62
62
|
|
|
63
63
|
In npm projects `@servicetitan/install` blocks untrusted packages from running any install script (`preinstall`, `install`, and `postinstall`), protecting against supply chain attacks. When an installed package has an untrusted install script, `@servicetitan/install` skips it and warns:
|
|
64
64
|
|
|
65
|
+
Projects that depend on `@servicetitan/startup` automatically trust a small built-in allowlist of packages. Projects that don't depend on `@servicetitan/startup` trust only the packages listed explicitly via `--allow-scripts`.
|
|
66
|
+
|
|
65
67
|
```
|
|
66
68
|
WARNING: The following packages have untrusted install scripts.
|
|
67
69
|
Review and add trusted packages to --allow-scripts:
|
|
@@ -42,10 +42,12 @@ function createProxyConfig({ context, cookie, target }) {
|
|
|
42
42
|
target,
|
|
43
43
|
changeOrigin: true,
|
|
44
44
|
secure: false,
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
on: {
|
|
46
|
+
proxyReq: req => {
|
|
47
|
+
if (cookie) {
|
|
48
|
+
req.setHeader('Cookie', cookie);
|
|
49
|
+
}
|
|
50
|
+
},
|
|
49
51
|
},
|
|
50
52
|
};
|
|
51
53
|
}
|
|
@@ -53,6 +55,10 @@ function createProxyConfig({ context, cookie, target }) {
|
|
|
53
55
|
module.exports = proxy.length ? proxy : undefined;
|
|
54
56
|
```
|
|
55
57
|
|
|
58
|
+
:::note
|
|
59
|
+
Older proxy scripts using the flat `onProxyReq` option (instead of `on: { proxyReq }`) still work; `startup` migrates them automatically and logs a deprecation warning. See [Webpack](../../startup/start/webpack#proxy) for details.
|
|
60
|
+
:::
|
|
61
|
+
|
|
56
62
|
## Put cookies in local configuration file
|
|
57
63
|
|
|
58
64
|
Login to the application and use the web browser's Developer Tools to copy the cookies from backend requests to `config.js`.
|
package/docs/react-ioc.mdx
CHANGED
|
@@ -266,6 +266,56 @@ const SaveButton: React.FC = () => {
|
|
|
266
266
|
|
|
267
267
|
Use this when a service is genuinely optional, for example a logger that is only bound in production builds. The component works either way and skips the call when `Log` is not provided.
|
|
268
268
|
|
|
269
|
+
### `useLocalStores` {#use-local-stores}
|
|
270
|
+
|
|
271
|
+
Instantiates one or more stores **local to the invocation site** and returns `[instances, isInitialized]`, where `instances` holds the stores in argument order. It combines [`provide`](#provide) and [`useDependencies`](#use-dependencies) into a single call: the listed classes are provided and resolved on the spot, with their transitive `@inject` dependencies satisfied from the surrounding container hierarchy if not provided in the `useLocalStores` arguments.
|
|
272
|
+
|
|
273
|
+
```tsx
|
|
274
|
+
import { useLocalStores } from '@servicetitan/react-ioc';
|
|
275
|
+
|
|
276
|
+
function useOrderEditor(orderId: string) {
|
|
277
|
+
const [[orders, drafts], isInitialized] = useLocalStores(OrdersStore, DraftsStore);
|
|
278
|
+
|
|
279
|
+
return {
|
|
280
|
+
// orders and drafts are private to this hook call
|
|
281
|
+
orders,
|
|
282
|
+
drafts,
|
|
283
|
+
|
|
284
|
+
// isInitialized flips to true once every store's `initialize()` promise has settled
|
|
285
|
+
isInitialized,
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
Use this to let a **hook** own its own stores. A `<Provider>` can only supply services to components rendered _below_ it in the tree, so a store consumed inside a hook would otherwise have to be provided by every caller. `useLocalStores` instantiates the store right where the hook runs instead.
|
|
291
|
+
|
|
292
|
+
#### How it differs from `<Provider>`
|
|
293
|
+
|
|
294
|
+
| Aspect | `<Provider>` / `@provide` | `useLocalStores` |
|
|
295
|
+
| :--------------------- | :----------------------------------------------- | :------------------------------------------------------- |
|
|
296
|
+
| Scope | The provided sub-tree | Only the hook invocation |
|
|
297
|
+
| Visible to descendants | Yes — descendants resolve via `useDependencies` | **No** — the instances never enter the React context |
|
|
298
|
+
| Instantiation | Lazy (singletons construct on first resolution) | **Eager** — constructed synchronously when the hook runs |
|
|
299
|
+
| Async `initialize` | Renders `loadingFallback` until it settles | Never blocks rendering; `isInitialized` reports status |
|
|
300
|
+
| Error handling | Renders `errorFallback` if a store's init throws | errors thrown by store `initialize()` re-thrown async |
|
|
301
|
+
|
|
302
|
+
#### Semantics
|
|
303
|
+
|
|
304
|
+
- **One instance per call.** Each listed class is instantiated once per hook invocation and stays stable across re-renders. As with `useDependencies`, changing the argument list on a later render is ignored. Listing the same class twice is an error: it throws in development and collapses onto a single instance (with a console warning) in production.
|
|
305
|
+
- **Siblings share.** If a listed class injects another class listed in the **same** call, it receives that sibling's instance — not one from higher in the context. Dependency graphs between the listed classes are resolved in the correct order automatically.
|
|
306
|
+
- **Transitive dependencies come from above.** Any `@inject` dependency that is _not_ listed in the call must be provided above the callsite by an ordinary `provide()` / `<Provider>` / `@provide`. This is the one part of the hook's contract that leaks to callers: "to use this hook, provide these prerequisites." If a prerequisite is missing, resolution throws.
|
|
307
|
+
- **Lifecycle.** [`Store`](#store-lifecycle) `initialize()` runs on mount and `dispose()` on unmount, for the listed `Store` subclasses only (plain `@injectable` classes get no lifecycle, matching `<Provider>`). Collaborators resolved from above are owned by whoever provided them. Rendering is never gated on `initialize()`; initialization errors are rethrown asynchronously so they reach the global error handler.
|
|
308
|
+
|
|
309
|
+
:::warning Contract
|
|
310
|
+
Because the stores are constructed **during render**, a concurrent render that React discards runs the constructor without ever calling `initialize()` or `dispose()`. Store constructors must therefore be side-effect-free; put side effects in `initialize()`.
|
|
311
|
+
|
|
312
|
+
Unlike `<Provider>`, which builds fresh instances on every mount, the hook retains its instances across a simulated unmount/remount (React `<StrictMode>` in development, `<Activity>` in production). The **same instance** then receives `initialize()`, `dispose()`, `initialize()` — so `dispose()` must leave the store re-initializable rather than permanently torn down.
|
|
313
|
+
:::
|
|
314
|
+
|
|
315
|
+
:::note
|
|
316
|
+
This hook takes bare classes only — no [symbol tokens](#tokens), `useClass`, or `useValue`. For shared, overridable, or token-based bindings, use [`<Provider>`](#provider).
|
|
317
|
+
:::
|
|
318
|
+
|
|
269
319
|
### `@injectDependency` {#inject-dependency}
|
|
270
320
|
|
|
271
321
|
Property decorator for class components.
|
|
@@ -227,6 +227,10 @@ The `*.ts` glob is non-recursive and picks up only root-level config files. The
|
|
|
227
227
|
|
|
228
228
|
:::info
|
|
229
229
|
`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.
|
|
230
|
+
|
|
231
|
+
✨ New in **v38.0.0** ✨
|
|
232
|
+
|
|
233
|
+
`compilerOptions.paths` is mapped automatically, so path aliases resolve during SWC compilation without needing to duplicate them in `swcOptions`.
|
|
230
234
|
:::
|
|
231
235
|
|
|
232
236
|
Use `cli.swc-compile-package` to set or override SWC options. E.g.,
|
|
@@ -22,6 +22,18 @@ To make Vite the default, set `cli.bundler` in the project's root `package.json`
|
|
|
22
22
|
|
|
23
23
|
The `--bundler` flag overrides it per invocation.
|
|
24
24
|
|
|
25
|
+
An individual package can pin its own bundler with a package-level `cli.bundler`, overriding both the flag and the root default. This lets a monorepo mix bundlers, for example keeping legacy packages on webpack while the rest use Vite:
|
|
26
|
+
|
|
27
|
+
```json title="packages/legacy/package.json"
|
|
28
|
+
{
|
|
29
|
+
"cli": {
|
|
30
|
+
"bundler": "webpack"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Each package resolves its bundler in this order: its own `cli.bundler`, then `--bundler`, then the root `cli.bundler`, then webpack.
|
|
36
|
+
|
|
25
37
|
:::tip
|
|
26
38
|
For dev server configuration (port, proxy, HMR), see [Vite start](../start/vite).
|
|
27
39
|
:::
|
|
@@ -208,6 +220,49 @@ export default defineConfig({
|
|
|
208
220
|
|
|
209
221
|
:::
|
|
210
222
|
|
|
223
|
+
## Externalizing to window globals
|
|
224
|
+
|
|
225
|
+
Use `windowExternalsPlugin` from `@servicetitan/startup/vite` to map imports to globals a host exposes on `window`, instead of bundling duplicate copies/instances of a library.
|
|
226
|
+
It is equivalent to webpack's `externals` with `externalsType: 'window'`.
|
|
227
|
+
|
|
228
|
+
It accepts an object where each key is a window property (e.g., `jQuery` -> `window.jQuery`), and the value is a regex (or an object carrying one) that matches the imports resolving to that global. For example,
|
|
229
|
+
|
|
230
|
+
```ts title="vite.prod.config.ts"
|
|
231
|
+
import { defineConfig, windowExternalsPlugin } from '@servicetitan/startup/vite';
|
|
232
|
+
|
|
233
|
+
export default defineConfig({
|
|
234
|
+
config: {
|
|
235
|
+
plugins: [
|
|
236
|
+
windowExternalsPlugin({
|
|
237
|
+
jQuery: /^jquery$/,
|
|
238
|
+
moment: /^(moment|moment-timezone)$/,
|
|
239
|
+
accounting: { match: /^accounting$/, exports: ['formatMoney', 'formatNumber'] },
|
|
240
|
+
arcgis: { match: /^@arcgis\/core\//, member: s => s.split('/').pop() },
|
|
241
|
+
}),
|
|
242
|
+
],
|
|
243
|
+
},
|
|
244
|
+
});
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
```ts
|
|
248
|
+
import $ from 'jquery'; // `$` is `window.jQuery`
|
|
249
|
+
import moment from 'moment'; // `moment` is `window.moment`
|
|
250
|
+
import moment from 'moment-timezone'; // `moment` is `window.moment`
|
|
251
|
+
import { formatMoney } from 'accounting'; // `formatMoney` is `window.accounting.formatMoney`
|
|
252
|
+
import MapView from '@arcgis/core/views/MapView'; // `MapView` is `window.arcgis.MapView`
|
|
253
|
+
import FeatureFilter from '@arcgis/core/layers/support/FeatureFilter'; // `FeatureFilter` is `window.arcgis.FeatureFilter`
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### Values
|
|
257
|
+
|
|
258
|
+
The object values control what imports match to the corresponding global, and what each import resolves to:
|
|
259
|
+
|
|
260
|
+
| When value is | Triggers when import matches | Resolves to |
|
|
261
|
+
| :---------------------------------------------------------- | :--------------------------- | :----------------------------------------------------------------------------------------------------------------- |
|
|
262
|
+
| `RegExp` | `RegExp` | `window.<global>` |
|
|
263
|
+
| `{ match: RegExp, exports: string[] }` | `match` | `window.<global>.<export>` for listed named export and `window.<global>` for default export |
|
|
264
|
+
| `{ match: RegExp, member?: (specifier: string) => string }` | `match` | `window.<global>[<member>]` when `member` returns a string and `window.<global>` when `member` returns falsy value |
|
|
265
|
+
|
|
211
266
|
## Custom HTML Templates
|
|
212
267
|
|
|
213
268
|
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.
|
|
@@ -248,7 +303,7 @@ Example eta template:
|
|
|
248
303
|
<body>
|
|
249
304
|
<div id="root"></div>
|
|
250
305
|
<script type="module">
|
|
251
|
-
import '
|
|
306
|
+
import './<%= it.tsOutDir %>/index';
|
|
252
307
|
</script>
|
|
253
308
|
</body>
|
|
254
309
|
</html>
|
|
@@ -266,6 +321,7 @@ Available template variables:
|
|
|
266
321
|
| `favicon` | `string` | Favicon URL (explicit or auto-detected); may be `undefined` |
|
|
267
322
|
| `css` | `string[]` | Stylesheet entry paths to inject as `<link>` tags |
|
|
268
323
|
| `js` | `string[]` | Script entry paths to inject as `<script>` tags |
|
|
324
|
+
| `tsOutDir` | `string` | TypeScript compiler output dir holding the entry |
|
|
269
325
|
| `name` | `string` | Package/MFE name |
|
|
270
326
|
| `isProduction` | `boolean` | True for production builds |
|
|
271
327
|
| `isWebComponent` | `boolean` | True when building an MFE (web component) |
|
|
@@ -7,7 +7,7 @@ Webpack is the default bundler for `startup build`.
|
|
|
7
7
|
## Minimization
|
|
8
8
|
|
|
9
9
|
`startup` configures webpack to minimize production bundles, using
|
|
10
|
-
[
|
|
10
|
+
[MinimizerWebpackPlugin](https://webpack.js.org/plugins/minimizer-webpack-plugin) for JS bundles
|
|
11
11
|
and [CssMinimizerWebpackPlugin](https://webpack.js.org/plugins/css-minimizer-webpack-plugin)
|
|
12
12
|
for CSS bundles.
|
|
13
13
|
|
|
@@ -21,7 +21,7 @@ to map runtime errors back to source.
|
|
|
21
21
|
|
|
22
22
|
- To turn off minimizing, set `cli.webpack.minify.js` or `cli.webpack.minify.css`, or both, to `false`.
|
|
23
23
|
- To override the default Terser options set `cli.webpack.minify.js` to an object containing
|
|
24
|
-
[`
|
|
24
|
+
[`minimizerOptions`](https://webpack.js.org/plugins/minimizer-webpack-plugin/#minimizeroptions).
|
|
25
25
|
- To override the default CssMinimizerWebpackPlugin options, set `cli.webpack.minify.css` to an object containing
|
|
26
26
|
[CssMinimizerWebpackPlugin options](https://webpack.js.org/plugins/css-minimizer-webpack-plugin/#options).
|
|
27
27
|
|
|
@@ -33,8 +33,8 @@ For example,
|
|
|
33
33
|
"webpack": {
|
|
34
34
|
"minify": {
|
|
35
35
|
"js": {
|
|
36
|
-
//
|
|
37
|
-
// https://webpack.js.org/plugins/
|
|
36
|
+
// minimizer-webpack-plugin minimizerOptions
|
|
37
|
+
// https://webpack.js.org/plugins/minimizer-webpack-plugin/#minimizeroptions
|
|
38
38
|
},
|
|
39
39
|
"css": {
|
|
40
40
|
// css-minimizer-webpack-plugin options
|
package/docs/startup/install.mdx
CHANGED
|
@@ -3,7 +3,8 @@ title: install
|
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
:::danger
|
|
6
|
-
The `startup install` command
|
|
6
|
+
The `startup install` command has been removed. Running it now exits with an error pointing to
|
|
7
|
+
[@servicetitan/install](../install); use that package directly instead.
|
|
7
8
|
:::
|
|
8
9
|
|
|
9
10
|
As `@servicetitan/startup` grew more features, it became too large for simple bootstrapping. The
|
|
@@ -22,6 +22,18 @@ To make Vite the default, set `cli.bundler` in the project's root `package.json`
|
|
|
22
22
|
|
|
23
23
|
The `--bundler` flag overrides it per invocation.
|
|
24
24
|
|
|
25
|
+
An individual package can pin its own bundler with a package-level `cli.bundler`, overriding both the flag and the root default. This lets a monorepo mix bundlers, for example keeping legacy packages on webpack while the rest use Vite:
|
|
26
|
+
|
|
27
|
+
```json title="packages/legacy/package.json"
|
|
28
|
+
{
|
|
29
|
+
"cli": {
|
|
30
|
+
"bundler": "webpack"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Each package resolves its bundler in this order: its own `cli.bundler`, then `--bundler`, then the root `cli.bundler`, then webpack.
|
|
36
|
+
|
|
25
37
|
:::tip
|
|
26
38
|
For build-time configuration (minification, plugin overrides, custom templates), see [Vite build](../build/vite).
|
|
27
39
|
:::
|
|
@@ -104,6 +116,47 @@ Set `cli.vite.devServer` to `false` to run `startup start` without an HTTP dev s
|
|
|
104
116
|
|
|
105
117
|
## Hot Module Replacement
|
|
106
118
|
|
|
107
|
-
Vite provides fast HMR out of the box.
|
|
119
|
+
[Vite provides fast HMR out of the box](https://vite.dev/guide/features#hot-module-replacement). Startup adds a [React Fast Refresh](https://www.npmjs.com/package/react-refresh) bridge for modules compiled by `swc` so TSX edits can update the page without a full reload when React can safely preserve the component tree.
|
|
108
120
|
|
|
109
121
|
For MFEs running in shadow DOM, CSS HMR uses `adoptedStyleSheets`. Style updates are applied to the shadow root automatically without affecting the host page.
|
|
122
|
+
|
|
123
|
+
### Supported HMR updates
|
|
124
|
+
|
|
125
|
+
| Change | Behavior |
|
|
126
|
+
| :----------------------------------------- | :------------------------------------------------------------------------------------------------------------------- |
|
|
127
|
+
| Plain CSS | Updated in place by Vite without React Fast Refresh. |
|
|
128
|
+
| CSS modules | Propagates through the importing JS module and re-renders through React Fast Refresh. |
|
|
129
|
+
| TSX components in the app package | Uses React Fast Refresh when `swc` can identify and register the component and the module exports remain compatible. |
|
|
130
|
+
| TSX components in local workspace packages | Uses React Fast Refresh when the workspace module is served by Vite and contains a compatible refresh boundary. |
|
|
131
|
+
| Embedded MFE TSX/CSS served by Vite | Updates through the MFE dev server without reloading the host page when the changed module can be safely updated. |
|
|
132
|
+
|
|
133
|
+
### When Startup falls back to a full reload
|
|
134
|
+
|
|
135
|
+
React Fast Refresh only works when `swc` emits component registration markers and the edited module remains a safe refresh boundary. Startup lets Vite perform a full reload when the module cannot be safely refreshed.
|
|
136
|
+
|
|
137
|
+
Common cases that reload instead of refresh:
|
|
138
|
+
|
|
139
|
+
- A module has hook signature markers but no registered component family.
|
|
140
|
+
- A component is hidden behind a pattern `swc` cannot statically identify, such as returning an anonymous component from a higher-order function call.
|
|
141
|
+
- A refresh boundary adds or removes an export.
|
|
142
|
+
- A non-component export changes value.
|
|
143
|
+
- A module exposes exports through getters, which Startup does not evaluate during boundary validation.
|
|
144
|
+
- The edited module is outside the local workspace packages and is treated as third-party code.
|
|
145
|
+
|
|
146
|
+
Hook signature changes, such as adding, removing, or reordering hooks, are handled by React Fast Refresh. React remounts that component to avoid reusing invalid state slots, but that is not the same as a full page reload.
|
|
147
|
+
|
|
148
|
+
For best results, export React components as function declarations or named arrow-function variables so `swc` can register them.
|
|
149
|
+
|
|
150
|
+
### Linting refresh boundaries
|
|
151
|
+
|
|
152
|
+
To keep React Fast Refresh working as often as possible, enable [`eslint-plugin-react-refresh`](https://github.com/ArnaudBarre/eslint-plugin-react-refresh) in applications that use Vite. Its `react-refresh/only-export-components` rule catches modules whose exports would make React Fast Refresh unsafe, such as mixing changed non-component exports with component exports.
|
|
153
|
+
|
|
154
|
+
```js title="eslint.config.mjs"
|
|
155
|
+
import { defineConfig } from 'eslint/config';
|
|
156
|
+
import mono from '@servicetitan/eslint-config/mono';
|
|
157
|
+
import { reactRefresh } from 'eslint-plugin-react-refresh';
|
|
158
|
+
|
|
159
|
+
export default defineConfig([mono, reactRefresh.configs.recommended()]);
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
This lint rule is not required for Startup's Vite dev server to work. It helps teams avoid patterns that force Vite to invalidate the module and reload the page instead of applying React Fast Refresh.
|
|
@@ -34,6 +34,24 @@ Use `cli.webpack.devServer` to set or override `webpack-dev-server` options.
|
|
|
34
34
|
}
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
+
### Proxy
|
|
38
|
+
|
|
39
|
+
Use `cli.webpack.proxy` to set the `webpack-dev-server` [proxy](https://webpack.js.org/configuration/dev-server/#devserverproxy) configuration, either inline or as the relative path to a script that exports it. See [Authentication](../../microfrontends/developing/authentication) for an example that proxies requests with an authentication cookie.
|
|
40
|
+
|
|
41
|
+
```json title="package.json"
|
|
42
|
+
{
|
|
43
|
+
"cli": {
|
|
44
|
+
"webpack": {
|
|
45
|
+
"proxy": "../../local/proxy-settings.js"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
:::note
|
|
52
|
+
Proxy configs written against `webpack-dev-server` 5.x and earlier commonly used flat event options such as `onProxyReq`, `onProxyRes`, `onProxyReqWs`, `onOpen`, `onClose`, and `onError`. `webpack-dev-server` 6.x moved these under an `on` object (for example, `on: { proxyReq }`). `startup` migrates the legacy options to `on` automatically and logs a deprecation warning; update existing configs to the `on` object when convenient, since the automatic migration may be removed in a future release.
|
|
53
|
+
:::
|
|
54
|
+
|
|
37
55
|
### Disabling the dev server
|
|
38
56
|
|
|
39
57
|
Set `cli.webpack.devServer` to `false` to run `startup start` without an HTTP dev server. Webpack instead builds in watch mode, recompiling to the output directory on every change, so a separate server can serve the files from disk.
|
package/docs/startup/startup.mdx
CHANGED
|
@@ -25,7 +25,7 @@ Updating build tooling is typically a daunting and time-consuming task. When new
|
|
|
25
25
|
`startup` supports two bundlers:
|
|
26
26
|
|
|
27
27
|
- **Webpack**: the default bundler.
|
|
28
|
-
- **Vite** (✨ New in **v37.0.0** ✨): opt-in via `--bundler=vite` or `cli.bundler` in project's root `package.json`.
|
|
28
|
+
- **Vite** (✨ New in **v37.0.0** ✨): opt-in via `--bundler=vite` or `cli.bundler` in the project's root `package.json`. Individual packages can pin their own bundler with a package-level `cli.bundler`.
|
|
29
29
|
|
|
30
30
|
See [build](./build) and [start](./start) for bundler-specific configuration.
|
|
31
31
|
|
|
@@ -39,7 +39,7 @@ Already on webpack and want to switch? See [Migrating to Vite](https://docs.st.d
|
|
|
39
39
|
- [clean](./clean) resets project to fresh state
|
|
40
40
|
- [convert-eslint-config](./convert-eslint-config) convert v8.x eslintrc.json to v9.x flat config
|
|
41
41
|
- [init](./init) create example project
|
|
42
|
-
- [install](./install) install
|
|
42
|
+
- [install](./install) removed; use `@servicetitan/install` directly
|
|
43
43
|
- [kendo-ui-license](./kendo-ui-license) install KendoReact license key
|
|
44
44
|
- [lint](./lint) run eslint and stylelint
|
|
45
45
|
- [mfe-check](./mfe-check) check MFE/host dependency compatibility
|
|
@@ -63,14 +63,10 @@ Use `cli.NODE_OPTIONS` or `cli.*.NODE_OPTIONS` to set or override Node options f
|
|
|
63
63
|
"cli": {
|
|
64
64
|
"NODE_OPTIONS": ["--max_old_space_size=4096"], // NODE_OPTIONS for all commands
|
|
65
65
|
"lint": {
|
|
66
|
-
"NODE_OPTIONS": [
|
|
67
|
-
/* NODE_OPTIONS for lint command */
|
|
68
|
-
]
|
|
66
|
+
"NODE_OPTIONS": [/* NODE_OPTIONS for lint command */]
|
|
69
67
|
},
|
|
70
68
|
"test": {
|
|
71
|
-
"NODE_OPTIONS": [
|
|
72
|
-
/* NODE_OPTIONS for test command */
|
|
73
|
-
]
|
|
69
|
+
"NODE_OPTIONS": [/* NODE_OPTIONS for test command */]
|
|
74
70
|
}
|
|
75
71
|
}
|
|
76
72
|
}
|
|
@@ -121,10 +117,7 @@ const { swc, webpackFinal } = require('@servicetitan/startup/storybook-config');
|
|
|
121
117
|
const config: StorybookConfig = {
|
|
122
118
|
framework: '@storybook/react-webpack5',
|
|
123
119
|
stories: ['../src/**/*.stories.ts?(x)'],
|
|
124
|
-
webpackFinal: config =>
|
|
125
|
-
webpackFinal(config, {
|
|
126
|
-
/* Custom webpack overrides */
|
|
127
|
-
}),
|
|
120
|
+
webpackFinal: config => webpackFinal(config, {/* Custom webpack overrides */}),
|
|
128
121
|
swc,
|
|
129
122
|
};
|
|
130
123
|
|
|
@@ -173,9 +166,7 @@ const config: StorybookConfig = {
|
|
|
173
166
|
framework: '@storybook/react-vite',
|
|
174
167
|
stories: ['../src/**/*.stories.ts?(x)'],
|
|
175
168
|
viteFinal: (config, options) =>
|
|
176
|
-
mergeConfig(viteFinal(config, options), {
|
|
177
|
-
/* Custom Vite config */
|
|
178
|
-
}),
|
|
169
|
+
mergeConfig(viteFinal(config, options), {/* Custom Vite config */}),
|
|
179
170
|
};
|
|
180
171
|
|
|
181
172
|
export default config;
|
|
@@ -218,9 +209,7 @@ export default defineConfig({
|
|
|
218
209
|
devServer: {
|
|
219
210
|
framework: 'react',
|
|
220
211
|
bundler: 'webpack',
|
|
221
|
-
webpackConfig: webpackConfig({
|
|
222
|
-
/* Custom webpack overrides */
|
|
223
|
-
}),
|
|
212
|
+
webpackConfig: webpackConfig({/* Custom webpack overrides */}),
|
|
224
213
|
},
|
|
225
214
|
},
|
|
226
215
|
});
|
|
@@ -260,9 +249,7 @@ export default defineConfig({
|
|
|
260
249
|
devServer: {
|
|
261
250
|
framework: 'react',
|
|
262
251
|
bundler: 'vite',
|
|
263
|
-
viteConfig: viteConfig({
|
|
264
|
-
/* Vite InlineConfig overrides */
|
|
265
|
-
}),
|
|
252
|
+
viteConfig: viteConfig({/* Vite InlineConfig overrides */}),
|
|
266
253
|
},
|
|
267
254
|
},
|
|
268
255
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/docs-uikit",
|
|
3
|
-
"version": "38.
|
|
3
|
+
"version": "38.2.0",
|
|
4
4
|
"description": "Documentation content for Uikit packages published at docs.st.dev",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -16,5 +16,5 @@
|
|
|
16
16
|
"cli": {
|
|
17
17
|
"webpack": false
|
|
18
18
|
},
|
|
19
|
-
"gitHead": "
|
|
19
|
+
"gitHead": "fd8cf00982a529371e44d76a0ca455dbbb42bae5"
|
|
20
20
|
}
|