@servicetitan/docs-uikit 40.1.0 → 40.2.1
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/ajax-handlers/block-global-assignments.mdx +69 -0
- package/docs/datadog-rum.mdx +53 -8
- package/docs/eslint-config.mdx +28 -1
- package/docs/install.mdx +18 -0
- package/docs/startup/build/vite.mdx +1 -7
- package/docs/startup/lint.mdx +9 -0
- package/docs/startup/startup.mdx +2 -1
- package/docs/startup/type-check.mdx +37 -0
- package/package.json +1 -1
|
@@ -16,3 +16,4 @@ See [Cancelation handling](./cancelation-handling.mdx) for how to handle cancela
|
|
|
16
16
|
- [withMicroservice](./with-microservice.mdx) - Use to wrap components and authenticate requests to protected resources with support for Bearer and Token Server authentication.
|
|
17
17
|
- [initAjaxHandlersLoginRequired](./init-ajax-handlers-login-required.mdx) - Use to register handler for invalid TokenServer session.
|
|
18
18
|
- [initAjaxHandlersParseDates](./init-ajax-handlers-parse-dates.mdx) - Use to automatically transform date strings in axios responses into JavaScript Date objects.
|
|
19
|
+
- [blockGlobalAssignments](./block-global-assignments.mdx) - Use to block assignments to browser globals, such as `fetch`, from the scripts that you choose.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: blockGlobalAssignments
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
`blockGlobalAssignments` blocks assignments to browser globals, such as `fetch`, `XMLHttpRequest`, and `console`, from the scripts that `from` matches.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
Call `blockGlobalAssignments` before the first script that you block runs. Put the call at the top of the app's entry module. An assignment made before the call stays in place, and a later call skips each property that an earlier call protects.
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { blockGlobalAssignments } from '@servicetitan/ajax-handlers/block-global-assignments';
|
|
13
|
+
|
|
14
|
+
blockGlobalAssignments({
|
|
15
|
+
globals: [
|
|
16
|
+
{ object: window, properties: ['fetch'] },
|
|
17
|
+
{ object: XMLHttpRequest.prototype, properties: ['open', 'send', 'abort'] },
|
|
18
|
+
{ object: console, properties: ['log', 'debug', 'info', 'warn', 'error'] },
|
|
19
|
+
],
|
|
20
|
+
from: /^https:\/\/unpkg\.servicetitan\.com\/@servicetitan\//,
|
|
21
|
+
});
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Assignments from every other script pass through. The example blocks MFE bundles, which load from `https://unpkg.servicetitan.com/@servicetitan/`. A script whose assignment is blocked keeps running with the current version of the global.
|
|
25
|
+
|
|
26
|
+
:::caution
|
|
27
|
+
Only a plain assignment is blocked. A script can still replace a protected property with `Object.defineProperty` or remove it with `delete`. After either call, the property is unprotected, so later assignments from any script succeed.
|
|
28
|
+
:::
|
|
29
|
+
|
|
30
|
+
## onAttempt
|
|
31
|
+
|
|
32
|
+
`onAttempt` is called for each assignment to a protected property, from any script. `blocked` is `true` when `blockGlobalAssignments` dropped the assignment.
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
import { blockGlobalAssignments } from '@servicetitan/ajax-handlers/block-global-assignments';
|
|
36
|
+
|
|
37
|
+
blockGlobalAssignments({
|
|
38
|
+
globals: [{ object: XMLHttpRequest.prototype, properties: ['open', 'send', 'abort'] }],
|
|
39
|
+
from: /^https:\/\/unpkg\.servicetitan\.com\/@servicetitan\//,
|
|
40
|
+
onAttempt: ({ property, url, blocked }) =>
|
|
41
|
+
console.info('block-global-assignments', property, url, blocked),
|
|
42
|
+
});
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## API
|
|
46
|
+
|
|
47
|
+
### Options {#block-global-assignments-options}
|
|
48
|
+
|
|
49
|
+
| Name | Type | Description |
|
|
50
|
+
| :---------- | :---------------------------------------------- | :------------------------------------------------------------------------------ |
|
|
51
|
+
| `globals` | [`GlobalProperties<T>`](#global-properties)`[]` | The objects and properties to protect. |
|
|
52
|
+
| `from` | `RegExp` | Matches the URLs of the scripts whose assignments are blocked. |
|
|
53
|
+
| `onAttempt` | `(attempt: AssignmentAttempt) => void` | (optional) Called for each assignment to a protected property, from any script. |
|
|
54
|
+
|
|
55
|
+
### `GlobalProperties<T>` {#global-properties}
|
|
56
|
+
|
|
57
|
+
| Name | Type | Description |
|
|
58
|
+
| :----------- | :--------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
59
|
+
| `object` | `T` | The object that owns the properties, such as `window`. |
|
|
60
|
+
| `properties` | `(keyof T & string)[]` | The properties to protect, such as `['fetch']`. A property is skipped when `object` has no own property of that name, when the property is not configurable, or when it is a data property that is not writable. |
|
|
61
|
+
|
|
62
|
+
### `AssignmentAttempt`
|
|
63
|
+
|
|
64
|
+
| Name | Type | Description |
|
|
65
|
+
| :--------- | :-------------------- | :--------------------------------------------------------------------------- |
|
|
66
|
+
| `object` | `object` | The object that owns the property. |
|
|
67
|
+
| `property` | `string` | The property that a script assigned, such as `send`. |
|
|
68
|
+
| `url` | `string \| undefined` | The script that made the assignment, or `undefined` when no script is known. |
|
|
69
|
+
| `blocked` | `boolean` | `true` when `blockGlobalAssignments` dropped the assignment. |
|
package/docs/datadog-rum.mdx
CHANGED
|
@@ -27,7 +27,7 @@ RUM events go through three enrichment stages: built-in attribution (MFE name, v
|
|
|
27
27
|
```ts title="datadog-entry.ts"
|
|
28
28
|
import { init } from '@servicetitan/datadog-rum';
|
|
29
29
|
|
|
30
|
-
export const isEnabled =
|
|
30
|
+
export const isEnabled = /(?:^|\.)go\d*\.servicetitan\.com\.?$/i.test(window.location.hostname);
|
|
31
31
|
|
|
32
32
|
const desktopRegistration = init({
|
|
33
33
|
service: {
|
|
@@ -39,7 +39,7 @@ const desktopRegistration = init({
|
|
|
39
39
|
application: {
|
|
40
40
|
applicationId: '<APPLICATION_ID>',
|
|
41
41
|
clientToken: '<CLIENT_TOKEN>',
|
|
42
|
-
env:
|
|
42
|
+
env: '<ENV>', // see "env" under ApplicationConfig
|
|
43
43
|
version: '<APPLICATION_VERSION>',
|
|
44
44
|
// Host-wide noise suppression. Locked at init, applies app-wide.
|
|
45
45
|
excludedActivityUrls: [/fullstory\.com/, /pendo\.io/, /\/Log\/Send/],
|
|
@@ -122,7 +122,7 @@ const { cleanup, setServiceContext } = init({
|
|
|
122
122
|
// optional: ignored when a host offered or already started an application
|
|
123
123
|
applicationId: '<TASK_HUB_APPLICATION_ID>',
|
|
124
124
|
clientToken: '<TASK_HUB_CLIENT_TOKEN>',
|
|
125
|
-
env:
|
|
125
|
+
env: '<ENV>', // see "env" under ApplicationConfig
|
|
126
126
|
},
|
|
127
127
|
});
|
|
128
128
|
|
|
@@ -136,6 +136,19 @@ cleanup();
|
|
|
136
136
|
</TabItem>
|
|
137
137
|
</Tabs>
|
|
138
138
|
|
|
139
|
+
## Service attribution {#attribution}
|
|
140
|
+
|
|
141
|
+
Every event is tagged with the service it came from. For MFEs loaded from unpkg, the built-in enrichment looks for the first `unpkg.servicetitan.com/@servicetitan/<name>@<version>` URL in the event and sets `service` and `version` from it. Events with no such URL keep the application's service, i.e. the host.
|
|
142
|
+
|
|
143
|
+
| Event | Service comes from |
|
|
144
|
+
| :---------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
145
|
+
| `error` | The error's own stack (where it was thrown), then its message. Errors with no stack of their own, such as `console.error('text')`, use the handling stack (where it was logged) instead. |
|
|
146
|
+
| `resource` | The handling stack (the code that started the request), then the resource URL. |
|
|
147
|
+
| `action` | For a custom action, the code that called `addAction`. For a click, the MFE that was clicked. A click inside a nested MFE goes to the nested MFE. |
|
|
148
|
+
| `long_task` | For a long animation frame, the MFE whose script ran longest. `@context.loafServices` lists every MFE that ran a script in the frame. |
|
|
149
|
+
| `view` | For a view started with `startView`, the MFE that started it. Requires `@datadog/browser-rum` 6.27.0 or later. |
|
|
150
|
+
| others | The handling stack, when the SDK provides one. |
|
|
151
|
+
|
|
139
152
|
## API
|
|
140
153
|
|
|
141
154
|
| Name | Description |
|
|
@@ -157,7 +170,7 @@ Any caller — host or MFE — may pass `application`. The first `application` p
|
|
|
157
170
|
```ts
|
|
158
171
|
import { init } from '@servicetitan/datadog-rum';
|
|
159
172
|
|
|
160
|
-
const isEnabled =
|
|
173
|
+
const isEnabled = /(?:^|\.)go\d*\.servicetitan\.com\.?$/i.test(window.location.hostname);
|
|
161
174
|
|
|
162
175
|
const { cleanup, setServiceContext } = init({
|
|
163
176
|
service: {
|
|
@@ -172,7 +185,7 @@ const { cleanup, setServiceContext } = init({
|
|
|
172
185
|
application: {
|
|
173
186
|
applicationId: '<APPLICATION_ID>',
|
|
174
187
|
clientToken: '<CLIENT_TOKEN>',
|
|
175
|
-
env:
|
|
188
|
+
env: '<ENV>', // see "env" under ApplicationConfig
|
|
176
189
|
version: '<APPLICATION_VERSION>',
|
|
177
190
|
excludedActivityUrls: [/fullstory\.com/, /pendo\.io/, /\/Log\/Send/],
|
|
178
191
|
beforeSend: event => {
|
|
@@ -245,6 +258,38 @@ Where:
|
|
|
245
258
|
`excludedActivityUrls` tells RUM which URLs not to count toward view-loading time. The exclusion applies app-wide; the `application` config that starts the session locks the list, so the host should set the complete list there. If an MFE set it, its choices would distort view metrics for the host and any other MFEs sharing the session.
|
|
246
259
|
:::
|
|
247
260
|
|
|
261
|
+
##### `env` {#env}
|
|
262
|
+
|
|
263
|
+
Set `env` to the deployment stage: `go`, `stage`, `next`, `practice`, `integration`, `qa`, `dev`, or `test`.
|
|
264
|
+
|
|
265
|
+
:::caution
|
|
266
|
+
Do not use the hostname as `env`. Each tenant subdomain, such as `acme.eh.go.servicetitan.com`, then reports its own `env`, and dashboards and monitors that filter on `env:go` miss those tenants.
|
|
267
|
+
:::
|
|
268
|
+
|
|
269
|
+
Check the production host first, then use [`getValueForEnvironment`](./web-components/get-value-for-environment) for the other stages. `getValueForEnvironment` matches `<key>.servicetitan.com` as a substring, so a sharded production host such as `go2.servicetitan.com` falls through to the default.
|
|
270
|
+
|
|
271
|
+
```ts
|
|
272
|
+
import { getValueForEnvironment } from '@servicetitan/web-components';
|
|
273
|
+
|
|
274
|
+
const isProdHost = /(?:^|\.)go\d*\.servicetitan\.com\.?$/i.test(window.location.hostname);
|
|
275
|
+
|
|
276
|
+
const env = isProdHost
|
|
277
|
+
? 'go'
|
|
278
|
+
: getValueForEnvironment(
|
|
279
|
+
{
|
|
280
|
+
'stage': 'stage',
|
|
281
|
+
'next': 'next',
|
|
282
|
+
'practice': 'practice',
|
|
283
|
+
'integration': 'integration',
|
|
284
|
+
'qa': 'qa',
|
|
285
|
+
'qa.st.dev': 'qa',
|
|
286
|
+
'dev': 'dev',
|
|
287
|
+
'test': 'test',
|
|
288
|
+
},
|
|
289
|
+
'dev'
|
|
290
|
+
);
|
|
291
|
+
```
|
|
292
|
+
|
|
248
293
|
### `useRumService`
|
|
249
294
|
|
|
250
295
|
React hook that wraps [`init`](#init) for service-only registration. The service is registered on mount and disposed on unmount; the config is captured on first render — changing it across renders does not re-register.
|
|
@@ -295,7 +340,7 @@ datadogRumForDev.stop(); // clear the override; return to the shipped default
|
|
|
295
340
|
|
|
296
341
|
Sessions enabled this way are tagged with a `datadogRumForDev` context attribute. Filter `@context.datadogRumForDev:true` in Datadog RUM to find them, or `-@context.datadogRumForDev:true` to exclude them from production dashboards.
|
|
297
342
|
|
|
298
|
-
**Set `env`
|
|
343
|
+
**Set [`env`](#env) to the deployment stage before you rely on this.** The override turns RUM on in lower environments, and the deployment stage in `env` keeps their sessions apart from production data in dashboards and monitors.
|
|
299
344
|
|
|
300
345
|
#### Multiple tabs
|
|
301
346
|
|
|
@@ -401,7 +446,7 @@ This is the legacy API, kept for backward compatibility. New applications should
|
|
|
401
446
|
import { beforeSend } from '@servicetitan/datadog-rum';
|
|
402
447
|
import { datadogRum } from '@datadog/browser-rum';
|
|
403
448
|
|
|
404
|
-
const isEnabled =
|
|
449
|
+
const isEnabled = /(?:^|\.)go\d*\.servicetitan\.com\.?$/i.test(window.location.hostname);
|
|
405
450
|
|
|
406
451
|
if (isEnabled) {
|
|
407
452
|
datadogRum.init({
|
|
@@ -409,7 +454,7 @@ if (isEnabled) {
|
|
|
409
454
|
clientToken: '<CLIENT_TOKEN>',
|
|
410
455
|
site: 'datadoghq.com',
|
|
411
456
|
service: '<SERVICE_NAME>',
|
|
412
|
-
env: '<
|
|
457
|
+
env: '<ENV>', // see "env" under ApplicationConfig
|
|
413
458
|
version: '<APPLICATION_VERSION>',
|
|
414
459
|
sessionSampleRate: 100,
|
|
415
460
|
sessionReplaySampleRate: 0,
|
package/docs/eslint-config.mdx
CHANGED
|
@@ -114,10 +114,37 @@ export default defineConfig([
|
|
|
114
114
|
The Stylelint config extends [`stylelint-config-standard`](https://github.com/stylelint/stylelint-config-standard) and [`stylelint-prettier`](https://github.com/prettier/stylelint-prettier), applies the matching standard extensions for `.scss` and `.less` files, and adds two ServiceTitan rules:
|
|
115
115
|
|
|
116
116
|
- `@servicetitan/function-url-no-absolute` rejects absolute paths inside `url()` values.
|
|
117
|
-
- `@servicetitan/use-tokens` requires design tokens
|
|
117
|
+
- `@servicetitan/use-tokens` requires design tokens instead of raw values. See [`@servicetitan/use-tokens`](#use-tokens).
|
|
118
118
|
|
|
119
119
|
```json title=".stylelintrc.json"
|
|
120
120
|
{
|
|
121
121
|
"extends": ["@servicetitan/stylelint-config"]
|
|
122
122
|
}
|
|
123
123
|
```
|
|
124
|
+
|
|
125
|
+
#### `@servicetitan/use-tokens` {#use-tokens}
|
|
126
|
+
|
|
127
|
+
The rule reports raw values that match a design token and suggests the token instead. It reads tokens from whichever of these packages the project installs, and reports nothing when neither is installed:
|
|
128
|
+
|
|
129
|
+
| Package | Tokens | Categories |
|
|
130
|
+
| :-------------------------- | :--------------- | :-------------------------------------------------------------------------------------------------------- |
|
|
131
|
+
| `@servicetitan/tokens` | All tokens | Colors, spacing, border radii, font families and weights, line heights, opacities, type scales, z-indexes |
|
|
132
|
+
| `@servicetitan/anvil2` 1.9+ | Primitive tokens | Colors, spacing, border radii, line heights, font families, sizes, and weights |
|
|
133
|
+
|
|
134
|
+
The rule doesn't suggest Anvil2 semantic tokens. They hold separate light and dark values, so a raw value doesn't identify which one applies.
|
|
135
|
+
|
|
136
|
+
Suggestions match the file type:
|
|
137
|
+
|
|
138
|
+
| File | `@servicetitan/tokens` | `@servicetitan/anvil2` |
|
|
139
|
+
| :------ | :---------------------- | :------------------------- |
|
|
140
|
+
| `.css` | `var(--color-blue-500)` | `var(--a2-color-blue-600)` |
|
|
141
|
+
| `.less` | `@color-blue-500` | `var(--a2-color-blue-600)` |
|
|
142
|
+
| `.scss` | `$color-blue-500` | `$color-blue-600` |
|
|
143
|
+
|
|
144
|
+
Anvil2 publishes no Less variables, so in .less files the rule suggests Anvil2's CSS custom properties instead. Anvil2 versions before 3 don't prefix custom properties, so the rule suggests `var(--color-blue-600)` for them.
|
|
145
|
+
|
|
146
|
+
When a value matches tokens from both packages, the rule lists each one and `--fix` leaves the value for you to choose.
|
|
147
|
+
|
|
148
|
+
:::caution
|
|
149
|
+
`--fix` replaces values but doesn't add imports. Sass and Less files must already import the token package's variables, and pages must load its CSS custom properties. A missing Sass or Less variable fails the build, but a missing custom property makes the declaration silently stop applying.
|
|
150
|
+
:::
|
package/docs/install.mdx
CHANGED
|
@@ -116,6 +116,24 @@ pnpm has no per-invocation flag for minimum release age; it must be configured d
|
|
|
116
116
|
WARNING: this project does not enforce a minimum release age for pnpm installs. Configure minimumReleaseAge in pnpm-workspace.yaml.
|
|
117
117
|
```
|
|
118
118
|
|
|
119
|
+
## npx Confirmation
|
|
120
|
+
|
|
121
|
+
In development environments, `@servicetitan/install` sets npm's [`yes`](https://docs.npmjs.com/cli/v11/using-npm/config#yes) option to `false` in your per-user configuration. With this setting, `npx` refuses to download and run a package that isn't already installed, so a typosquatted or compromised package can't run silently. Instead of silently downloading and running the package, it reports:
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
npx canceled due to missing packages and no YES option: ["some-package@1.2.3"]
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
To confirm that you want to run the package, add `--yes`:
|
|
128
|
+
|
|
129
|
+
```sh
|
|
130
|
+
npx --yes some-package
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
:::caution
|
|
134
|
+
`@servicetitan/install` only sets the option when it is unset. You can opt out by running `npm config set yes=true --location=user`, but this is dangerous and not recommended.
|
|
135
|
+
:::
|
|
136
|
+
|
|
119
137
|
## Configuring NPM Token in Development
|
|
120
138
|
|
|
121
139
|
In development environments, `@servicetitan/install` automatically configures an npm authentication token that grants access to private ServiceTitan packages. It securely retrieves the token and updates your npm configuration so you can install dependencies without any further setup.
|
|
@@ -188,7 +188,7 @@ import { defineConfig } from '@servicetitan/startup/vite';
|
|
|
188
188
|
export default defineConfig(context => {
|
|
189
189
|
// context.build — { name, isProduction, light, headless }
|
|
190
190
|
// context.package — { destination, isWebComponent, sharedDependencies, ... }
|
|
191
|
-
// context.options
|
|
191
|
+
// context.options — { codeCoverage, buildStat }
|
|
192
192
|
|
|
193
193
|
return {
|
|
194
194
|
config: { ... },
|
|
@@ -343,9 +343,3 @@ npx startup build --bundler=vite --preview
|
|
|
343
343
|
```
|
|
344
344
|
|
|
345
345
|
The preview server is useful for validating production builds locally before deploying.
|
|
346
|
-
|
|
347
|
-
## Not Yet Supported
|
|
348
|
-
|
|
349
|
-
The following features are planned but not yet available with the Vite bundler:
|
|
350
|
-
|
|
351
|
-
- `--stat`: bundle analysis report
|
package/docs/startup/lint.mdx
CHANGED
|
@@ -25,6 +25,15 @@ npx startup lint -- packages/desktop/app/modules/{lead,inventory}/
|
|
|
25
25
|
| `--ignore <glob>` | Exclude packages with names matching the given glob. |
|
|
26
26
|
| `--fix` | Fix linting issues. |
|
|
27
27
|
|
|
28
|
+
## Custom formatters
|
|
29
|
+
|
|
30
|
+
The underlying `startup eslint` and `startup stylelint` commands accept a `--format <name|path>` option: either the name of a built-in formatter or a path to a custom formatter module. The default is unchanged: `stylish` for ESLint and `string` for Stylelint.
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
npx startup eslint packages/foo --format json
|
|
34
|
+
npx startup stylelint packages/foo --format ./my-stylelint-formatter.js
|
|
35
|
+
```
|
|
36
|
+
|
|
28
37
|
## Configuration
|
|
29
38
|
|
|
30
39
|
Use `cli.lint` to set or override `ESLint` and `Stylelint` options. E.g,
|
package/docs/startup/startup.mdx
CHANGED
|
@@ -49,6 +49,7 @@ Already on webpack and want to switch? See [Migrating to Vite](https://docs.st.d
|
|
|
49
49
|
- [review](./review) check project for configuration errors
|
|
50
50
|
- [start](./start) run project in development mode
|
|
51
51
|
- [test](./test) run tests
|
|
52
|
+
- [type-check](./type-check) type check project
|
|
52
53
|
|
|
53
54
|
## Configuration
|
|
54
55
|
|
|
@@ -73,7 +74,7 @@ Use `cli.NODE_OPTIONS` or `cli.*.NODE_OPTIONS` to set or override Node options f
|
|
|
73
74
|
```
|
|
74
75
|
|
|
75
76
|
:::tip
|
|
76
|
-
`Startup` automatically uses `--max_old_space_size` to increase available memory for memory intensive commands like `build`, `start`, `lint` and `
|
|
77
|
+
`Startup` automatically uses `--max_old_space_size` to increase available memory for memory intensive commands like `build`, `start`, `lint`, `test` and `type-check`.
|
|
77
78
|
:::
|
|
78
79
|
|
|
79
80
|
## Storybook Configuration
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: type-check
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
Type checks the project without building it.
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npx startup type-check [paths...]
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
With no arguments it checks the entire project. Pass a list of files or folders to only check packages affected by changes:
|
|
12
|
+
|
|
13
|
+
```sh
|
|
14
|
+
npx startup type-check packages/foo/src/index.ts packages/bar/src/utils.ts
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Use it as a `package.json` script:
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"scripts": {
|
|
22
|
+
"type-check": "startup type-check"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Options
|
|
28
|
+
|
|
29
|
+
TypeScript, by design, checks entire projects, each defined by a `tsconfig.json`. It can't check individual files or folders with a project's settings, so options narrow the check to specific packages.
|
|
30
|
+
|
|
31
|
+
Checking a package also checks every package it depends on, because TypeScript needs their types; `--ignore` won't skip those. With paths, the check also includes packages that depend on the paths' packages, to catch errors a change causes outside the specified paths.
|
|
32
|
+
|
|
33
|
+
| Option | Description |
|
|
34
|
+
| :----------- | :------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
35
|
+
| `[paths...]` | Checks the packages that contain these files or folders. Reports errors anywhere, not just in the specified paths. Combines with `--scope`. |
|
|
36
|
+
| `--scope` | Checks these packages. Accepts package names or glob patterns. |
|
|
37
|
+
| `--ignore` | Skips these packages. Accepts package names or glob patterns. |
|