Protoc Plugin for TypeScript Declarations
This repository contains a protoc plugin that generates TypeScript declarations
(.d.ts
files) that match the JavaScript output of protoc --js_out=import_style=commonjs,binary
. This plugin can
also output service definitions as .ts
files in the structure required by grpc-web.
This repository also contains a plugin for generating service definitions as .js
files in the structure required by
grpc-web.
- Install this repository using
npm install ts-protoc-gen
or clone this repository and runnpm install && npm run build
- Invoke
protoc
with:--plugin
- define where the plugin needed forts_out
can be found--js_out
- the standard argument toprotoc
that generates.js
files in the specified directory--ts_out
- the params and directory to output to (service=true
enables outputting.ts
files for services).- This directory must match
js_out
protoc \ --plugin=protoc-gen-ts=./node_modules/.bin/protoc-gen-ts \ --js_out=import_style=commonjs,binary:generated \ --ts_out=service=true:generated \ -I ./proto \ proto/*.proto
- This directory must match
- Install this repository using
npm install ts-protoc-gen
or clone this repository and runnpm install && npm run build
- Invoke
protoc
with:--plugin
- define where the plugin needed forjs_service_out
can be found--js_out
- the standard argument toprotoc
that generates.js
files in the specified directory--js_service_out
- define the directory to output the service definitions to.- This directory must match
js_out
protoc \ --plugin=protoc-gen-js_service=./node_modules/.bin/protoc-gen-js_service \ --js_out=import_style=commonjs,binary:generated \ --js_service_out=generated \ -I ./proto \ proto/*.proto
- This directory must match
- Add tests for extensions