You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: fern/products/sdks/overview/typescript/publishing-to-npm.mdx
+97-83Lines changed: 97 additions & 83 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,9 +22,9 @@ you'll have a versioned package published on npm.
22
22
23
23
</Info>
24
24
25
-
## Configure `generators.yml`
25
+
## Configure SDK package settings
26
26
27
-
<Note>Your `generators.yml`[should live in your source repository](/sdks/overview/project-structure) (or on your local machine), not the repository that contains your TypeScript SDK code.</Note>
27
+
You'll need to update your `generators.yml` file to configure the package name, output location, and client naming for npm publishing. Your `generators.yml`[should live in your source repository](/sdks/overview/project-structure) (or on your local machine), not the repository that contains your TypeScript SDK code.
28
28
29
29
<Steps>
30
30
<Steptitle="Configure `output` location">
@@ -79,26 +79,6 @@ you'll have a versioned package published on npm.
79
79
80
80
</Step>
81
81
82
-
<Steptitle="Add repository location">
83
-
84
-
Add the path to the GitHub repository containing your TypeScript SDK:
Add `token: ${NPM_TOKEN}` to `generators.yml` to tell Fern to use the `NPM_TOKEN` environment variable for authentication when publishing to the npm registry.
You can also configure other settings, like the reviwers or license. Refer to the [full `github` reference](/sdks/reference/generators-yml#github) for more information.
212
+
213
+
</Step>
214
+
</Steps>
215
+
216
+
## Publish your SDK
217
+
218
+
Decide how you want to publish your SDK to npm. You can use GitHub workflows for automated releases or publish directly via the CLI.
167
219
168
220
<AccordionGroup>
169
-
<Accordiontitle="Release via a GitHub workflow (recommended)">
221
+
222
+
<Accordiontitle="Release via a GitHub workflow">
170
223
171
224
Set up a release workflow via [GitHub Actions](https://docs.github.com/en/actions/get-started/quickstart) so you can trigger new SDK releases directly from your source repository.
172
225
@@ -203,26 +256,6 @@ Set up a release workflow via [GitHub Actions](https://docs.github.com/en/action
@@ -261,64 +294,45 @@ Set up a release workflow via [GitHub Actions](https://docs.github.com/en/action
261
294
</Note>
262
295
</Step>
263
296
264
-
<Steptitle="Run your workflow">
297
+
<Steptitle="Regenerate and release your SDK">
265
298
266
-
Navigate to the **Actions** tab, select the workflow you just created, specify a version number, and click **Run workflow**.
267
-
268
-
This regenerates your SDK, tags the new release with the version number you specified, and initiates a Fern-generated publishing workflow in your TypeScript SDK repository that publishes your release to npm.
299
+
Navigate to the **Actions** tab, select the workflow you just created, specify a version number, and click **Run workflow**. This regenerates your SDK.
<Accordiontitle="Release via CLI and environment variables">
281
314
<Steps>
282
-
<Steptitle="Configure npm authentication token">
283
315
284
-
Add `token: ${NPM_TOKEN}` to `generators.yml` to tell Fern to use the `NPM_TOKEN`environment variable for authentication when publishing to the npm registry.
Set the `NPM_TOKEN` environment variable on your local machine:
303
319
304
-
Set the `NPM_TOKEN` environment variable on your local machine:
320
+
```bash
321
+
export NPM_TOKEN=your-actual-npm-token
322
+
```
305
323
306
-
```bash
307
-
export NPM_TOKEN=your-actual-npm-token
308
-
```
324
+
</Step>
325
+
<Steptitle="Regenerate and release your SDK">
309
326
310
-
</Step>
311
-
<Steptitle="Regenerate your SDK">
312
-
Regenerating your SDK tags the new release with the version number you specified and initiates a Fern-generated publishing workflow in your TypeScript SDK repository that publishes your release to npm.
327
+
Regenerate your SDK, specifying the version:
313
328
314
-
```bash
315
-
fern generate --group ts-sdk --version <version>
316
-
```
317
-
Local machine output will verify that the release is pushed to your
318
-
repository and tagged with the version you specified. Log back into npm and
The rest of the release process depends on your chosen mode:
2
+
3
+
-**Release mode (default):** If you didn't specify a `mode` or set `mode: release`, no further action is required. Fern automatically tags the new release with your specified version number and initiates the npm publishing workflow in your SDK repository.
4
+
5
+
-**Pull request or push mode:** If you set `mode: pull-request` or `mode: push`, Fern creates a pull request. Merge this PR and tag a new release to initiate the npm publishing workflow in your SDK repository.
6
+
7
+
Once the workflow completes, you can view your new release by logging into npm and navigating to **Packages**.
0 commit comments