From 80358bbeaa61a31848f7dda04e416a72e893460e Mon Sep 17 00:00:00 2001 From: Stanley Cheung Date: Tue, 29 Oct 2019 16:34:32 -0700 Subject: [PATCH] md linter --- README.md | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 66dba85..5914d1c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ## Overview -gRPC-Web provides a Javascript library that lets browser clients access a gRPC +gRPC-Web provides a JavaScript library that lets browser clients access a gRPC service. You can find out much more about gRPC in its own [website](https://grpc.io). @@ -103,9 +103,11 @@ also supported. typings file will also be generated for the protobuf messages and service stub. `import_style=typescript`: (Experimental) The service stub will be generated -in TypeScript. See **Typescript Support** below for information on how to generate Typescript files. +in TypeScript. See **TypeScript Support** below for information on how to +generate TypeScript files. -**Note: The `commonjs+dts` and `typescript` styles are only supported by `--grpc-web_out=import_style=...`, not by `--js_out=import_style=...`.** +**Note: The `commonjs+dts` and `typescript` styles are only supported by +`--grpc-web_out=import_style=...`, not by `--js_out=import_style=...`.** ### Wire Format Mode @@ -248,16 +250,17 @@ either: - `import_style=commonjs+dts`: existing CommonJS style stub + `.d.ts` typings - `import_style=typescript`: full TypeScript output - -Do *not* use `import_style=typescript` for `--js_out`, it will silently be ignored. -Instead you should use `--js_out=import_style=commonjs`, or `--js_out=import_style=commonjs,binary` -if you are using `mode=grpcweb`. The `--js_out` plugin will generate Javascript code -(`echo_pb.js`), and the `-grpc-web_out` plugin will generate a TypeScript definition file -for it (`echo_pb.d.ts`). This is a temporary hack until the `--js_out` supports TypeScript -itself. -For example, this is the command you should use to generate TypeScript code using the -binary wire format: +Do *not* use `import_style=typescript` for `--js_out`, it will silently be +ignored. Instead you should use `--js_out=import_style=commonjs`, or +`--js_out=import_style=commonjs,binary` if you are using `mode=grpcweb`. The +`--js_out` plugin will generate JavaScript code (`echo_pb.js`), and the +`-grpc-web_out` plugin will generate a TypeScript definition file for it +(`echo_pb.d.ts`). This is a temporary hack until the `--js_out` supports +TypeScript itself. + +For example, this is the command you should use to generate TypeScript code +using the binary wire format ```sh $ protoc -I=$DIR echo.proto \ @@ -267,9 +270,12 @@ $ protoc -I=$DIR echo.proto \ It will generate the following files: -* `echo_gprc_web_pb.ts` - Generated by `--grpc-web_out`, contains the TypeScript gRPC-web code. -* `echo_pb.js` - Generated by `--js_out`, contains the JavaScript Protobuf code. -* `echo_pb.d.ts` - Generated by `--grpc-web_out`, contains TypeScript definitions for `echo_pb.js`. +* `echo_grpc_web_pb.ts` - Generated by `--grpc-web_out`, contains the +TypeScript gRPC-web code. +* `echo_pb.js` - Generated by `--js_out`, contains the JavaScript Protobuf +code. +* `echo_pb.d.ts` - Generated by `--grpc-web_out`, contains TypeScript +definitions for `echo_pb.js`. ```ts import * as grpcWeb from 'grpc-web';