Skip to content

Commit

Permalink
fix: respect generateClientImpl=false in grpc-js (#471) (#472)
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 authored Jan 10, 2022
1 parent 0e4bab8 commit 2f389f2
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 2f389f2

Please sign in to comment.