Skip to content

Commit

Permalink
fix: respect generateClientImpl=false in grpc-js (stephenh#471)
Browse files Browse the repository at this point in the history
Do not generate client stub and constructor when `outputServices=grpc-js` and `outputClientImpl=false`
  • Loading branch information
alexeyten committed Jan 10, 2022
1 parent 0e4bab8 commit 8d41f1c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/generate-grpc-js.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,15 @@ export function generateGrpcJsService(
sourceInfo: SourceInfo,
serviceDesc: ServiceDescriptorProto
): Code {
const { options } = ctx;
const chunks: Code[] = [];

chunks.push(generateServiceDefinition(ctx, fileDesc, sourceInfo, serviceDesc));
chunks.push(generateServerStub(ctx, sourceInfo, serviceDesc));
chunks.push(generateClientStub(ctx, sourceInfo, serviceDesc));
chunks.push(generateClientConstructor(fileDesc, serviceDesc));
if (options.outputClientImpl) {
chunks.push(generateClientStub(ctx, sourceInfo, serviceDesc));
chunks.push(generateClientConstructor(fileDesc, serviceDesc));
}

return joinCode(chunks, { on: '\n\n' });
}
Expand Down

0 comments on commit 8d41f1c

Please sign in to comment.