From 8d41f1c493aa93f4862c88e1776f46833358c714 Mon Sep 17 00:00:00 2001 From: Alexey Ten Date: Mon, 10 Jan 2022 23:16:52 +0300 Subject: [PATCH] fix: respect generateClientImpl=false in grpc-js (#471) Do not generate client stub and constructor when `outputServices=grpc-js` and `outputClientImpl=false` --- src/generate-grpc-js.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/generate-grpc-js.ts b/src/generate-grpc-js.ts index c2d9f2be6..fefc49e53 100644 --- a/src/generate-grpc-js.ts +++ b/src/generate-grpc-js.ts @@ -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' }); }