Giter VIP home page Giter VIP logo

Comments (7)

Junkern avatar Junkern commented on May 25, 2024

This is also a thing I would like to have!

from ts-protoc-gen.

jonnyreeves avatar jonnyreeves commented on May 25, 2024

AFAIK there is no way to access flags (configuration) for other protoc-plugins, in other words, ts-protoc-gen can only read flags present in the ts_out parameter.

Your alternative suggestion should be possible however I'm not sure I see the use case; could this not be achieved with a post-build step?

from ts-protoc-gen.

gertcuykens avatar gertcuykens commented on May 25, 2024

https://www.typescriptlang.org/docs/handbook/tsconfig-json.html

Please note that the compiler does not include files that can be possible outputs; e.g. if the input includes index.ts, then index.d.ts and index.js are excluded. In general, having files that differ only in extension next to each other is not recomended.

Sure it can be done post build, but for me that means ts-protoc-gen is the only cmd that need post processing in my generation chain.

from ts-protoc-gen.

jonnyreeves avatar jonnyreeves commented on May 25, 2024

Thanks for clarifying @gertcuykens; just to confirm, you want the ability to specify an alternative location to write the javascript files generated for the grpc-web service stubs? If so, my proposed flag syntax would be:

protoc -I=. grpc.proto \
  --js_out=import_style=commonjs,binary:./pkg \
  --plugin=protoc-gen-ts=/Users/gert/node/bin/protoc-gen-ts \
  --ts_out=service=true,service_out=./pkg:./src

Where the JavaScript files generated for the grpc-web services will be written to ./pkg and the .d.ts files will be written to ./src

Please can you confirm this would fit your intended use case, or suggest alternatives?
Thanks.

from ts-protoc-gen.

gertcuykens avatar gertcuykens commented on May 25, 2024

Yep that would be perfect. Maybe ommit service=true when using service_out=./pkg if possible, because service will always be true when using service out?

protoc -I=. grpc.proto \
  --js_out=import_style=commonjs,binary:./pkg \
  --plugin=protoc-gen-ts=/Users/gert/node/bin/protoc-gen-ts \
  --ts_out=service_out=./pkg:./src

from ts-protoc-gen.

easyCZ avatar easyCZ commented on May 25, 2024

I believe this is now obsolete as services are always generated in the latest version. @gertcuykens could you confirm the latest version of ts-protoc-gen resolves this problem?

from ts-protoc-gen.

gertcuykens avatar gertcuykens commented on May 25, 2024

Nope [email protected] still can't separate typescript files form js files each in there own directory

from ts-protoc-gen.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.