@servicetitan/docs-uikit 28.5.0 → 30.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.
@@ -2,6 +2,27 @@
2
2
  title: BREAKING CHANGES
3
3
  ---
4
4
 
5
+ ## v30.0.0
6
+
7
+ ### [@servicetitan/startup](./startup)
8
+
9
+ - Upgraded ESLint to v9.x and dropped support for legacy "eslintrc" configuration. See [Upgrading to ESLint v9.x](/docs/frontend/upgrading-to-eslint-v9) for guidance.
10
+
11
+ ### [@servicetitan/eslint-config](./eslint-config)
12
+
13
+ - Dropped support for legacy "eslintrc" configuration
14
+
15
+ ## v29.0.0
16
+
17
+ ### [@servicetitan/startup](./startup)
18
+
19
+ - Dropped support for Node 18.
20
+ Update Github workflows and Docker containers to use Node v20 or later, and bump the `engines.node` property in package.json files to >=20 or >=22.
21
+
22
+ - Added safeguards to mfe-publish to avoid accidentally deleting production bundles
23
+ - Changed `--clean` to never remove old versions that have a tag
24
+ - Changed the default behavior of `--clean` to only remove old versions from the current branch. Use `--branch` to remove old versions from a different branch and use `--all` to remove old versions from all branches.
25
+
5
26
  ## v28.0.0
6
27
 
7
28
  ### [@servicetitan/startup](./startup)
@@ -86,7 +86,7 @@ See [Authentication Adapters](#authentication-adapters) for more information.
86
86
 
87
87
  The authentication endpoint for protected resources.
88
88
 
89
- - For **Bearer** authentication, this is the endpoint that returns the bearer token to send in **Authorization** headers. Defaults to `${baseURL}/bff/silent-login`.
89
+ - For **Bearer** authentication, this is the endpoint that returns the bearer token to send in **Authorization** headers. Defaults to `${baseURL}/auth`.
90
90
 
91
91
  - For **Token server** authentication, this is the "silent login" endpoint. Defaults to `${baseURL}/bff/silent-login`.
92
92
 
@@ -20,18 +20,20 @@ title: ESLint & Stylelint configurations
20
20
 
21
21
  #### In the Lerna project
22
22
 
23
- ```json title=".eslintrc.json"
24
- {
25
- "extends": ["@servicetitan/eslint-config/mono"]
26
- }
23
+ ```js title="eslint.config.js"
24
+ import { defineConfig } from 'eslint/config';
25
+ import mono from '@servicetitan/eslint-config/mono';
26
+
27
+ export default defineConfig(mono);
27
28
  ```
28
29
 
29
30
  #### Without Lerna
30
31
 
31
- ```json title=".eslintrc.json"
32
- {
33
- "extends": ["@servicetitan/eslint-config/single"]
34
- }
32
+ ```js title="eslint.config.js"
33
+ import { defineConfig } from 'eslint/config';
34
+ import single from '@servicetitan/eslint-config/single';
35
+
36
+ export default defineConfig(single);
35
37
  ```
36
38
 
37
39
  ### Stylelint
@@ -18,9 +18,22 @@ Folder schema is a flexible tool to configure a strict hierarchy of files in you
18
18
 
19
19
  Contains `@servicetitan/folder-schema/check` rule with the next options:
20
20
 
21
- - `root` - entry point to start recursive checking
22
- - `config` - object with a configuration of files hierarchy
23
- - `docLink?` - link to a document describing a required files hierarchy
21
+ | Name | Description |
22
+ | :--------- | :------------------------------------------------------------------------------------------------------------------------------ |
23
+ | `config` | Object with a configuration of files hierarchy |
24
+ | `root?` | Optional entry point to start recursive checking. Defaults to the current working directory. |
25
+ | `docLink?` | Optional link to a document describing a required files hierarchy. Defaults to https://docs.st.dev/docs/frontend/file-structure |
26
+
27
+ ### Configuration
28
+
29
+ Use the `eslint.config.{js,cjs,mjs}` file to configure rules using the [flag config](https://eslint.org/docs/latest/use/configure/configuration-files) style.
30
+
31
+ ```js title="eslint.config.js"
32
+ import folderSchemaPlugin from '@servicetitan/eslint-plugin-folder-schema';
33
+
34
+ // Call configs.recommended with desired options
35
+ export = [...folderSchemaPlugin.configs.recommended({ config: require.resolve('./config') })];
36
+ ```
24
37
 
25
38
  ## @servicetitan/folder-lint
26
39
 
package/docs/startup.mdx CHANGED
@@ -26,54 +26,68 @@ Updating build tooling is typically a daunting and time-consuming task. When new
26
26
  Experimental flags don't follow semver. There might be breaking changes in minor versions of `@servicetitan/startup` when you opt-in to experimental flags.
27
27
  :::
28
28
 
29
- ### init
29
+ ### convert-eslint-config
30
30
 
31
- Generates initial project structure. This command should be run via `npx` in an empty folder.
31
+ Convert an ESLint v8 configuration to v9 format.
32
32
 
33
33
  ```sh
34
- $ npx -y @servicetitan/startup@latest init
34
+ $ npx startup convert-eslint-config
35
35
  ```
36
36
 
37
- ### install
37
+ Use this command when upgrading from ESLint v8 to v9, to convert a v8 `.eslintrc.json` to the equivalent `eslint.config.mjs`. See [Upgrading to ESLint v9.x](/docs/frontend/upgrading-to-eslint-v9) for guidance on upgrading to ESLint v9.
38
38
 
39
- Installs the package dependencies. This command should be run via `npx` before the build.
39
+ The command takes no arguments. Simply run it from a directory with `.eslintrc.json` and it creates `eslint.config.mjs` in the same location.
40
40
 
41
- See [package.json in the example project](https://github.com/search?q=repo%3Aservicetitan%2Ffrontend-example+path%3A**%2Fpackage.json+%22startup+install%22&type=code).
41
+ :::caution
42
+ Comments are not copied from the source `.eslintrc.json` to the output file.
43
+ If the source file contains important comments, copy them manually to the output file.
44
+ :::
42
45
 
43
- ### start
46
+ ### build
44
47
 
45
- Runs package in the development mode. Applications will be hosted on sequential free ports starting from 8080. Pages will automatically reload on changes to the code.
48
+ 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.
46
49
 
47
50
  #### Arguments
48
51
 
49
- - `--scope <glob>` - Include only packages with names matching the given glob.
50
- - `--ignore <glob>` - Exclude packages with names matching the given glob.
51
- - `--esbuild` - Use [esbuild-loader](https://github.com/privatenumber/esbuild-loader) to process TypeScript files instead of ts-loader.
52
- - `--experimental-bundlers` - Use experimental build optimizations (alternative loaders and bundlers)
53
- - `--code-coverage` - Add [instrumentation](https://github.com/JS-DevTools/coverage-istanbul-loader) to bundled code in order to collect code coverage
52
+ - `--scope <glob>` - Include only packages with names matching the given glob.
53
+ - `--ignore <glob>` - Exclude packages with names matching the given glob.
54
+ - `--cdn-path <url>` - Specify the base path for all the assets within the application.
55
+ - `--stat` - Generate bundle report with [webpack-bundle-analyzer](https://github.com/webpack-contrib/webpack-bundle-analyzer). Starting `v22.3.0` works for [MFEs](/docs/frontend/micro-frontends) too.
56
+ - `--esbuild` - Use [esbuild-loader](https://github.com/privatenumber/esbuild-loader) to process TypeScript files instead of ts-loader.
57
+ - `--experimental-bundlers` - Use experimental build optimizations (alternative loaders and bundlers)
58
+ - `--code-coverage` - Add [instrumentation](https://github.com/JS-DevTools/coverage-istanbul-loader) to bundled code in order to collect code coverage
54
59
 
55
- ### build
60
+ ### init
56
61
 
57
- 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.
62
+ Generates initial project structure. This command should be run via `npx` in an empty folder.
58
63
 
59
- #### Arguments
64
+ ```sh
65
+ $ npx -y @servicetitan/startup@latest init
66
+ ```
60
67
 
61
- - `--scope <glob>` - Include only packages with names matching the given glob.
62
- - `--ignore <glob>` - Exclude packages with names matching the given glob.
63
- - `--cdn-path <url>` - Specify the base path for all the assets within the application.
64
- - `--stat` - Generate bundle report with [webpack-bundle-analyzer](https://github.com/webpack-contrib/webpack-bundle-analyzer). Starting `v22.3.0` works for [MFEs](/docs/frontend/micro-frontends) too.
65
- - `--esbuild` - Use [esbuild-loader](https://github.com/privatenumber/esbuild-loader) to process TypeScript files instead of ts-loader.
66
- - `--experimental-bundlers` - Use experimental build optimizations (alternative loaders and bundlers)
67
- - `--code-coverage` - Add [instrumentation](https://github.com/JS-DevTools/coverage-istanbul-loader) to bundled code in order to collect code coverage
68
+ ### install
68
69
 
69
- ### test
70
+ Installs the package dependencies. This command should be run via `npx` before the build.
70
71
 
71
- Runs all existing tests in all packages.
72
+ See [package.json in the example project](https://github.com/search?q=repo%3Aservicetitan%2Ffrontend-example+path%3A**%2Fpackage.json+%22startup+install%22&type=code).
72
73
 
73
- To run tests a subset of tests is possible to pass paths to specific directories or test files as positional parameters.
74
+ ### kendo-ui-license
75
+
76
+ Activates KendoReact components by installing the license key. The license key is only installed if the project depends on `@progress/kendo` components. Otherwise, this command has no effect.
77
+
78
+ **Note:** The [build](#build) command automatically detects when a project uses KendoRect components and runs this command.
79
+
80
+ Use it to install the license key separately from a build, or to override the default license key.
74
81
 
75
82
  ```sh
76
- $ npx startup test -- packages/desktop/app/modules/inventory/
83
+ $ npx startup kendo-ui-license
84
+ ```
85
+
86
+ To install a different license, set the KENDO_UI_LICENSE environment variable to the key to use.
87
+
88
+ ```sh
89
+ $ export KENDO_UI_LICENSE=<license-key>
90
+ $ npx startup kendo-ui-license
77
91
  ```
78
92
 
79
93
  ### lint
@@ -93,36 +107,41 @@ $ npx startup lint -- packages/desktop/app/modules/lead/ packages/desktop/app/mo
93
107
  $ npx startup lint -- packages/desktop/app/modules/{lead,inventory}/
94
108
  ```
95
109
 
96
- #### Arguments
110
+ #### Options
97
111
 
98
- - `--scope <glob>` - Include only packages with names matching the given glob.
99
- - `--ignore <glob>` - Exclude packages with names matching the given glob.
100
- - `--fix` - Fix linting issues.
112
+ - `--scope <glob>` - Include only packages with names matching the given glob.
113
+ - `--ignore <glob>` - Exclude packages with names matching the given glob.
114
+ - `--fix` - Fix linting issues.
101
115
 
102
116
  ### mfe-publish
103
117
 
104
- This is an umbrella command for both unpublishing (cleaning up, `mfe-package-clean`) and publishing (`mfe-package-publish`) MFEs. This command allows publishing MFEs in a way that there is no risk of colliding package versions (a common issue with back-merging). See the `--build` argument for more details.
118
+ This is an umbrella command for both publishing and unpublishing (cleaning up) MFEs. This command allows publishing MFEs in a way that there is no risk of colliding package versions (a common issue with back-merging). See the `--build` option for more details.
105
119
 
106
- #### Arguments
120
+ #### Publishing options
107
121
 
108
- ##### Clean-up arguments
122
+ | Option | Description |
123
+ | :------------------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
124
+ | `--build <glob>` | Optional build version that normally should not be specified. Defaults to `<branch_name>.<commit_hash>`. For example, if git commit `bdac90f5` is published from branch `next`, the build version is`next.bdac90f5`, and the full version is `0.0.0-next.bdac90f5`. This ensures each release has a unique version with no collisions. |
125
+ | `--dry` | Invoke [npm publish --dry-run](https://docs.npmjs.com/cli/v7/commands/npm-publish#dry-run) instead of actually publishing anything. |
126
+ | `--branch <string>` | Optional branch name. The current branch name is used if no value is specified. The branch name is used in constructing the build version in case `--build` is not specified. |
127
+ | `--force` | Forces publishing the package when no configuration was found for the specified branch (`--branch` or current branch). |
128
+ | `--tag <string>` | The [tag](https://docs.npmjs.com/cli/v7/commands/npm-publish#tag) to assign to the published version. Defaults to the tag associated with the branch from the custom [branch config](#branch-configs) or, if there is no custom branch config, from the [default branch config](https://github.com/servicetitan/uikit/blob/master/packages/startup/src/utils/get-branch-configs.ts#L3). For example, by default a package published from the `master` branch is tagged `prod`. Becasue NPM v11 requires pre-release versions to have a tag, if there is no custom or default tag for the branch, the package is tagged "latest". |
109
129
 
110
- - `--clean` - Start the clean-up script instead of publishing.
111
- - `--count <number>` - The number of packages to be unpublished (cleaned up). The default value is 5. This argument has effect only when `--clean` is specified too.
112
- - `--branch` - Clean versions related to the current git branch. This argument has effect only when `--clean` is specified too.
113
- - `--branch <branch_name>` - Clean versions related to the specified git branch. This argument has effect only when `--clean` is specified too.
130
+ #### Unpublishing options
114
131
 
115
- #### Publish arguments
116
-
117
- - `--build <glob>` - Optional build version, normally should not be specified. If not specified a `<branch_name>.<commit_hash>` value will be assigned. For example, `next.bdac90f5`. The full version number of the package being published will then be `0.0.0-next.bdac90f5` (a unique value per each release hence no collisions when publishing the package).
118
- - `--dry` - Invoke [npm publish --dry-run](https://docs.npmjs.com/cli/v7/commands/npm-publish#dry-run) instead of actually publishing anything.
119
- - `--branch <string>` - Optional branch name. The current branch name is used if no value is specified. The branch name is used in constructing the build version in case `--build` is not specified.
120
- - `--force` - Attempts to force publish the package in case no branch configuration is found for the specified branch (`--branch` or current branch).
121
- - `--tag <string> | false` - If the value is `false` the package will be published without a custom [tag](https://docs.npmjs.com/cli/v7/commands/npm-publish#tag) (meaning it will be published with the default `latest` tag). If another value is specified it will be used as the tag name otherwise the tag value will be mapped from [branch configs](#branch-configs). If no branch configs specified, tag value will be mapped from [following object](https://github.com/servicetitan/uikit/blob/master/packages/startup/src/utils/get-branch-configs.ts#L3). For example, in case of branch name `master` the package will be published with the `prod` tag, etc.
132
+ | Option | Descripiton |
133
+ | :----------------- | :-------------------------------------------------------------------------------------------------------------------------------------------- |
134
+ | `--clean` | Instructs `mfe-publish` to remove old versions instead of publishing. |
135
+ | `--count <number>` | The number of package versions to keep (e.g., if twelve versions are published, `--count 10` removes the two oldest). The default value is 5. |
136
+ | `--branch <name>` | Remove old versions associated with the specified branch. Defaults to the current branch (i.e., `git branch --show-current`) |
137
+ | `--all` | Remove old versions associated with all [recognized branches](#branch-configs). This overrides `--branch`. |
138
+ | `--dry` | Log what the command would do without actually unpublishing anything. |
122
139
 
123
140
  #### Branch configs
124
141
 
125
- To customize the publish tags for your MFE set `cli.web-component.branches` to an object that maps branch names to the associated tags. For example,
142
+ By default `mfe-publish` only publishes from a few [recognized branches](https://github.com/servicetitan/uikit/blob/master/packages/startup/src/utils/get-branch-configs.ts#L3) and you must use `--force` to publish from others.
143
+
144
+ To customize the recognized branches for an MFE set `cli.web-component.branches` in the MFE's package.json to an object that maps branch names to the associated tag. For example,
126
145
 
127
146
  ```json
128
147
  "cli": {
@@ -136,33 +155,28 @@ To customize the publish tags for your MFE set `cli.web-component.branches` to a
136
155
  }
137
156
  ```
138
157
 
139
- - `publishTag: string` - Tag used when publishing package.
140
-
141
- #### Other auxiliary mfe-publish commands
142
-
143
- In addition to `mfe-publish` also `mfe-package-clean` and `mfe-package-publish` commands are added.
158
+ - `publishTag: string` - Tag used when publishing package.
144
159
 
145
- `mfe-package-clean` command with a `--count` argument is equivalent to `mfe-publish` with `--count` and `--clean` arguments.
146
-
147
- `mfe-package-publish` accepts all arguments mentioned above except for `--clean`, `--count`, and `--scope` i.e. this command only publishes packages.
160
+ ### start
148
161
 
149
- ### kendo-ui-license
162
+ Runs package in the development mode. Applications will be hosted on sequential free ports starting from 8080. Pages will automatically reload on changes to the code.
150
163
 
151
- Activates KendoReact components by installing the license key. The license key is only installed if the project depends on `@progress/kendo` components. Otherwise, this command has no effect.
164
+ #### Arguments
152
165
 
153
- **Note:** The [build](#build) command automatically detects when a project uses KendoRect components and runs this command.
166
+ - `--scope <glob>` - Include only packages with names matching the given glob.
167
+ - `--ignore <glob>` - Exclude packages with names matching the given glob.
168
+ - `--esbuild` - Use [esbuild-loader](https://github.com/privatenumber/esbuild-loader) to process TypeScript files instead of ts-loader.
169
+ - `--experimental-bundlers` - Use experimental build optimizations (alternative loaders and bundlers)
170
+ - `--code-coverage` - Add [instrumentation](https://github.com/JS-DevTools/coverage-istanbul-loader) to bundled code in order to collect code coverage
154
171
 
155
- Use it to install the license key separately from a build, or to override the default license key.
172
+ ### test
156
173
 
157
- ```sh
158
- $ npx startup kendo-ui-license
159
- ```
174
+ Runs all existing tests in all packages.
160
175
 
161
- To install a different license, set the KENDO_UI_LICENSE environment variable to the key to use.
176
+ To run tests a subset of tests is possible to pass paths to specific directories or test files as positional parameters.
162
177
 
163
178
  ```sh
164
- $ export KENDO_UI_LICENSE=<license-key>
165
- $ npx startup kendo-ui-license
179
+ $ npx startup test -- packages/desktop/app/modules/inventory/
166
180
  ```
167
181
 
168
182
  ## Build Steps
@@ -346,6 +360,7 @@ Set `web-component` to `true` to create the support files and `light` and `full`
346
360
  ```
347
361
 
348
362
  Or you can set an object with detailed configs:
363
+
349
364
  ```json title="package.json"
350
365
  {
351
366
  "cli": {
@@ -359,6 +374,7 @@ Or you can set an object with detailed configs:
359
374
  ```
360
375
 
361
376
  Or you can use relative path to a file that exports an object with detailed configs (useful to share configs between multiple MFEs in repo):
377
+
362
378
  ```json title="package.json"
363
379
  {
364
380
  "cli": {
@@ -366,10 +382,11 @@ Or you can use relative path to a file that exports an object with detailed conf
366
382
  }
367
383
  }
368
384
  ```
385
+
369
386
  ###### Web component config options
370
387
 
371
- - `branches` - Set git branch specific configs, used for publishing. See [Branch configs](#branch-configs).
372
- - `legacyRoot` - Set to opt-out of automatic batching. See [Opting-out of automatic batching](/docs/frontend/react-18#opting-out-of-automatic-batching).
388
+ - `branches` - Set git branch specific configs, used for publishing. See [Branch configs](#branch-configs).
389
+ - `legacyRoot` - Set to opt-out of automatic batching. See [Opting-out of automatic batching](/docs/frontend/react-18#opting-out-of-automatic-batching).
373
390
 
374
391
  See [MFE configuration](/docs/frontend/micro-frontends/#mfe-configuration) for detailed instructions on configuring MFE applications.
375
392
 
@@ -155,7 +155,7 @@ The following metadata about an MFE is available from `useMFEMetadataContext` ho
155
155
 
156
156
  ### getValueForEnvironment
157
157
 
158
- `getValueForEnvironment` detects the Monolith environment and returns a corresponding value.
158
+ `getValueForEnvironment` detects the host environment and returns a corresponding value.
159
159
 
160
160
  :::caution
161
161
  When no value is provided for the detected environment, `getValueForEnvironment` returns `undefined`.
@@ -163,22 +163,36 @@ When no value is provided for the detected environment, `getValueForEnvironment`
163
163
 
164
164
  #### Props
165
165
 
166
- | Name | Type | Description |
167
- | :------------------- | :----------------------------- | :----------------------------------------------------------------------------------------- |
168
- | `values` | `Record<Environment, string>` | Object that maps each environment to a value (see below). |
169
- | `defaultEnvironment` | `Environment` | The environment to use when the current environment is not recognized. Defaults to `"qa"`. |
170
- | `hostname` | `string` | The hostname of the current environment. Defaults to `window.location.hostname` |
166
+ | Name | Type | Description |
167
+ | :------------------- | :----------------------- | :------------------------------------------------------------------------------------------------------------------------ |
168
+ | `values` | `Record<string, string>` | Object that maps each environment to a value (see below). |
169
+ | `defaultEnvironment` | `keyof typeof values` | The environment to use when the current environment is not recognized or is not included in `values`. Defaults to `"qa"`. |
170
+ | `hostname` | `string` | The hostname of the current environment. Defaults to `window.location.hostname` |
171
171
 
172
172
  The recognized environments are:
173
173
 
174
- | Environment | Description |
175
- | :---------- | :-------------------------------------------------------------- |
176
- | **dev** | Development environment (e.g., `localhost`) |
177
- | **go** | Production environment |
178
- | **qa** | QA environment |
179
- | **next** | Next environment |
180
- | **stage** | Staging environment |
181
- | **test** | Unit test environment (i.e., `process.env.NODE_ENV === 'test'`) |
174
+ | Environment | Description |
175
+ | :---------------- | :----------------------------------------------------------------- |
176
+ | **dev** | Development environment (i.e., `localhost`, `127.0.0.1`) |
177
+ | **go** | Production environment |
178
+ | **qa** | QA environment |
179
+ | **next** | Next environment |
180
+ | **stage** | Staging environment |
181
+ | **test** | Unit test environment (i.e., `process.env.NODE_ENV === 'test'`) |
182
+ | `<string>` | Custom environment that matches against`<string>.servicetitan.com` |
183
+ | `<string>.st.dev` | Custom environment that matches against `<string>.st.dev` |
184
+
185
+ #### Custom environments
186
+
187
+ Custom environments are for applications and services that run separately from the Monolith.
188
+ For example, to associate **prod** with `my-service.servicetitan.com` and **stage** with `my-service-stage.st.dev`:
189
+
190
+ ```json
191
+ {
192
+ "my-service": "prod", // Matches my-service.servicetitan.com
193
+ "stage.st.dev": "stage" // Matches *stage.st.dev
194
+ }
195
+ ```
182
196
 
183
197
  #### Examples
184
198
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servicetitan/docs-uikit",
3
- "version": "28.5.0",
3
+ "version": "30.0.0",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -16,5 +16,5 @@
16
16
  "cli": {
17
17
  "webpack": false
18
18
  },
19
- "gitHead": "580ace3d4bce0472e985b1d4eb5e98e0be625f1d"
19
+ "gitHead": "e182cbb85cf66d62f235a9ca172fc04dc705fd0a"
20
20
  }
@@ -1,66 +0,0 @@
1
- ---
2
- title: Component Usage
3
- ---
4
-
5
- #### [CHANGELOG (@servicetitan/component-usage)](https://github.com/servicetitan/uikit/blob/master/packages/component-usage/CHANGELOG.md)
6
-
7
- `@servicetitan/component-usage` will calculate and publish metrics on the app's component usage. The packages which we report on are currently hard-coded to [this list](https://github.com/servicetitan/uikit/blob/master/packages/component-usage/src/index.ts#L40-L64)
8
-
9
- ## Usage
10
-
11
- ### Basic Usage
12
-
13
- ```
14
- $ npm install --save-dev @servicetitan/component-usage
15
- $ npx component-usage
16
- ```
17
-
18
- Or for one-time use with no installation:
19
-
20
- ```
21
- $ npx @servicetitan/component-usage
22
- ```
23
-
24
- ### Options
25
-
26
- You must specify at least one "mode" option: `--sendToDataDog`, `--outputDir`, `--teamCityOutput`.
27
-
28
- The examples below show the long form of each option (like `--sendToDataDog`), but short forms are available (like `-s`). To see all the long and short options, use `--help`.
29
-
30
- Display help:
31
-
32
- ```
33
- $ npx @servicetitan/component-usage --help
34
- ```
35
-
36
- Generate stats files locally in the current directory:
37
-
38
- ```
39
- $ npx @servicetitan/component-usage --outputDir .
40
- ```
41
-
42
- Send metrics to DataDog:
43
-
44
- ```
45
- $ npx @servicetitan/component-usage --sendToDataDog --dataDogApiKey ...API_KEY_GOES_HERE... --dataDogApplicationKey ...APP_KEY_GOES_HERE...
46
- ```
47
-
48
- Porque no los dos?
49
-
50
- ```
51
- $ npx @servicetitan/component-usage --outputDir . --sendToDataDog --dataDogApiKey ...API_KEY_GOES_HERE... --dataDogApplicationKey ...APP_KEY_GOES_HERE...
52
- ```
53
-
54
- TeamCity output
55
-
56
- ```
57
- $ npx @servicetitan/component-usage --teamCityOutput
58
- ```
59
-
60
- ## Live Data
61
-
62
- We currently have a [TeamCity build that triggers with every merge to master](https://teamcity.st.dev/viewType.html?buildTypeId=FrontendPlatform_ComponentUsageMaster) which specifies all three mode options:
63
-
64
- - `--sendToDataDog`: publish the metric `far.componentUsage` to DataDog. [This DataDog dashboard](https://app.datadoghq.com/dashboard/my4-ftr-xgu/front-end-component-usage?from_ts=1602016753361&live=true&to_ts=1602103153361) shows some charts on this metric.
65
- - `--outputDir`: write the stats out as files during the build, which is then published as a build artifact. [Example artifacts from a recent build](https://teamcity.st.dev/repository/download/FrontendPlatform_ComponentUsageMaster/901050:id/treemap/index.html)
66
- - `--teamCityOutput`: write out special output during the TeamCity build process (like `##teamcity[buildStatisticValue...`) which gets captured and published as a TeamCity build statistic. See the [build statistics tab](https://teamcity.st.dev/viewType.html?buildTypeId=FrontendPlatform_ComponentUsageMaster&tab=buildTypeStatistics) for charts.