Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 13 additions & 6 deletions fern/products/sdks/overview/typescript/publishing-to-npm.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ title: Publishing to NPM
description: How to publish the Fern Typescript SDK to npm.
---

Publish your public-facing Fern Typescript SDK to the [npm registry](https://www.npmjs.com/). Once you've followed the steps on this page to connect your npm account to your SDK, Fern will automatically publish the latest version of your SDK.
Publish your public-facing Fern Typescript SDK to the [npm
registry](https://www.npmjs.com/). After following the steps on this page,
you'll have a versioned package published on npm.

<Frame>
<img src="assets/npm-packages.png" alt="Creating NPM Automation Token" />
</Frame>

<Info>This guide assumes that you already have an initialized `fern` folder on your local machine. If you don’t, run `fern init`. See [TypeScript Quickstart](quickstart.mdx) for more details.</Info>

Expand All @@ -21,17 +27,18 @@ Publish your public-facing Fern Typescript SDK to the [npm registry](https://www

Navigate to your `generators.yml` on your local machine. Your `generators.yml` lives inside of your `fern` folder and contains all the configuration for your Fern generators.

In order to generate the SDK, add the generator to your `generators.yml` using the `fern <add>` command:
Add a new generator to `generators.yml`:


```bash
fern add fern-typescript-node-sdk --group ts-sdk
```

Once the command completes, you'll see a new group created in your `generators.yml`:

```yaml {2-7}
groups:
groups:
local:
...
ts-sdk:
generators:
Expand Down Expand Up @@ -93,7 +100,7 @@ groups:
location: npm
package-name: your-package-name
config:
namespaceExport: your-client-name
namespaceExport: YourClientName # must be a valid JavaScript/TypeScript identifier
```

</Step>
Expand Down Expand Up @@ -216,7 +223,7 @@ ts-sdk:
Regenerate your SDK and publish it on npm:

```bash
fern generate --version <version>
fern generate --group ts-sdk --version <version>
```
Local machine output will verify that the release is pushed to your repository and tagged with the version you specified. You'll receive an email from npm notifying you that a new version of your package has been successfully published!

Expand Down