Skip to content

Commit

Permalink
Always generate files when no services exist
Browse files Browse the repository at this point in the history
Previously, protoc-gen-connect-es would not emit a file when an
input .proto file had no services declared within it. This unfortunately
broke the keep_empty_files option, as there was never an empty file to
keep. Ensure a file is always generated for each input file, allowing
keep_empty_files to determine if it should remain before exiting.

fixes #597
  • Loading branch information
sjbarag committed May 1, 2023
1 parent 7dffad9 commit ceeb0cc
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 9 deletions.
3 changes: 0 additions & 3 deletions packages/protoc-gen-connect-es/src/declaration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ import {

export function generateDts(schema: Schema) {
for (const protoFile of schema.files) {
if (protoFile.services.length == 0) {
continue;
}
const file = schema.generateFile(protoFile.name + "_connect.d.ts");
file.preamble(protoFile);
for (const service of protoFile.services) {
Expand Down
3 changes: 0 additions & 3 deletions packages/protoc-gen-connect-es/src/javascript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ import {

export function generateJs(schema: Schema) {
for (const protoFile of schema.files) {
if (protoFile.services.length == 0) {
continue;
}
const file = schema.generateFile(protoFile.name + "_connect.js");
file.preamble(protoFile);
for (const service of protoFile.services) {
Expand Down
3 changes: 0 additions & 3 deletions packages/protoc-gen-connect-es/src/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ import {

export function generateTs(schema: Schema) {
for (const protoFile of schema.files) {
if (protoFile.services.length == 0) {
continue;
}
const file = schema.generateFile(protoFile.name + "_connect.ts");
file.preamble(protoFile);
for (const service of protoFile.services) {
Expand Down

0 comments on commit ceeb0cc

Please sign in to comment.