Skip to content
Merged
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
33 changes: 23 additions & 10 deletions fern/products/sdks/guides/setup-local-sdk-previews.mdx
Original file line number Diff line number Diff line change
@@ -1,29 +1,42 @@
---
title: Setup local SDK previews
subtitle: Use Fern's CLI tool to preview your SDK locally.
title: Set up local SDK previews
description: Use Fern's CLI tool to preview your SDK locally.
---

[Once you configure your SDK](/learn/sdks/getting-started/generate-your-first-sdk), you can preview the generated SDK code using Fern's CLI.
Once you configure your SDK, you can use the `--preview` flag to test generated
SDK code locally before publishing. This allows quick iteration on your Fern definition
as you develop:

Simply append the `--preview` flag to the command used to generate the SDK and you will see the generated code populated in a `.preview` folder within your `fern` folder.
```bash
# Preview all SDKs
fern generate --preview

<Tip title="Custom Code">
[If you have added custom code to your SDK](/learn/sdks/capabilities/augment-with-custom-code), `--preview` will
preserve those changes.
# Preview SDK for a specific language
fern generate --group <language>-sdk --preview

```

`--preview` generates your SDK code into a local `.preview/` folder within your
`fern` folder. No changes are published to package managers or GitHub.

<Tip>
`--preview` preserves any custom code you added to your SDK.
</Tip>

Here's an example of how you can preview your SDK:
## Example usage

Here's an example of how you can preview a Python SDK.

<Steps>
### Generator configuration
```yaml generators.yml
```yaml title="generators.yml" {4}
api:
path: ./path/to/openapi.yml
groups:
python-sdk:
generators:
- name: fernapi/fern-python-sdk
version: 3.0.0
version: <Markdown src="/snippets/version-number.mdx"/>
output:
location: pypi
package-name: imdb
Expand Down