fern-api / fern

Input OpenAPI. Output SDKs and Docs.
https://buildwithfern.com
Apache License 2.0
2.6k stars 139 forks source link

(fix, ts): Snippets and GitHub publish workflow #3858

Closed amckinney closed 3 months ago

amckinney commented 3 months ago

This fixes the following issues:

  1. The NPM publish job is not generated if the token environment variable is not specified. This was causing GitHub workflows to fail when the workflow should not have been generated at all.
  2. Improve the generated TypeScript snippets to use the client variable name instead of the namespace export. Snippets now look like the following:
import { AcmeClient } from "acme";

const client = new AcmeClient({ apiKey: "YOUR_API_KEY" });
await client.users.create({
  firstName: "john",
  lastName: "doe"
});