Skip to content

Commit

Permalink
(feature, ts): Add generator-cli client to generate README.md (#3817)
Browse files Browse the repository at this point in the history
  • Loading branch information
amckinney authored Jun 10, 2024
1 parent e46edb1 commit 176feb8
Show file tree
Hide file tree
Showing 80 changed files with 8,215 additions and 43 deletions.
41 changes: 28 additions & 13 deletions .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion generators/commons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"@fern-api/fs-utils": "workspace:*",
"@fern-api/logger": "workspace:*",
"@fern-api/logging-execa": "workspace:*",
"@fern-fern/generator-exec-sdk": "^0.0.845",
"@fern-fern/generator-exec-sdk": "^0.0.879",
"@fern-fern/ir-sdk": "0.0.3294",
"tmp-promise": "^3.0.3",
"zod": "^3.22.3"
Expand Down
2 changes: 1 addition & 1 deletion generators/csharp/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@fern-api/fern-csharp-model": "workspace:*",
"@fern-api/fs-utils": "workspace:*",
"@fern-api/generator-commons": "workspace:*",
"@fern-fern/generator-exec-sdk": "^0.0.845",
"@fern-fern/generator-exec-sdk": "^0.0.879",
"@fern-fern/ir-sdk": "0.0.3318",
"lodash-es": "^4.17.21",
"zod": "^3.22.3"
Expand Down
2 changes: 1 addition & 1 deletion generators/ruby/codegen/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
},
"dependencies": {
"@fern-api/fs-utils": "workspace:*",
"@fern-fern/generator-exec-sdk": "^0.0.845",
"@fern-fern/generator-exec-sdk": "^0.0.879",
"@fern-fern/ir-sdk": "^32",
"lodash-es": "^4.17.21",
"url-join": "^5.0.0"
Expand Down
2 changes: 1 addition & 1 deletion generators/ruby/model/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@fern-api/logging-execa": "workspace:*",
"@fern-api/ruby-codegen": "workspace:*",
"@fern-api/ruby-generator-cli": "workspace:*",
"@fern-fern/generator-exec-sdk": "^0.0.845",
"@fern-fern/generator-exec-sdk": "^0.0.879",
"@fern-fern/ir-sdk": "^32",
"zod": "^3.22.3"
},
Expand Down
2 changes: 1 addition & 1 deletion generators/ruby/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"@fern-api/logging-execa": "workspace:*",
"@fern-api/ruby-codegen": "workspace:*",
"@fern-api/ruby-generator-cli": "workspace:*",
"@fern-fern/generator-exec-sdk": "^0.0.845",
"@fern-fern/generator-exec-sdk": "^0.0.879",
"@fern-fern/ir-sdk": "^32",
"zod": "^3.22.3"
},
Expand Down
2 changes: 1 addition & 1 deletion generators/typescript/express/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"dockerTagVersion": "./docker/create_docker.sh"
},
"devDependencies": {
"@fern-fern/generator-exec-sdk": "^0.0.845",
"@fern-fern/generator-exec-sdk": "^0.0.879",
"@fern-fern/ir-sdk": "^0.0.3515",
"@fern-typescript/abstract-generator-cli": "workspace:*",
"@fern-typescript/commons": "workspace:*",
Expand Down
10 changes: 7 additions & 3 deletions generators/typescript/sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.22.0] - 2024-06-07

- Feature: Add support for higher quality `README.md` generation.

## [0.21.1] - 2024-06-05

- Improvement: Detect `workerd` (Cloudflare) environments in `Runtime.ts`. The `Stream` class which is
used for Server-Sent Events now prefers `TextDecoder` if it is present in the environment, to
work in Cloudflare environments.
- Improvement: Detect `workerd` (Cloudflare) environments in `Runtime.ts`. The `Stream` class which is
used for Server-Sent Events now prefers `TextDecoder` if it is present in the environment, to
work in Cloudflare environments.

## [0.21.0] - 2024-06-05

Expand Down
2 changes: 1 addition & 1 deletion generators/typescript/sdk/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.21.1
0.22.0
1 change: 1 addition & 0 deletions generators/typescript/sdk/cli/node-docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ COPY generators/typescript/utils/core-utilities/callback-queue/src/ /assets/call
COPY generators/typescript/utils/core-utilities/auth/src/ /assets/auth
COPY generators/typescript/utils/core-utilities/zurg/src/ /assets/zurg
COPY generators/typescript/utils/core-utilities/base/src/ /assets/base-core-utilities
COPY generators/typescript/sdk/features.yml /assets/features.yml
RUN find /assets -name __test__ -exec rm -rf {} \+

COPY generators/typescript/sdk/cli/node-docker/dist/nodeCli.cjs /nodeCli.cjs
Expand Down
4 changes: 4 additions & 0 deletions generators/typescript/sdk/cli/src/SdkGeneratorCli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ export class SdkGeneratorCli extends AbstractGeneratorCli<SdkCustomConfig> {
apiName: intermediateRepresentation.apiName.originalName,
whitelabel: config.whitelabel,
generateOAuthClients: config.generateOauthClients,
originalReadmeFilepath:
config.originalReadmeFilepath != null
? AbsoluteFilePath.of(config.originalReadmeFilepath)
: undefined,
snippetFilepath:
config.output.snippetFilepath != null
? AbsoluteFilePath.of(config.output.snippetFilepath)
Expand Down
53 changes: 53 additions & 0 deletions generators/typescript/sdk/features.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
features:
- id: USAGE
description: |
Instantiate and use the client with the following:
- id: REQUEST_AND_RESPONSE_TYPES
description: |
The SDK exports all request and response types as TypeScript interfaces. Simply import them with the
following namespace:
- id: EXCEPTION_HANDLING
description: |
When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
will be thrown.
- id: RETRIES
description: |
The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
as the request is deemed retriable and the number of retry attempts has not grown larger than the configured
retry limit (default: 2).
A request is deemed retriable when any of the following HTTP status codes is returned:
- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
Use the `maxRetries` request option to configure this behavior.
- id: TIMEOUTS
description: |
The SDK defaults to a 60 second timeout. Use the `timeoutInSeconds` option to configure this behavior.
- id: ABORTING_REQUESTS
description: |
The SDK allows users to abort requests at any point by passing in an abort signal.
- id: RUNTIME_COMPATIBILITY
description: |
The SDK defaults to `node-fetch` but will use the global fetch client if present. The SDK works in the following
runtimes:
- Node.js 18+
- Vercel
- Cloudflare Workers
- Deno v1.25+
- Bun 1.0+
- React Native
### Customizing Fetch Client
The SDK provides a way for your to customize the underlying HTTP client / Fetch function. If you're running in an
unsupported environment, this provides a way for you to break glass and ensure the SDK works.
8 changes: 7 additions & 1 deletion generators/typescript/sdk/generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@
"dependencies": {
"@fern-api/core-utils": "workspace:*",
"@fern-api/fs-utils": "workspace:*",
"@fern-fern/generator-exec-sdk": "^0.0.845",
"@fern-api/logger": "workspace:*",
"@fern-api/logging-execa": "workspace:*",
"@fern-fern/generator-cli-sdk": "^0.0.25",
"@fern-fern/generator-exec-sdk": "^0.0.879",
"@fern-fern/ir-sdk": "^0.0.3515",
"@fern-fern/snippet-sdk": "^0.0.5434",
"@fern-typescript/commons": "workspace:*",
Expand All @@ -48,7 +51,9 @@
"@fern-typescript/type-reference-example-generator": "workspace:*",
"@fern-typescript/type-schema-generator": "workspace:*",
"@types/uuid": "^9.0.8",
"js-yaml": "^4.1.0",
"lodash-es": "^4.17.21",
"tmp-promise": "^3.0.3",
"ts-morph": "^15.1.0",
"ts-poet": "^6.7.0",
"url-join": "^5.0.0",
Expand All @@ -59,6 +64,7 @@
"@babel/preset-typescript": "^7.24.1",
"@types/jest": "^29.0.3",
"@types/jest-specific-snapshot": "^0.5.7",
"@types/js-yaml": "^4.0.8",
"@types/lodash-es": "^4.17.12",
"@types/node": "^18.7.18",
"@types/url-join": "4.0.1",
Expand Down
Loading

0 comments on commit 176feb8

Please sign in to comment.