@servicetitan/docs-uikit 31.6.0 → 32.0.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.
@@ -2,6 +2,24 @@
2
2
  title: BREAKING CHANGES
3
3
  ---
4
4
 
5
+ ## v32.0.0
6
+
7
+ ### [@servicetitan/startup](./startup)
8
+
9
+ :::caution
10
+ This breaking change affects local development, even if you do not update the `@servicetitan/startup` dependency directly. On a clean install, the standard bootstrap script runs the latest version of `startup`, which automatically removes hard-coded tokens from `.npmrc` files.
11
+ :::
12
+
13
+ Removed support for hard-coded npm tokens in `.npmrc` files. The new `startup install` removes hard-coded authentication tokens from project `.npmrc` files and, in development environments, automatically adds a token to npm's per-user configuration that grants access to ServiceTitan's private packages.
14
+
15
+ Projects that previously relied on hard-coded tokens must update their Github and Teamcity workflows to instead use the organization secret as described in the [startup install documentation](./startup/install#configuring-npm-token-in-ci):
16
+
17
+ - Option 1: Inject the organization secret into `.npmrc`.
18
+ - Option 2: Configure `.npmrc` to get the organization secret from an environment variable.
19
+
20
+ **Why this change?**
21
+ Two recent incidents mandated that we revoke the shared token that grants access to ServiceTitan's private packages. By removing hard-coded tokens, ServiceTitan can more easily and seamlessly rotate or revoke tokens, improving security and reducing friction for developers.
22
+
5
23
  ## v31.0.0
6
24
 
7
25
  ### [@servicetitan/startup](./startup)
@@ -2,6 +2,9 @@
2
2
  title: install
3
3
  ---
4
4
 
5
+ import Tabs from '@theme/Tabs';
6
+ import TabItem from '@theme/TabItem';
7
+
5
8
  Installs project dependencies.
6
9
 
7
10
  Use this command instead of plain `npm install` to guarantee that all packages are installed correctly and any necessary post-install steps are performed.
@@ -11,3 +14,151 @@ npx --yes @servicetitan/startup install
11
14
  ```
12
15
 
13
16
  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) for how to use `install` in an npm script.
17
+
18
+ ## Options
19
+
20
+ | Option | Description |
21
+ | :----------- | :-------------------------------------------- |
22
+ | `--no-token` | Disable configuring npm authentication token. |
23
+
24
+ ## Configuring NPM Token in Development
25
+
26
+ 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
+ :::caution
29
+ `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
+ 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.
31
+ :::
32
+
33
+ ## Configuring NPM Token in CI
34
+
35
+ In CI environments such as Teamcity and Github, use the `ST_NPM_READONLY_TOKEN` organization secret to grant access to private ServiceTitan packages. You can do this in two ways:
36
+
37
+ ### Option 1: Inject into .npmrc (Recommended)
38
+
39
+ The recommended method is to use `npm config set --location=project` to manually inject the organization secret into the project's `.npmrc`. For example,
40
+
41
+ <Tabs
42
+ defaultValue="github"
43
+ values={[{ label: "Github Action", value: "github"}, {label: "Dockerfile", value: "docker"}]}>
44
+
45
+ <TabItem value="github">
46
+
47
+ ```yml
48
+ - run: npm config set --location=project "//registry.npmjs.org/:_authToken"="${{ secrets.ST_NPM_READONLY_TOKEN }}"
49
+ - run: npm run build
50
+ ```
51
+
52
+ Alternatively, in Github actions using `action/setup-node`, you can use `registry-url` and `env.NODE_AUTH_TOKEN` to have it configure the project level `.npmrc`. For example,
53
+
54
+ ```yml
55
+ - uses: actions/setup-node@v4
56
+ registry-url: https://registry.npmjs.org
57
+ env:
58
+ NODE_AUTH_TOKEN: ${{ secrets.ST_NPM_READONLY_TOKEN }}
59
+ ```
60
+
61
+ </TabItem>
62
+ <TabItem value="docker">
63
+
64
+ ```dockerfile
65
+ ARG NPM_READONLY_TOKEN
66
+
67
+ RUN npm config set --location=project "//registry.npmjs.org/:_authToken=$NPM_READONLY_TOKEN"
68
+ RUN npm run build
69
+ ```
70
+
71
+ </TabItem>
72
+ </Tabs>
73
+
74
+ ### Option 2: Use environment variable
75
+
76
+ :::caution
77
+ Using an environment variable is not recommended because it requires [extra steps](#how-to-configure-with-legacy-startup) to rotate the token in projects using `startup` v31 or earlier.
78
+ :::
79
+
80
+ To use an environment variable to configure the npm token, modify `.npmrc` to get the token from an environment variable,
81
+
82
+ ```npmrc title=".npmrc"
83
+ //registry.npmjs.org/:_authToken=${NPM_READONLY_TOKEN}
84
+ ```
85
+
86
+ Then, in the CI action, set that environment variable to the organization secret. For example,
87
+
88
+ <Tabs
89
+ defaultValue="github"
90
+ values={[{ label: "Github Action", value: "github"}, {label: "Dockerfile", value: "docker"}]}>
91
+
92
+ <TabItem value="github">
93
+
94
+ ```yml
95
+ - run: npm run build
96
+ env:
97
+ NPM_READONLY_TOKEN: ${{ secrets.ST_NPM_READONLY_TOKEN }}
98
+ ```
99
+
100
+ </TabItem>
101
+ <TabItem value="docker">
102
+
103
+ ```dockerfile
104
+ ARG NPM_READONLY_TOKEN
105
+
106
+ ENV NPM_READONLY_TOKEN=${NPM_READONLY_TOKEN}
107
+
108
+ RUN npm run build
109
+ ```
110
+
111
+ </TabItem></Tabs>
112
+
113
+ ## How to Configure Development Environment When Not Using Startup v32 or Later {#how-to-configure-with-legacy-startup}
114
+
115
+ :::note
116
+ These instructions are only for projects using [Option 2](#option-2-use-environment-variable) with `startup` v31 or earlier (or that are not using `startup` at all);
117
+ `startup` v32 automatically detects and provides environment variables to `npm install`.
118
+ :::
119
+
120
+ 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
+
122
+ 1. Run `npx --yes @servicetitan/startup@latest install` to add the token to your per-user configuration.
123
+ 2. Run `npm config get userconfig` to get the location of your per-user configuration file.
124
+ 3. Find the token in the configuration file, on the line that starts `//registry.npmjs.org/:_authToken=`
125
+ 4. Create a local environment variable with the token. Use the same variable name as in project's `.npmrc`.
126
+
127
+ :::tip
128
+ On MacOS you can accomplish steps 2 and 3 with this single command:
129
+
130
+ ```sh
131
+ grep registry.npmjs.org < $(npm config get userconfig)
132
+ ```
133
+
134
+ :::
135
+
136
+ ## How to Use --no-token
137
+
138
+ If startup mistakes your CI environment for a development machine and it isn't practical to add a `CI` environment variable to the workflow, use `--no-token` to instruct `startup install` not to attempt to configure the npm token.
139
+
140
+ Create a `build:ci` script and accompanying pre script that runs `bootstrap` with `-- --no-token`:
141
+
142
+ ```json title="package.json"
143
+ "scripts": {
144
+ "prebuild:ci": "npm run bootstrap -- --no-token",
145
+ "build:ci": "startup build"
146
+ },
147
+ ```
148
+
149
+ Then, call `build:ci` instead of `build` in the CI workflow:
150
+
151
+ ```sh
152
+ npm run build:ci
153
+ ```
154
+
155
+ :::note
156
+ This assumes you're using this recommended `bootstrap` script:
157
+
158
+ ```json
159
+ "scripts": {
160
+ "bootstrap": "npx --yes @servicetitan/startup install",
161
+ }
162
+ ```
163
+
164
+ :::
@@ -17,4 +17,4 @@ Runs package in the development mode. Applications will be hosted on sequential
17
17
 
18
18
  The `start` command executes the same steps as the `build` command, then watches for changes and automatically reruns each step as needed.
19
19
 
20
- See [Build Steps](/docs/frontend/uikit/startup/build#build-steps).
20
+ See [Build Steps](./build#build-steps).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@servicetitan/docs-uikit",
3
- "version": "31.6.0",
3
+ "version": "32.0.1",
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": "533bcbd267e11c88700b29f539ca1cb5de6440ae"
19
+ "gitHead": "2b74dd72d39c2023151699d1cf7a6e6130d64279"
20
20
  }