Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

jerry-ts-protoc-gen

improbable-eng175Apache-2.00.0.2TypeScript support: included

Protoc Plugin for TypeScript Declarations and Service Definitions

protobuf, protoc, typescript, ts, grpc, service, proto3, grpc-node

readme

This package is based on @improbable-eng/ts-protoc-gen. Do small modification to change using grpc to @grpc/grpc-js.

Install

npm install jerry-ts-protoc-gen

or

yarn add jerry-ts-protoc-gen

node Usage

You might need to install grpc-tools first.

This plugin can generate .d.ts files for gRPC service definitions as required by grpc-node.

To generate these declaration files from your protobuf files you must configure ts-protoc-gen to emit service definitions by passing the service=grpc-node param to the --ts_out flag, eg:

# Path to this plugin, Note this must be an abolsute path on Windows (see #15)
PROTOC_GEN_TS_PATH="./node_modules/.bin/protoc-gen-ts"

# Path to the grpc_node_plugin
PROTOC_GEN_GRPC_PATH="./node_modules/.bin/grpc_tools_node_protoc_plugin"

# Directory to write generated code to (.js and .d.ts files)
OUT_DIR="./generated"

protoc \
    --plugin="protoc-gen-ts=${PROTOC_GEN_TS_PATH}" \
    --plugin=protoc-gen-grpc=${PROTOC_GEN_GRPC_PATH} \
    --js_out="import_style=commonjs,binary:${OUT_DIR}" \
    --ts_out="service=grpc-node:${OUT_DIR}" \
    --grpc_out="grpc_js:${OUT_DIR}" \
    users.proto base.proto

Other Usage

Other usage are as same as the origin plugin.

changelog

0.12.1-pre

0.12.0

Changes

  • #207 Bazel rules moved to a new repo, see README for migration guide. (@Dig-Doug).

0.11.0

Changes

Fixes

0.10.0

Changes

Fixes

0.9.0

Changes

  • #147 Use @improbable-eng/grpc-web package instead of the soon to be deprecated grpc-web-client package. (@johanbrandhorst)

0.8.0

Fixes

Changes

0.7.7

Fixes

Changes

0.7.6

Fixes

  • Broken integration tests on master

0.7.5

Fixes

  • Fixed NPM publish.

0.7.4

Changes

  • Download protoc when generating protos to ensure a consistent version is being used. @easyCZ in #80
  • Always generate Service Definitions (pb_service.d.js and pb_service.d.ts) even if the proto does not define any services. @lx223 in #83
  • Add custom Bazel rule which uses ts-protoc-gen for generation. @coltonmorris in #84
  • Add debug to ServiceClientOptions. @bianbian-org in #90

0.7.3

Changes

  • None (testing release script...)

0.7.1

Changes

  • Fixing bad npm publish

0.7.0

Changes

Fixes

0.6.0

Changes

  • Generate gRPC Service Stubs for use with grpc-web @jonahbron and @jonny-improbable in #40
  • Fix filename manipulation bug which would cause problems for users who store generated files with .proto in the path. @easyCZ in #56

0.5.2

Changes

  • Fixes invalid 0.5.1 publish (fixed prepublishOnly script)

0.5.1

Changes

  • Fixes invalid 0.5.0 publish (added prepublishOnly script)

0.5.0

Migration Guide

The protoc-gen-js_service command has been removed as the protoc-gen-ts command now generates both JavaScript and TypeScript. Consumers of protoc-gen-js_service should instead use protoc-gen-ts and substitute the --js_service_out=generated protoc flag with --ts_out=service=true:generated.

Changes

0.4.0

Changes

0.3.3

Changes