|
1 | 1 | --- |
2 | | -title: Setup local SDK previews |
3 | | -subtitle: Use Fern's CLI tool to preview your SDK locally. |
| 2 | +title: Set up local SDK previews |
| 3 | +description: Use Fern's CLI tool to preview your SDK locally. |
4 | 4 | --- |
5 | 5 |
|
6 | | -[Once you configure your SDK](/learn/sdks/getting-started/generate-your-first-sdk), you can preview the generated SDK code using Fern's CLI. |
| 6 | +Once you configure your SDK, you can use the `--preview` flag to test generated |
| 7 | +SDK code locally before publishing. This allows quick iteration on your Fern definition |
| 8 | +as you develop: |
7 | 9 |
|
8 | | -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. |
| 10 | +```bash |
| 11 | +# Preview all SDKs |
| 12 | +fern generate --preview |
9 | 13 |
|
10 | | -<Tip title="Custom Code"> |
11 | | - [If you have added custom code to your SDK](/learn/sdks/capabilities/augment-with-custom-code), `--preview` will |
12 | | - preserve those changes. |
| 14 | +# Preview SDK for a specific language |
| 15 | +fern generate --group <language>-sdk --preview |
| 16 | + |
| 17 | +``` |
| 18 | + |
| 19 | +`--preview` generates your SDK code into a local `.preview/` folder within your |
| 20 | +`fern` folder. No changes are published to package managers or GitHub. |
| 21 | + |
| 22 | +<Tip> |
| 23 | + `--preview` preserves any custom code you added to your SDK. |
13 | 24 | </Tip> |
14 | 25 |
|
15 | | -Here's an example of how you can preview your SDK: |
| 26 | +## Example usage |
| 27 | + |
| 28 | +Here's an example of how you can preview a Python SDK. |
16 | 29 |
|
17 | 30 | <Steps> |
18 | 31 | ### Generator configuration |
19 | | -```yaml generators.yml |
| 32 | +```yaml title="generators.yml" {4} |
20 | 33 | api: |
21 | 34 | path: ./path/to/openapi.yml |
22 | 35 | groups: |
23 | 36 | python-sdk: |
24 | 37 | generators: |
25 | 38 | - name: fernapi/fern-python-sdk |
26 | | - version: 3.0.0 |
| 39 | + version: <Markdown src="/snippets/version-number.mdx"/> |
27 | 40 | output: |
28 | 41 | location: pypi |
29 | 42 | package-name: imdb |
|
0 commit comments