@servicetitan/docs-uikit 32.1.0 → 32.3.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.
@@ -6,14 +6,14 @@ Build packages for production to the `dist/bundle` folders. It bundles them in p
6
6
 
7
7
  ## Options
8
8
 
9
- | Option | Description |
10
- | :----------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
11
- | `--scope <glob>` | Include only packages with names matching the given glob. |
12
- | `--ignore <glob>` | Exclude packages with names matching the given glob. |
13
- | `--cdn-path <url>` | Specify the base path for all the assets within the application. |
14
- | `--stat` | Generate bundle report with [webpack-bundle-analyzer](https://github.com/webpack-contrib/webpack-bundle-analyzer). Starting `v22.3.0` works for [MFEs](/docs/frontend/micro-frontends) too. |
15
- | `--code-coverage` | Add [instrumentation](https://github.com/JS-DevTools/coverage-istanbul-loader) to bundled code in order to collect code coverage |
16
- | `--use-tsc` | Use TSC for TypeScript compilation |
9
+ | Option | Description |
10
+ | :----------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
11
+ | `--scope <glob>` | Include only packages with names matching the given glob. |
12
+ | `--ignore <glob>` | Exclude packages with names matching the given glob. |
13
+ | `--cdn-path <url>` | Specify the base path for all the assets within the application. |
14
+ | `--stat` | Generate bundle report with [webpack-bundle-analyzer](https://github.com/webpack-contrib/webpack-bundle-analyzer). Starting `v22.3.0` works for [MFEs](../microfrontends) too. |
15
+ | `--code-coverage` | Add [instrumentation](https://github.com/JS-DevTools/coverage-istanbul-loader) to bundled code in order to collect code coverage |
16
+ | `--use-tsc` | Use TSC for TypeScript compilation |
17
17
 
18
18
  ## Build Steps
19
19
 
@@ -28,3 +28,276 @@ The `build` command executes these steps:
28
28
  :::note
29
29
  `startup` doesn't support dependencies between the Webpack bundles.
30
30
  :::
31
+
32
+ ## Package Setup
33
+
34
+ Because `startup` compiles and builds in separate steps, packages must export compiled Javascript instead of the TypeScript source files. E.g.,
35
+
36
+ ```json title="package.json"
37
+ {
38
+ "exports": "./dist/index.js",
39
+ "main": "./dist/index.js",
40
+ "typings": "./dist/index.d.ts"
41
+ }
42
+ ```
43
+
44
+ And, to ensure packages are compiled in the correct order, [TypeScript project references](https://www.typescriptlang.org/docs/handbook/project-references.html) must accurately describe the dependencies between packages. E.g.,
45
+
46
+ ```json title="tsconfig.json"
47
+ {
48
+ "references": [
49
+ { "path": "../component-a" },
50
+ { "path": "../component-b" },
51
+ { "path": "../component-c" }
52
+ ]
53
+ }
54
+ ```
55
+
56
+ :::note
57
+ The Webpack documentation suggests using a configuration that enters through `./src/index.ts`, and using `ts-loader` to process `.ts` and `.tsx` files. However, because `startup` precompiles Typescript, this is redundant and webpack must be configured to load the compiled Javascript.
58
+ :::
59
+
60
+ ## CSS Modules
61
+
62
+ `Startup` supports [CSS Modules](https://github.com/css-modules/css-modules) alongside regular stylesheets using the `[name].module.{css,less,scss}` file naming convention. CSS Modules provide locally scoped class names that prevent global CSS collisions, making styles more predictable and easier to refactor.
63
+
64
+ ## SVG Transformation
65
+
66
+ By default, SVGs are loaded as assets. Depending on the file size, the asset is converted to a base64 URI string, or emitted as separate file. E.g.,
67
+
68
+ ```tsx
69
+ import MySVG from './my.svg';
70
+
71
+ function MyImage() {
72
+ return <img src={MySVG} />;
73
+ }
74
+ ```
75
+
76
+ ### Importing SVGs as React components
77
+
78
+ By default `startup` imports SVGs from `@servicetitan/anvil2` as React components. E.g.,
79
+
80
+ ```tsx
81
+ import { Button } from '@servicetitan/anvil2';
82
+ import CheckIcon from '@servicetitan/anvil2/assets/icons/material/round/check.svg';
83
+
84
+ export function CheckButton() {
85
+ return <Button icon={CheckIcon} />;
86
+ }
87
+ ```
88
+
89
+ To import SVGs from other sources as React components, append `?component` to the import statement. E.g.,
90
+
91
+ ```tsx
92
+ import { Button } from '@servicetitan/anvil2';
93
+ import CheckIcon from './assets/check.svg?component';
94
+
95
+ export function CheckButton() {
96
+ return <Button icon={CheckIcon} />;
97
+ }
98
+ ```
99
+
100
+ ### Importing Anvil 2 SVGs as assets
101
+
102
+ By default `startup` imports SVGs from `@servicetitan/anvil2` as React components.
103
+ To import an Anvil 2 SVG as an asset, append `?asset` to the import statement. E.g.,
104
+
105
+ ```tsx
106
+ import CheckIcon from '@servicetitan/anvil2/assets/icons/material/round/check.svg?asset';
107
+
108
+ function CheckImage() {
109
+ return <img src={CheckIcon} />;
110
+ }
111
+ ```
112
+
113
+ ## Configuration
114
+
115
+ ### Library packages
116
+
117
+ Set `cli.webpack` to `false` to disable Webpack for non-application packages, such as component and utility libraries.
118
+
119
+ ```json title="package.json"
120
+ {
121
+ "cli": {
122
+ "webpack": false
123
+ }
124
+ }
125
+ ```
126
+
127
+ ### Type Checking
128
+
129
+ Use package-specific `tsconfig.json` and `tsconfig.build.json` files to set or override type checking options. E.g.,
130
+
131
+ ```json title="tsconfig.json"
132
+ {
133
+ "extends": "@servicetitan/startup/tsconfig/base",
134
+ "compilerOptions": {
135
+ "outDir": "dist",
136
+ "rootDir": "src"
137
+ // Other type checking options (https://www.typescriptlang.org/tsconfig/)
138
+ },
139
+ "include": ["src/**/*"]
140
+ }
141
+ ```
142
+
143
+ Use `tsconfig.build.json` that extends from `tsconfig.json` to exclude tests, stories, and mocks from type checking. E.g.,
144
+
145
+ ```json title="tsconfig.build.json"
146
+ {
147
+ "extends": "./tsconfig.json",
148
+ "exclude": ["**/__tests__/*", "**/*.test.*", "**/__mocks__/*", "**/*.stories.*"],
149
+ "references": [
150
+ { "path": "../feature-a" },
151
+ { "path": "../feature-b" },
152
+ { "path": "../feature-c" }
153
+ ]
154
+ }
155
+ ```
156
+
157
+ :::caution
158
+ Project references must be duplicated in `tsconfig.build.json` because [references are not inherited](https://github.com/microsoft/TypeScript/issues/27098).
159
+ :::
160
+
161
+ ### TypeScript compilation (SWC)
162
+
163
+ :::info
164
+ `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.
165
+ :::
166
+
167
+ Use `cli.swc-compile-package` to set or override SWC options. E.g.,
168
+
169
+ ```json title="package.json"
170
+ {
171
+ "cli": {
172
+ "swc-compile-package": {
173
+ "cliOptions": {
174
+ // CLI options (https://swc.rs/docs/usage/cli)
175
+ },
176
+ "swcOptions": {
177
+ // Compilation options (https://swc.rs/docs/configuration/compilation)
178
+ // Module options (https://swc.rs/docs/configuration/modules)
179
+ }
180
+ }
181
+ }
182
+ }
183
+ ```
184
+
185
+ ### TypeScript compilation (TSC)
186
+
187
+ :::caution
188
+ Compilation via TSC is deprecated.
189
+ :::
190
+
191
+ Use package-specific `tsconfig.json` and `tsconfig.build.json` files to set or override compiler options. See [Type checking](#type-checking) for more information.
192
+
193
+ ### Minimization
194
+
195
+ By default `startup` configures webpack to minimize production bundles conservatively,
196
+ so that projects gain the benefits of reduced bundle sizes while retaining the highest
197
+ fidelity for source map debugging.
198
+ It uses [TerserWebpackPlugin](https://webpack.js.org/plugins/terser-webpack-plugin) to minimize JS bundles
199
+ and [CssMinimizerWebpackPlugin](https://webpack.js.org/plugins/css-minimizer-webpack-plugin)
200
+ to minimize CSS bundles.
201
+
202
+ - To turn off minimizing, set `cli.webpack.minify.js` or `cli.webpack.minify.css`, or both, to `false`.
203
+ - To override the default Terser options set `cli.webpack.minify.js` to an object containing
204
+ [`terserOptions`](https://webpack.js.org/plugins/terser-webpack-plugin/#terseroptions).
205
+ - To override the default CssMinimizerWebpackPlugin options, set `cli.webpack.minify.css` to an object containing
206
+ [CssMinimizerWebpackPlugin options](https://webpack.js.org/plugins/css-minimizer-webpack-plugin/#options).
207
+
208
+ For example,
209
+
210
+ ```json title="package.json"
211
+ {
212
+ "cli": {
213
+ "webpack": {
214
+ "minify": {
215
+ "js": {
216
+ // terser-webpack-plugin terserOptions
217
+ // https://webpack.js.org/plugins/terser-webpack-plugin/#terseroptions
218
+ },
219
+ "css": {
220
+ // css-minimizer-webpack-plugin options
221
+ // https://webpack.js.org/plugins/css-minimizer-webpack-plugin/#options
222
+ }
223
+ }
224
+ }
225
+ }
226
+ }
227
+ ```
228
+
229
+ ### Webpack
230
+
231
+ To further customize Webpack settings, create files named `webpack.*.config.js` in the package's root directory (the directory with its `package.json`).
232
+
233
+ Use `webpack.dev.config.js` to customize development builds and use `webpack.prod.config.js` to customize production builds. In the config file,
234
+
235
+ - Import `createWebpackConfig` from `@servicetitan/startup`.
236
+ - Call it with the custom Webpack options.
237
+ - Return the result as the default export.
238
+
239
+ For example, to customize the Webpack's **output** path,
240
+
241
+ ```js title="webpack.dev.config.js"
242
+ const path = require('path');
243
+ const { createWebpackConfig } = require('@servicetitan/startup');
244
+
245
+ module.exports = createWebpackConfig({
246
+ configuration: {
247
+ mode: 'development',
248
+ output: { path: path.resolve(__dirname, '../../wwwroot') },
249
+ },
250
+ });
251
+ ```
252
+
253
+ :::caution
254
+ For MFEs the approach is slightly different, see [Customizing Webpack for MFEs](#customizing-webpack-for-mfes)
255
+ :::
256
+
257
+ #### createWebpackConfig
258
+
259
+ `createWebpackConfig` takes an object with two fields, `configuration` and `plugins`.
260
+
261
+ | Field | Description |
262
+ | :-------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
263
+ | `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". |
264
+ | `plugins` | `HtmlWebpackPlugin` and `MiniCssExtractPlugin` subkeys are merged with the default configurations for the corresponding plugins. (Note, `MiniCssExtractPlugin` only applies to production builds.) |
265
+
266
+ For example,
267
+
268
+ ```js title="webpack.prod.config.js"
269
+ const { createWebpackConfig } = require('@servicetitan/startup');
270
+
271
+ module.exports = createWebpackConfig({
272
+ configuration: {
273
+ mode: 'production',
274
+ },
275
+ plugins: {
276
+ HtmlWebpackPlugin: {
277
+ favicon: './favicon.ico',
278
+ title: 'Enterprise Hub',
279
+ },
280
+ },
281
+ });
282
+ ```
283
+
284
+ :::caution
285
+ Remember, you must set `configuration.mode` to "production" in `webpack.prod.config.js`.
286
+ :::
287
+
288
+ #### Customizing Webpack for MFEs
289
+
290
+ Because `startup` runs Webpack multiple times to create MFEs bundles, a slightly different approach is required for MFEs.
291
+ Don't call `createWebpackConfig` and just return an object with the same `configuration` and `plugins` fields described [above](#createwebpackconfig).
292
+ E.g.,
293
+
294
+ ```js title="webpack.dev.config.js"
295
+ const path = require('path');
296
+
297
+ module.exports = {
298
+ configuration: {
299
+ mode: 'development',
300
+ output: { path: path.resolve(__dirname, '../../wwwroot') },
301
+ },
302
+ };
303
+ ```
@@ -17,14 +17,24 @@ See [package.json in the example project](https://github.com/search?q=repo%3Aser
17
17
 
18
18
  ## Options
19
19
 
20
- | Option | Description |
21
- | :----------- | :-------------------------------------------- |
22
- | `--no-token` | Disable configuring npm authentication token. |
20
+ | Option | Description |
21
+ | :----------- | :----------------------------------------------------------------------- |
22
+ | `--no-token` | Only install dependencies. Don't configure the npm authentication token. |
23
+ | `--token` | Only configure the npm authentication token. Don't install dependencies. |
23
24
 
24
25
  ## Configuring NPM Token in Development
25
26
 
26
27
  In development environments, `startup 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.
27
28
 
29
+ :::tip
30
+ If your project is using `startup` v31 or earlier, or isn't using `startup` at all, run this command to manually configure the npm authentication token.
31
+
32
+ ```
33
+ npx --yes @servicetitan/startup@latest install --token
34
+ ```
35
+
36
+ :::
37
+
28
38
  :::caution
29
39
  `startup install` detects if it is running in development by checking for standard environment variables set by CI systems (e.g.,`CI` and `TEAMCITY_VERSION`). If none of these variables are set, it assumes it is running on a developer machine.
30
40
  If it mistakes a CI environment for a developer machine, add a `CI` environment variable (with any value) to the workflow, or [use `--no-token`](#how-to-use---no-token) to disable configuring the npm token.
@@ -119,7 +129,7 @@ These instructions are only for projects using [Option 2](#option-2-use-environm
119
129
 
120
130
  If your project is [using an environment variable](#option-2-use-environment-variable), and it isn't using `startup` v32 or later, then developers must also defined the same environment variable manually. And they must repeat these steps each time the token is rotated,
121
131
 
122
- 1. Run `npx --yes @servicetitan/startup@latest install` to add the token to your per-user configuration.
132
+ 1. Run `npx --yes @servicetitan/startup@latest install --token` to add the token to your per-user configuration.
123
133
  2. Run `npm config get userconfig` to get the location of your per-user configuration file.
124
134
  3. Find the token in the configuration file, on the line that starts `//registry.npmjs.org/:_authToken=`
125
135
  4. Create a local environment variable with the token. Use the same variable name as in project's `.npmrc`.
@@ -24,3 +24,26 @@ npx startup lint -- packages/desktop/app/modules/{lead,inventory}/
24
24
  | `--scope <glob>` | Include only packages with names matching the given glob. |
25
25
  | `--ignore <glob>` | Exclude packages with names matching the given glob. |
26
26
  | `--fix` | Fix linting issues. |
27
+
28
+ ## Configuration
29
+
30
+ Use `cli.lint` to set or override `ESLint` and `Stylelint` options. E.g,
31
+
32
+ ```json title="package.json"
33
+ {
34
+ "cli": {
35
+ "lint": {
36
+ "eslint": {
37
+ // ESLint options (https://eslint.org/docs/user-guide/configuring)
38
+ },
39
+ "stylelint": {
40
+ // Stylelint options (https://stylelint.io/user-guide/configure)
41
+ }
42
+ }
43
+ }
44
+ }
45
+ ```
46
+
47
+ :::caution
48
+ Because `lint` is a global command that runs from the workspace root, `ESLint` and `Stylelint` configurations must be in the workspace's root `package.json`.
49
+ :::
@@ -0,0 +1,73 @@
1
+ ---
2
+ title: mfe-list
3
+ ---
4
+
5
+ Lists published MFE packages.
6
+
7
+ Use `mfe-list` to see what MFE versions were published and when.
8
+
9
+ ```sh
10
+ npx startup mfe-list
11
+ ```
12
+
13
+ It outputs, for each MFE in the current workspace,
14
+
15
+ - The MFE's name, current version, and total number of versions
16
+ - A table listing the 20 most recently published versions, with the following columns:
17
+ - **Version** : the published version
18
+ - **Tag** : assigned tag (if any)
19
+ - **When** : when the version was published, relative to the current time
20
+
21
+ For example,
22
+
23
+ ```
24
+ @servicetitan/examples | version: 0.0.0-far1369uploadsourcemaps.8e4f1ca0 | versions: 20
25
+ ┌────────────────────────────────────────┬─────────┬───────────────┐
26
+ │ Version │ Tag │ When │
27
+ ├────────────────────────────────────────┼─────────┼───────────────┤
28
+ │ 0.0.0-far1369uploadsourcemaps.8e4f1ca0 │ latest │ 2 months ago │
29
+ ├────────────────────────────────────────┼─────────┼───────────────┤
30
+ │ 0.0.0-test.7cf27f80 │ │ 3 months ago │
31
+ ├────────────────────────────────────────┼─────────┼───────────────┤
32
+ │ 0.0.0-test.2c98b704 │ │ 3 months ago │
33
+
34
+ ~ ~
35
+ ~ ~
36
+ ├────────────────────────────────────────┼─────────┼───────────────┤
37
+ │ 0.0.3 │ │ 4 years ago │
38
+ ├────────────────────────────────────────┼─────────┼───────────────┤
39
+ │ 1.2.4 │ │ 4 years ago │
40
+ └────────────────────────────────────────┴─────────┴───────────────┘
41
+ ```
42
+
43
+ ## Options
44
+
45
+ | Option | Description |
46
+ | :---------------- | :------------------------------------------------------------------ |
47
+ | `--all` | List all published versions. |
48
+ | `--ignore <glob>` | Exclude MFEs with names matching the given glob pattern. |
49
+ | `--limit <count>` | List the last `<count>` published versions. Ignores `<count> <= 0`. |
50
+ | `--tagged` | List only tagged versions. |
51
+
52
+ ## Listing specific MFEs
53
+
54
+ To list specific MFEs, pass their package names on the command line. For example, to list all tagged versions of `@servicetitan/dispatch-center` run,
55
+
56
+ ```
57
+ npx startup mfe-list @servicetitan/dispatch-center --tagged
58
+ ```
59
+
60
+ :::tip
61
+ Use this syntax to list any MFE, not just the ones in the project workspace.
62
+ :::
63
+
64
+ ## Authorization
65
+
66
+ If the machine is not authorized to access [Verdaccio](/docs/frontend/verdaccio-unpkg/#verdaccio), `startup` prompts you to authorize it. E.g.,
67
+
68
+ ```sh
69
+ $ npx startup mfe-list
70
+ This machine is not authorized to access https://verdaccio.servicetitan.com. Authorize? [Y/n]
71
+ ```
72
+
73
+ Enter `y` to confirm, or `n` to cancel. If you confirm, `startup` runs [verdaccio-okta-oauth](/docs/frontend/verdaccio-unpkg/#authorzation) then proceeds with the command.
@@ -6,18 +6,22 @@ This is an umbrella command for both publishing and unpublishing (cleaning up) M
6
6
 
7
7
  ## Publishing options
8
8
 
9
- | Option | Description |
10
- | :---------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
11
- | `--dry` | Log what the command would do without actually publishing anything. |
12
- | `--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. |
13
- | `--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. |
14
- | `--force` | Forces publishing the package when no configuration was found for the specified branch (`--branch` or current branch). |
15
- | `--upload-sourcemaps`, `--no-upload-sourcemaps` | Whether or not to [upload sourcemaps](#sourcemaps) to Datadog. Defaults to uploading sourcemaps. |
16
- | `--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". |
9
+ | Option | Description |
10
+ | :---------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
11
+ | `--dry` | Log what the command would do without actually publishing anything. |
12
+ | `--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. |
13
+ | `--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. |
14
+ | `--force` | Forces publishing the package when no configuration was found for the specified branch (`--branch` or current branch). |
15
+ | `--upload-sourcemaps`, `--no-upload-sourcemaps` | Whether or not to [upload sourcemaps](#sourcemaps) to Datadog. Defaults to uploading sourcemaps. |
16
+ | `--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`. |
17
+
18
+ :::danger
19
+ Do not use the `@latest` tag for production deployments because it could be assigned unintentionally. NPM v11 requires all pre-release versions to have a tag and, if you don't specify a tag and `mfe-publish` can't infer a tag from the branch name, the pre-release will be tagged "latest".
20
+ :::
17
21
 
18
22
  ## Unpublishing options
19
23
 
20
- | Option | Descripiton |
24
+ | Option | Description |
21
25
  | :----------------- | :-------------------------------------------------------------------------------------------------------------------------------------------- |
22
26
  | `--clean` | Instructs `mfe-publish` to remove old versions instead of publishing. |
23
27
  | `--all` | Remove old versions associated with all [recognized branches](#branch-configs). This overrides `--branch`. |
@@ -27,20 +31,25 @@ This is an umbrella command for both publishing and unpublishing (cleaning up) M
27
31
 
28
32
  ## Branch configs
29
33
 
34
+ ✨ New in **v28.1.1** ✨
35
+
30
36
  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.
31
37
 
32
38
  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,
33
39
 
34
40
  ```json
41
+ {
35
42
  "cli": {
36
43
  "web-component": {
37
44
  "branches": {
38
- "qa": { "publishTag": "qa" },
39
- "staging": { "publishTag": "staging" },
45
+ "develop": { "publishTag": "dev" },
46
+ "stage": { "publishTag": "stage" },
47
+ "next": { "publishTag": "next" },
40
48
  "master": { "publishTag": "prod" }
41
49
  }
42
50
  }
43
51
  }
52
+ }
44
53
  ```
45
54
 
46
55
  ### Properties
@@ -50,6 +59,29 @@ To customize the recognized branches for an MFE set `cli.web-component.branches`
50
59
  | `publishTag` | `string` | The tag to use when publishing from the branch. |
51
60
  | `uploadSourcemaps` | `boolean` | Whether to upload sourcemaps to Datadog. Defaults to `true`. |
52
61
 
62
+ ### Sharing branch configurations
63
+
64
+ When a repo contains multiple MFE that share the same branches, you can set `cli.web-component` to the relative path to a file that exports the common configuration object. For example,
65
+
66
+ ```json title="package.json"
67
+ {
68
+ "cli": {
69
+ "web-component": "../../config/web-component.js"
70
+ }
71
+ }
72
+ ```
73
+
74
+ ```js title="config/web-component.js"
75
+ module.exports = {
76
+ branches: {
77
+ develop: { publishTag: 'dev' },
78
+ stage: { publishTag: 'stage' },
79
+ next: { publishTag: 'next' },
80
+ master: { publishTag: 'prod' },
81
+ },
82
+ };
83
+ ```
84
+
53
85
  ## Sourcemaps
54
86
 
55
87
  ✨ New in **v31.5.0** ✨
@@ -71,3 +103,8 @@ If `DATADOG_API_KEY` is not provided `mfe-publish` fails with an error. In CI en
71
103
  :::tip
72
104
  Use `--no-upload-sourcemaps` to prevent `mfe-publish` from attempting to upload sourcemaps, for example, for pre-release versions. See [Publishing options](#publishing-options).
73
105
  :::
106
+
107
+ ## See Also
108
+
109
+ - [Example `mfe-publish` workflow](https://github.com/servicetitan/frontend-example/blob/master/.github/workflows/mfe-publish.yml)
110
+ - [Example `mfe-publish --clean` workflow](https://github.com/servicetitan/frontend-example/blob/master/.github/workflows/mfe-clean.yml)
@@ -2,7 +2,16 @@
2
2
  title: start
3
3
  ---
4
4
 
5
- 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.
5
+ Serves applications and [MFEs](../microfrontends) during development, watches source files, and automatically reloads pages on changes.
6
+
7
+ :::tip
8
+ To serve an application without `start`, [build](./build) it, then point any static http server to the output **bundle** directory, where the browser will find `index.html`. For example, to serve with [`http-server`](https://www.npmjs.com/package/http-server)
9
+
10
+ ```sh
11
+ npx -yes http-server packages/application/dist/bundle
12
+ ```
13
+
14
+ :::
6
15
 
7
16
  ## Options
8
17
 
@@ -18,3 +27,39 @@ Runs package in the development mode. Applications will be hosted on sequential
18
27
  The `start` command executes the same steps as the `build` command, then watches for changes and automatically reruns each step as needed.
19
28
 
20
29
  See [Build Steps](./build#build-steps).
30
+
31
+ ## Configuration
32
+
33
+ ### Port
34
+
35
+ Use `cli.webpack.port` to select the port to use for a package. By default, packages are served from the first available port starting from 8080.
36
+
37
+ ```json title="package.json"
38
+ {
39
+ "cli": {
40
+ "webpack": {
41
+ "port": 8888
42
+ }
43
+ }
44
+ }
45
+ ```
46
+
47
+ ### DevServer
48
+
49
+ Use `cli.webpack.devServer` to set or override `webpack-dev-server` options.
50
+
51
+ ```json title="package.json"
52
+ {
53
+ "cli": {
54
+ "webpack": {
55
+ "devServer": {
56
+ // webpack-dev-server options (https://webpack.js.org/configuration/dev-server/#devserver)
57
+ }
58
+ }
59
+ }
60
+ }
61
+ ```
62
+
63
+ :::tip
64
+ Set `cli.webpack.devServer` to `false` to disable `webpack-dev-server` altogether.
65
+ :::