Skip to content

Commit

Permalink
temp: update readme except client plugin architecture and what is mis…
Browse files Browse the repository at this point in the history
…sing
  • Loading branch information
Steven Yuan committed Nov 3, 2023
1 parent d995aff commit 32ec37c
Showing 1 changed file with 36 additions and 6 deletions.
42 changes: 36 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
`smithy-typescript` includes the reference implementations of the [Smithy](https://smithy.io/) code generators for [TypeScript](https://www.typescriptlang.org/).

For Client SDK code generation, the `typescript-client-codegen` plugin provides a framework for generating customizable TypeScript clients that can support multiple JavaScript platforms, including Node.js, Browser, and React-Native. See [the section on generating a client to see how to get started](#generating-a-client), or [the `typescript-client-plugin` documentation](#client-sdk-code-generation-typescript-client-codegen-plugin).
For Client SDK code generation, the `typescript-client-codegen` plugin provides a framework for generating customizable TypeScript clients that can support multiple JavaScript platforms, including Node.js, Browser, and React-Native. See [the section on generating a client to see how to get started](#generating-a-client), or [the `typescript-client-codegen` documentation](#client-sdk-code-generation-typescript-client-codegen-plugin).

For Server SDK code generation, the `typescript-server-codegen` plugin provides a framework for generating server scaffolding at a higher level of abstraction and with type safety. More documentation can be found at in [the `typescript-server-plugin` documentation](#server-sdk-code-generation-typescript-server-codegen-plugin), or [smithy.io](https://smithy.io/2.0/ts-ssdk/index.html).
For Server SDK code generation, the `typescript-server-codegen` plugin provides a framework for generating server scaffolding at a higher level of abstraction and with type safety. More documentation can be found at in [the `typescript-server-codegen` documentation](#server-sdk-code-generation-typescript-server-codegen-plugin), or [smithy.io](https://smithy.io/2.0/ts-ssdk/index.html).

## Generating a client

The Smithy TypeScript `typescript-client-plugin` code generator in this repository generates TypeScript clients from Smithy models, and can be built with both the idiomatic [Smithy CLI](#using-smithy-typescript-with-the-smithy-cli) or through [Gradle](#using-smithy-typescript-with-gradle).
The Smithy TypeScript `typescript-client-codegen` code generator in this repository generates TypeScript clients from Smithy models, and can be built with both the idiomatic [Smithy CLI](#using-smithy-typescript-with-the-smithy-cli) or through [Gradle](#using-smithy-typescript-with-gradle).

> The Smithy CLI is a prerequisite for this section when using the `smithy init` commands. See [the installation guide](https://smithy.io/2.0/guides/smithy-cli/cli_installation.html) for how to install the Smithy CLI. If installing the Smithy CLI is not preferred, the templates used can be found in the [Smithy Examples repository](https://github.com/smithy-lang/smithy-examples).
For additional configuration, see [the `typescript-client-plugin` documentation](#client-sdk-code-generation-typescript-client-codegen-plugin) and [the documentation for `smithy-build.json`](https://smithy.io/2.0/guides/building-models/build-config.html).
For additional configuration, see [the `typescript-client-codegen` documentation](#client-sdk-code-generation-typescript-client-codegen-plugin) and [the documentation for `smithy-build.json`](https://smithy.io/2.0/guides/building-models/build-config.html).

### Using Smithy TypeScript with the Smithy CLI

Expand Down Expand Up @@ -185,9 +185,39 @@ By default, the Smithy TypeScript code generators provide the code generation fr

TODO Overview of generated output (what should I expect)

```
build/smithy/source/typescript-client-codegen/
├── package.json
├── src
│ ├── Weather.ts
│ ├── WeatherClient.ts
│ ├── commands
│ ├── extensionConfiguration.ts
│ ├── index.ts
│ ├── models
│ ├── pagination
│ ├── runtimeConfig.browser.ts
│ ├── runtimeConfig.native.ts
│ ├── runtimeConfig.shared.ts
│ ├── runtimeConfig.ts
│ └── runtimeExtensions.ts
├── tsconfig.cjs.json
├── tsconfig.es.json
├── tsconfig.json
├── tsconfig.types.json
└── typedoc.json
```

TODO What is missing and how to add it? (what customizations do users need to write themselves? Are there example we can point them to?)

TODO How to package the resulting client in a way that is useful for downstream users?
- Protocols
- Endpoint resolution

##### Publishing a Client SDK package

> Note: There is no prescribed way to publish NPM packages since there are many ways to maintain SDKs. Some publishing tools include using [`npm publish`](https://docs.npmjs.com/cli/v8/commands/npm-publish) or [`yarn publish`](https://classic.yarnpkg.com/lang/en/docs/cli/publish/) directly, or managing a monorepo with tools like [`turbo`](https://turbo.build/repo/docs/handbook/publishing-packages). This section provides tips for how a general publishing workflow could work.
A generated client is a package that is ready to be published. After running `smithy build`, the generated client artifacts will be in the build directory under the projection and plugin name. For example, generated client artifacts for the source projection using the `typescript-client-codegen` plugin in a Smithy CLI project would be in `build/smithy/source/typescript-client-codegen/`. A common practice is to copy the generated client artifacts into a source control repository. After the artifacts are staged, any modifications that are needed prior to publishing the generated client artifacts specific to the SDK should be run, e.g. adding a `README.md`, editing changelog entries. Finally, with a chosen publishing tool for the SDK, publish the artifacts after running the `prepack` script per client package.

#### `typescript-client-codegen` plugin configuration

Expand Down Expand Up @@ -319,7 +349,7 @@ const client = new WeatherClient({
});
```

For more documentation, see [the `typescript-client-plugin` section](#client-sdk-code-generation-typescript-client-codegen-plugin).
For more documentation, see [the `typescript-client-codegen` section](#client-sdk-code-generation-typescript-client-codegen-plugin).

## Local Development

Expand Down

0 comments on commit 32ec37c

Please sign in to comment.