Skip to content

Commit

Permalink
improvement: TypeScript SDK steps in quickstart (#2829)
Browse files Browse the repository at this point in the history
* improvement: file path for generate typescript sdk

* fix indentation

* update jest ete tests

* truncate preview url

* remove log-level debug from preview ci
  • Loading branch information
dannysheridan authored Jan 29, 2024
1 parent d412a7f commit d54b433
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/preview-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
env:
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
run: |
OUTPUT=$(fern generate --docs --preview --log-level debug 2>&1) || true
OUTPUT=$(fern generate --docs --preview 2>&1) || true
echo "$OUTPUT"
URL=$(echo "$OUTPUT" | grep -oP 'Published docs to \K.*(?= \()')
echo "Preview URL: $URL"
Expand Down
19 changes: 9 additions & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,22 @@ Write code! We've got lots of open issues - feel free to volunteer for one by co

## Writing Documentation

Our documentation is powered by Fern's Docs product. All of the configuration for the docs lives in
Our documentation is powered by Fern's Docs product. All of the configuration for the docs lives in
[docs.yml](./fern/docs.yml).

To edit the docs, you can modify `docs.yml` or any of the markdown that it references.
To edit the docs, you can modify `docs.yml` or any of the markdown that it references.

To validate that the docs, run:

To validate that the docs, run:
```
npm install -g fern-api
fern check
```

When you make a PR to update the docs, a PR preview link will be generated which will allow you
to test if your changes came out as intended.
When you make a PR to update the docs, a PR preview link will be generated which will allow you
to test if your changes came out as intended.

## Local Development
## Local Development

Our repo is a monorepo that relies on [Yarn workspaces](https://yarnpkg.com/features/workspaces) and [Yarn Plug'n'Play](https://yarnpkg.com/features/pnp) to run smoothly.

Expand Down Expand Up @@ -60,13 +61,11 @@ yarn
2. Open the Command Palette (Cmd+Shift+P on Mac) and select `Typescript: Select TypeScript Version...`
3. Choose `Use Workspace Version`

This tells VSCode to rely on the version of TypeScript that lives in `.yarn/sdks/typescript`, which
is modified to work with Yarn PNP.
This tells VSCode to rely on the version of TypeScript that lives in `.yarn/sdks/typescript`, which is modified to work with Yarn PNP.

**Step 5: Install Husky**

Run `yarn husky install` from the root of the repo and this will configure pre-commit hooks that will
lint your changes.
Run `yarn husky install` from the root of the repo and this will configure pre-commit hooks that will lint your changes.

### Compiling

Expand Down
14 changes: 5 additions & 9 deletions fern/docs/pages/welcome/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ In this quickstart, we'll install Fern, initialize a sample API, and generate a

We'll use a [**Fern Definition**](/api-definition/fern-definition/overview) to describe our endpoints, types, and errors. Alternatively, you can use an [OpenAPI specification](/api-definition/openapi/importing-open-api).

```bash
npm install -g fern-api
```

### Prerequisites

- Node.js 18 or higher
Expand Down Expand Up @@ -89,10 +85,10 @@ groups:
local:
generators:
- name: fernapi/fern-typscript-node-sdk
version: 0.8.8
output:
location: local-file-system
path: ../generated/sdks/node
version: 0.x.x
output:
location: local-file-system
path: ../generated/sdks/typescript
```
</CodeBlock>

Expand All @@ -102,7 +98,7 @@ To invoke the generator, run:
fern generate
```

By default, Fern runs the generator in the cloud, compiles your API definition into files, and downloads them to your computer. Once complete, you'll see new files in `/generated/sdks/node/`.
By default, Fern runs the generator in the cloud, compiles your API definition into files, and downloads them to your computer. Once complete, you'll see new files in `/generated/sdks/typescript/`.

Note: The `generated/` directory will be created at the root level of your repository, one level up from the `fern/` folder.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ groups:
local:
generators:
- name: fernapi/fern-typescript-node-sdk
version: 0.7.2
version: 0.9.5
output:
location: local-file-system
path: ../generated/typescript
path: ../generated/sdks/typescript
- name: fernapi/fern-java-sdk
version: 0.5.7
- name: fernapi/fern-postman
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ groups:
local:
generators:
- name: fernapi/fern-typescript-node-sdk
version: 0.7.2
version: 0.9.5
output:
location: local-file-system
path: ../generated/typescript
path: ../generated/sdks/typescript
",
"name": "generators.yml",
"type": "file",
Expand Down Expand Up @@ -143,10 +143,10 @@ groups:
local:
generators:
- name: fernapi/fern-typescript-node-sdk
version: 0.7.2
version: 0.9.5
output:
location: local-file-system
path: ../generated/typescript
path: ../generated/sdks/typescript
",
"name": "generators.yml",
"type": "file",
Expand Down Expand Up @@ -300,10 +300,10 @@ groups:
local:
generators:
- name: fernapi/fern-typescript-node-sdk
version: 0.7.2
version: 0.9.5
output:
location: local-file-system
path: ../generated/typescript
path: ../generated/sdks/typescript
",
"name": "generators.yml",
"type": "file",
Expand Down Expand Up @@ -1239,10 +1239,10 @@ groups:
local:
generators:
- name: fernapi/fern-typescript-node-sdk
version: 0.7.2
version: 0.9.5
output:
location: local-file-system
path: ../generated/typescript
path: ../generated/sdks/typescript
",
"name": "generators.yml",
"type": "file",
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/init/src/createWorkspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ const GENERATORS_CONFIGURATION: GeneratorsConfigurationSchema = {
generators: [
{
name: "fernapi/fern-typescript-node-sdk",
version: "0.7.2",
version: "0.9.5",
output: {
location: "local-file-system",
path: "../generated/typescript"
path: "../generated/sdks/typescript"
}
}
]
Expand Down

0 comments on commit d54b433

Please sign in to comment.