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
+21-78Lines changed: 21 additions & 78 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -94,7 +94,7 @@ groups:
94
94
location: npm
95
95
package-name: your-package-name
96
96
config:
97
-
namespaceExport: your-client-name
97
+
namespaceExport: YourClientName
98
98
github:
99
99
repository: your-org/company-typescript
100
100
```
@@ -206,84 +206,27 @@ Use [GitHub Actions](https://docs.github.com/en/actions/get-started/quickstart)
206
206
1. **Save** your settings. Now GitHub can run the actions you configure.
207
207
208
208
</Step>
209
-
<Step title="Set up a publishing workflow">
210
-
211
-
Use GitHub Actions to set up a workflow that automatically publishes your new releases to npm.
212
-
213
-
To get started, navigate to the **Actions** tab in your repositiory and select **set up a workflow yourself**. GitHub will automatically set up a blank yml file in a new `.github/workflows` directory.
214
-
215
-
Rename this file `ci.yml`. Your file should look like this:
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
266
-
if [[ ${GITHUB_REF} == *alpha* ]]; then
267
-
npm publish --access public --tag alpha
268
-
elif [[ ${GITHUB_REF} == *beta* ]]; then
269
-
npm publish --access public --tag beta
270
-
else
271
-
npm publish --access public
272
-
fi
273
-
env:
274
-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
209
+
<Step title="Add token to `generators.yml`">
210
+
211
+
Add `token: ${NPM_TOKEN}` to `generators.yml` to tell Fern to use the `NPM_TOKEN` environment variable (which you just configured in your GitHub repo) for authentication when publishing to the npm registry.
For another example, see Vapi's [npm publishing GitHub Action](https://github.com/VapiAI/server-sdk-typescript/blob/main/.github/workflows/ci.yml)
278
-
</Step>
279
-
280
-
<Step title="Update `.fernignore`">
281
-
Once your workflow is configured, add your new workflow file to `.fernignore` so regenerating releases doesn't overwrite your workflow.
282
-
283
-
```diff title=".fernignore"
284
-
+ .github/workflows/ci.yml
285
-
```
286
-
229
+
When you regenerate your release, Fern will automatically create a workflow in your repository called `.github/workflows/ci.yml` that will automatically publish your release to npm. For an example, see Vapi's [npm publishing GitHub Action](https://github.com/VapiAI/server-sdk-typescript/blob/main/.github/workflows/ci.yml)
0 commit comments