Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
* upstream/master:
  Transport member of ServiceClientOptions should be optional (improbable-eng#125)
  Allow canceling unary calls (improbable-eng#124)
  CI should check that generated code has been committed (improbable-eng#127)
  Bumped to v0.7.8-pre (improbable-eng#123)
  Prepare 0.7.7 release (improbable-eng#112)
  Clean up Bazel Installation during Travis Build (improbable-eng#122)
  Don't deploy .deb files to npm (improbable-eng#121)
  Fix snake_cased oneof message are generated to incorrect types (improbable-eng#118)
  Make ServiceError optionally null (improbable-eng#116)
  Be explicit about the need for a CommonJS environment. (improbable-eng#108)
  Replace usage of `Object.assign` (improbable-eng#110)
  Add hint for Windows users (improbable-eng#107)
  Collapse Bazel Instructions in README (improbable-eng#106)
  Implement Client Streaming and BiDi Streaming for grpc-web (improbable-eng#82)
  Add support for jstype annotation (improbable-eng#104)
  • Loading branch information
colton committed Oct 17, 2018
2 parents 175f5f3 + 51f57ea commit 82405eb
Show file tree
Hide file tree
Showing 33 changed files with 1,438 additions and 120 deletions.
2 changes: 1 addition & 1 deletion .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ src/
.*
release.sh
generate.sh
examples/
examples/
7 changes: 5 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,11 @@ cache:
directories:
- node_modules
before_install:
- wget https://github.com/bazelbuild/bazel/releases/download/0.11.0/bazel_0.11.0-linux-x86_64.deb
- sudo dpkg -i bazel_0.11.0-linux-x86_64.deb
- BAZEL_VERSION=0.11.0
- BAZEL_DEB="bazel_${BAZEL_VERSION}-linux-x86_64.deb"
- wget https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/${BAZEL_DEB} -O "${BAZEL_DEB}"
- sudo dpkg -i ${BAZEL_DEB}
- rm ${BAZEL_DEB}
install:
- npm install
script:
Expand Down
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
## 0.7.7-pre
## 0.7.8-pre

## 0.7.7

### Fixes
* Replace usage of `Object.assign` to fix webpack issue. [@jonny-improbable](https://github.com/jonny-improbable) in [#110](https://github.com/improbable-eng/ts-protoc-gen/pull/110)
* Errors returned by Unary Services should be optionally null. [@colinking](https://github.com/collinking) in [#116](https://github.com/improbable-eng/ts-protoc-gen/pull/116)
* Fix snake_cased oneof message are generated to incorrect types. [@riku179](https://github.com/riku179) in [#118](https://github.com/improbable-eng/ts-protoc-gen/pull/118)
* `.deb` artificats being deployment to npm. [@jonnyreeves](https://github.com/jonnyreeves) in [#121](https://github.com/improbable-eng/ts-protoc-gen/pull/121)

### Changes
* Add support for `jstype` proto annotations. [@jonny-improbable](https://github.com/jonny-improbable) in [#104](https://github.com/improbable-eng/ts-protoc-gen/pull/104)
* Implement Client Streaming and BiDi Streaming for grpc-web service stubs. [@jonnyreeves](https://github.com/jonnyreeves) in [#82](https://github.com/improbable-eng/ts-protoc-gen/pull/82)

## 0.7.6

Expand Down
9 changes: 8 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,11 @@ The following is a set of guidelines for contributing to `ts-protoc-gen`.
Please review and follow our [Code of Conduct](https://github.com/improbable-eng/ts-protoc-gen/blob/master/README.md).

## Releasing
Your changes will be released with the next version release.
Your changes will be released with the next version release.

## Debugging
You can attach the Chrome Inspector when running the tests by setting the `MOCHA_DEBUG` environment variable before running the tests, ie:

```
MOCHA_DEBUG=true npm test
```
25 changes: 21 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@ For our latest build straight from master:
```bash
npm install ts-protoc-gen@next
```

### bazel
<details><summary>Instructions for using ts-protoc-gen within a <a href="https://bazel.build/>bazel">bazel</a> build environment</summary><p>

Include the following in your `WORKSPACE`:

```python
git_repository(
name = "io_bazel_rules_go",
Expand Down Expand Up @@ -70,7 +74,8 @@ load("@build_bazel_rules_typescript//:defs.bzl", "ts_setup_workspace")
ts_setup_workspace()
```

Now in your `BUILD.bazel`:
Now in your `BUILD.bazel`:

```python
load("@ts_protoc_gen//:defs.bzl", "typescript_proto_library")

Expand All @@ -90,7 +95,9 @@ typescript_proto_library(
name = "generate",
proto = ":proto",
)
```
```

</p></details>

## Contributing
Contributions are welcome! Please refer to [CONTRIBUTING.md](https://github.com/improbable-eng/ts-protoc-gen/blob/master/CONTRIBUTING.md) for more information.
Expand Down Expand Up @@ -136,7 +143,7 @@ msg.setName("John Doe");
To generate client-side service stubs from your protobuf files you must configure ts-protoc-gen to emit service definitions by passing the `service=true` param to the `--ts_out` flag, eg:

```
# Path to this plugin
# 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"
# Directory to write generated code to (.js and .d.ts files)
Expand All @@ -149,8 +156,9 @@ protoc \
users.proto base.proto
```

The `generated` folder will now contain both `pb_service.js` and `pb_service.d.ts` files which you can reference in your TypeScript project to make RPCs.
The `generated` folder will now contain both `pb_service.js` and `pb_service.d.ts` files which you can reference in your TypeScript project to make RPCs.

**Note** Note that these modules require a CommonJS environment. If you intend to consume these stubs in a browser environment you will need to use a module bundler such as [webpack](https://webpack.js.org/).
**Note** Both `js` and `d.ts` service files will be generated regardless of whether there are service definitions in the proto files.

```js
Expand All @@ -166,3 +174,12 @@ client.getUser(req, (err, user) => { /* ... */ });
For a sample of the generated protos and service definitions, see [examples](https://github.com/improbable-eng/ts-protoc-gen/tree/master/examples).

To generate the examples from protos, please run `./generate.sh`

## Gotchas
By default the google-protobuf library will use the JavaScript number type to store 64bit float and integer values; this can lead to overflow problems as you exceed JavaScript's `Number.MAX_VALUE`. To work around this, you should consider using the `jstype` annotation on any 64bit fields, ie:

```proto
message Example {
uint64 bigInt = 1 [jstype = JS_STRING];
}
```
41 changes: 41 additions & 0 deletions examples/generated/proto/examplecom/annotations_pb.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 82405eb

Please sign in to comment.