From 84a65b99d38807d363cca45472de8eefd0aee9a5 Mon Sep 17 00:00:00 2001 From: Steve Ayers Date: Fri, 6 Dec 2024 09:25:22 -0500 Subject: [PATCH] Add additional options for generating imports (#1364) * Add additional docs on options Signed-off-by: Steve Ayers * Remove WKT Signed-off-by: Steve Ayers * Format Signed-off-by: Steve Ayers * Update MIGRATING.md Co-authored-by: Timo Stamm Signed-off-by: Steve Ayers * Update MIGRATING.md Co-authored-by: Timo Stamm Signed-off-by: Steve Ayers --------- Signed-off-by: Steve Ayers Co-authored-by: Timo Stamm --- MIGRATING.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/MIGRATING.md b/MIGRATING.md index e5e9a6ec9..2aaad31ec 100644 --- a/MIGRATING.md +++ b/MIGRATING.md @@ -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 @@ -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 @@ -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. @@ -123,6 +126,7 @@ version: v2 plugins: - local: protoc-gen-es out: src/gen + include_imports: true opt: - target=ts + - import_extension=js @@ -137,6 +141,7 @@ version: v2 plugins: - local: protoc-gen-es out: src/gen + include_imports: true opt: - target=ts - - import_extension=none @@ -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