Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional options for generating imports #1364

Merged
merged 5 commits into from
Dec 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions MIGRATING.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ version: v2
plugins:
- local: protoc-gen-es
out: src/gen
include_imports: true
opt: target=ts
- - local: protoc-gen-connect-es
- out: src/gen
Expand All @@ -88,6 +89,7 @@ plugins:
- - remote: buf.build/bufbuild/es:v1.10.0
+ - remote: buf.build/bufbuild/es:v2.2.0
out: src/gen
include_imports: true
opt: target=ts
- - remote: buf.build/connectrpc/es
- out: src/gen
Expand All @@ -108,6 +110,7 @@ version: v2
plugins:
- local: protoc-gen-es
out: src/gen
include_imports: true
```

With this option, `buf generate` will delete the contents of `src/gen` before generating code.
Expand All @@ -123,6 +126,7 @@ version: v2
plugins:
- local: protoc-gen-es
out: src/gen
include_imports: true
opt:
- target=ts
+ - import_extension=js
Expand All @@ -137,6 +141,7 @@ version: v2
plugins:
- local: protoc-gen-es
out: src/gen
include_imports: true
opt:
- target=ts
- - import_extension=none
Expand All @@ -151,6 +156,14 @@ Now that dependencies and `buf.gen.yaml` are updated, the next step is to re-gen
migration tool does not handle code generation, so be sure to do so in whatever
way your project is configured. For example, `npx buf generate` or `npm run generate`.

> [!NOTE]
> Ensure that your `buf.gen.yaml` includes the following options to generate
> code for imports.
>
> - `include_imports: true`

See the [Gotchas](#the-new-plugins-generates-missing-imports) section for an explanation.

## Update your application code

Now that dependencies are updated and new code is generated, let's go through the
Expand Down
Loading