|
1 | 1 | --- |
2 | | -title: 'Overview' |
| 2 | +title: Overview |
3 | 3 | subtitle: Manage and configure your Fern projects, all from the command line. |
4 | | -description: 'Overview of the Fern CLI including usage, installation, and CI/CD environments' |
| 4 | +description: Overview of the Fern CLI including usage, installation, and CI/CD environments |
5 | 5 | --- |
6 | 6 |
|
7 | 7 | ## Installing Fern CLI |
8 | 8 |
|
9 | 9 | Run the following command to download and install Fern CLI from the [npm](https://www.npmjs.com/) registry. |
10 | 10 |
|
11 | | -```bash |
| 11 | +or you can install from homebrew. |
| 12 | + |
| 13 | +``` |
| 14 | +brew install fern-api |
| 15 | +``` |
| 16 | + |
| 17 | +> This is the coolest way to install the API, tho: |
| 18 | +
|
| 19 | +``` |
| 20 | +
|
| 21 | +
|
12 | 22 | npm install -g fern-api # install Fern CLI |
13 | 23 | fern -v # ensure Fern was successfully installed |
14 | 24 | ``` |
15 | 25 |
|
16 | 26 | <Accordion title="Installing Fern CLI locally" toc={true}> |
| 27 | + If you're experiencing network delays with the global installation, working in an environment with limited internet connectivity, or prefer to manage Fern as a project dependency, you can install the CLI locally: |
| 28 | + |
| 29 | + <Steps> |
| 30 | + <Step title="Install as project dependency"> |
| 31 | + Add `fern-api` to your project dependencies: |
17 | 32 |
|
18 | | -If you're experiencing network delays with the global installation, working in an environment with limited internet connectivity, or prefer to manage Fern as a project dependency, you can install the CLI locally: |
| 33 | + ```bash |
| 34 | + npm install fern-api |
| 35 | + ``` |
19 | 36 |
|
20 | | -<Steps> |
21 | | -<Step title="Install as project dependency"> |
| 37 | + </Step> |
22 | 38 |
|
23 | | -Add `fern-api` to your project dependencies: |
| 39 | + <Step title="Update configuration"> |
| 40 | + In your `fern.config.json`, set the version to `*` to use your locally installed version: |
24 | 41 |
|
25 | | -```bash |
26 | | -npm install fern-api |
27 | | -``` |
| 42 | + ```json |
| 43 | + { |
| 44 | + "organization": "your-org", |
| 45 | + "version": "*" |
| 46 | + } |
| 47 | + ``` |
28 | 48 |
|
29 | | -</Step> |
| 49 | + </Step> |
30 | 50 |
|
31 | | -<Step title="Update configuration"> |
| 51 | + <Step title="Run via package manager"> |
| 52 | + Use your package manager to run Fern commands: |
32 | 53 |
|
33 | | -In your `fern.config.json`, set the version to `*` to use your locally installed version: |
| 54 | + ```bash |
| 55 | + npm fern check # Validate API definition |
| 56 | + npm fern --version # Check CLI version to see if it's right |
| 57 | + npm fern generate # Generate outputs |
| 58 | + ``` |
| 59 | + </Step> |
| 60 | + </Steps> |
| 61 | +</Accordion> |
34 | 62 |
|
35 | | -```json fern.config.json {3} |
36 | | -{ |
37 | | - "organization": "your-org", |
38 | | - "version": "*" |
39 | | -} |
| 63 | + |
| 64 | +```ruby |
| 65 | +Stripe::Charge.create(payment_method: "pm_card_visa") |
40 | 66 | ``` |
41 | 67 |
|
42 | | -</Step> |
| 68 | +```python |
| 69 | +stripe.Charge.create( "payment_method" : "pm_card_visa") |
| 70 | +``` |
43 | 71 |
|
44 | | -<Step title="Run via package manager"> |
| 72 | +<Tabs> |
| 73 | + <Tab title="Ruby"> |
45 | 74 |
|
46 | | -Use your package manager to run Fern commands: |
| 75 | + </Tab> |
47 | 76 |
|
48 | | -```bash |
49 | | -npm fern check # Validate API definition |
50 | | -npm fern --version # Check CLI version |
51 | | -npm fern generate # Generate outputs |
52 | | -``` |
| 77 | + <Tab title="Python"> |
53 | 78 |
|
54 | | -</Step> |
55 | | -</Steps> |
| 79 | + </Tab> |
| 80 | +</Tabs> |
56 | 81 |
|
57 | | -</Accordion> |
58 | 82 |
|
59 | 83 | ## CLI quickstart |
60 | 84 |
|
@@ -84,41 +108,47 @@ The "default SDK group" refers to the group marked as default in your `generator |
84 | 108 | <AccordionGroup> |
85 | 109 | <Accordion title="Setting up Docs"> |
86 | 110 | 1. Initialize a new docs project: |
87 | | - ```bash |
88 | | - fern init --docs |
89 | | - ``` |
90 | | - |
91 | | - 2. Preview locally while making changes: |
92 | | - ```bash |
93 | | - fern docs dev |
94 | | - ``` |
95 | | - |
96 | | - 3. When ready to preview or publish: |
97 | | - ```bash |
98 | | - fern generate --docs --preview # Generate a shareable preview link |
99 | | - fern generate --docs # Publish to production |
100 | | - ``` |
| 111 | + |
| 112 | + ```bash |
| 113 | + fern init --docs |
| 114 | + ``` |
| 115 | + |
| 116 | + 2. Preview locally while making changes: |
| 117 | + |
| 118 | + ```bash |
| 119 | + fern docs dev |
| 120 | + ``` |
| 121 | + |
| 122 | + 3. When ready to preview or publish: |
| 123 | + |
| 124 | + ```bash |
| 125 | + fern generate --docs --preview # Generate a shareable preview link |
| 126 | + fern generate --docs # Publish to production |
| 127 | + ``` |
| 128 | + |
101 | 129 | </Accordion> |
102 | 130 |
|
103 | 131 | <Accordion title="Setting up SDK generation"> |
104 | 132 | 1. Initialize a new SDK project: |
| 133 | + |
105 | 134 | ```bash |
106 | 135 | fern init |
107 | 136 | ``` |
108 | | - |
| 137 | + |
109 | 138 | 2. Configure your generators in [configuration options](/learn/sdks/introduction/configuration) |
110 | | - |
| 139 | + |
111 | 140 | 3. Generate SDKs: |
| 141 | + |
112 | 142 | ```bash |
113 | 143 | fern generate --preview # Preview changes locally |
114 | 144 | fern generate --group python-sdk --preview # Preview specific SDK group |
115 | 145 | fern generate # Publish to production |
116 | 146 | ``` |
117 | 147 |
|
118 | 148 | <Tip> |
119 | | - During development, use `--preview` to test your changes locally before publishing. |
| 149 | + During development, use `--preview` to test your changes locally before publishing. |
120 | 150 | The preview SDK will be generated into the `.preview/` folder. |
121 | 151 | </Tip> |
122 | 152 | </Accordion> |
123 | | - |
124 | 153 | </AccordionGroup> |
| 154 | + |
0 commit comments