You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey, was wondering what's the best/recommended way to combine a directory with nested folders and files into a single ts file. Currently I do something like the following with protobufjs for bundling:
Would there be an equivalent command for this with this lib? Something along the lines of protoc --plugin=./node_modules/.bin/protoc-gen-ts_proto --ts_proto_opt=esModuleInterop=true,forceLong=string --ts_proto_out=source proto/nested/**/*.proto maybe.
Running pbjs -t static-module -w commonjs -o source/proto/tendermint.js proto/vendor/**/*.proto && pbts -o source/proto/tendermint.d.ts source/proto/tendermint.js will result in the files source/proto/tendermint.d.ts and source/proto/tendermint.js being created. The source/proto/tendermint.js file contains all of the proto files combined instead of having a separate js file for each proto file and source/proto/tendermint.d.ts contains all of the TypeScript types.
This works fine but means I have 2 different APIs to work with for proto files which introduces some inconsistencies, unnecessary overhead in tooling and the way code is written so I was wondering if there's some way to achieve the same with this package.
The text was updated successfully, but these errors were encountered:
Hey @faustbrian , yeah, sorry for the super late follow up. I believe this is a duplicate of #212 and has been a long standing ask. Fwiw I don't think a PR to do this would be that hard, we just haven't had anyone tackle it.
Maybe the one wrinkle is dealing with namespace clashes, i.e. if block.proto and events.proto both have a type Foo, then who wins / how does that get represented in the output file?
This could probably be solved with a pretty simple prefixing convention, but again just haven't had anyone give it a try.
Would be amazing if you wanted to submit a PR for it. Thanks!
Hey, was wondering what's the best/recommended way to combine a directory with nested folders and files into a single
ts
file. Currently I do something like the following withprotobufjs
for bundling:Would there be an equivalent command for this with this lib? Something along the lines of
protoc --plugin=./node_modules/.bin/protoc-gen-ts_proto --ts_proto_opt=esModuleInterop=true,forceLong=string --ts_proto_out=source proto/nested/**/*.proto
maybe.Example
I have a directory structure like the following:
Running
pbjs -t static-module -w commonjs -o source/proto/tendermint.js proto/vendor/**/*.proto && pbts -o source/proto/tendermint.d.ts source/proto/tendermint.js
will result in the filessource/proto/tendermint.d.ts
andsource/proto/tendermint.js
being created. Thesource/proto/tendermint.js
file contains all of theproto
files combined instead of having a separatejs
file for eachproto
file andsource/proto/tendermint.d.ts
contains all of the TypeScript types.This works fine but means I have 2 different APIs to work with for
proto
files which introduces some inconsistencies, unnecessary overhead in tooling and the way code is written so I was wondering if there's some way to achieve the same with this package.The text was updated successfully, but these errors were encountered: