Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

different/extra content in npm-provided package #89

Closed
p-jahn opened this issue Feb 21, 2021 · 1 comment
Closed

different/extra content in npm-provided package #89

p-jahn opened this issue Feb 21, 2021 · 1 comment

Comments

@p-jahn
Copy link

p-jahn commented Feb 21, 2021

It looks like some not-yet-production-ready files from your feat-remove-template-lib branch somehow made it into the published npm package (noticed in 5.1.2).

This breaks ts generation with the error protoc-gen-ts error: TypeError: Cannot read property 'recognized' of undefined because build/lib/template/partial/msg/MessageRender.js contains .replace("#FIELDS#", this.renderFields); which probably should be something like .replace("#FIELDS#", this.renderFields());

I tried with your examples to see if I maybe got something backwards, but saw the same error.
Diffing the master source https://github.com/agreatfool/grpc_tools_node_protoc_ts/tree/v5.1.2 vs. the node module (for example):

git diff --no-index ../build/index.js ./node_modules/grpc_tools_node_protoc_ts/build/index.js

--- a/../build/index.js
+++ b/./node_modules/grpc_tools_node_protoc_ts/build/index.js
@@ -12,6 +12,7 @@ const plugin_pb_1 = require("google-protobuf/google/protobuf/compiler/plugin_pb"
 const ProtoMsgTsdFormatter_1 = require("./lib/format/ProtoMsgTsdFormatter");
 const ProtoSvcTsdFormatter_1 = require("./lib/format/ProtoSvcTsdFormatter");
 const TplEngine_1 = require("./lib/TplEngine");
+const MsgRender_1 = require("./lib/template/MsgRender");
 Utility_1.Utility.withAllStdIn((inputBuff) => {
     try {
         const typedInputBuff = new Uint8Array(inputBuff.length);
@@ -31,6 +32,11 @@ Utility_1.Utility.withAllStdIn((inputBuff) => {
             const msgTsdFile = new plugin_pb_1.CodeGeneratorResponse.File();
             msgTsdFile.setName(msgFileName + ".d.ts");
             const msgModel = ProtoMsgTsdFormatter_1.ProtoMsgTsdFormatter.format(fileNameToDescriptor[fileName], exportMap);
+            // FIXME
+            const fs = require("fs");
+            const { inspect } = require("util");
+            fs.writeFileSync("/tmp/console.txt", inspect(msgModel, { showHidden: true, depth: null }));
+            fs.writeFileSync("/tmp/msg.d.ts", new MsgRender_1.MsgRender(msgModel).render());
             msgTsdFile.setContent(TplEngine_1.TplEngine.render("msg_tsd", msgModel));
             codeGenResponse.addFile(msgTsdFile);
             // service part
@agreatfool
Copy link
Owner

Thanks for the reporting, fixed with 5.1.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants