github.com/vcilabs/webrpc@v0.5.2-0.20201116131534-162e27b1b33b/gen/javascript/README.md (about)

     1  webrpc Javascript (ES6) generator
     2  =================================
     3  
     4  > NOTE: the javascript generator is almost identical to the typescript one,
     5  > just without the types.. we could have even omitted this generator
     6  > and just relied on `tsc` to compile to es5/es6 JS versions, but
     7  > for ease of use for devs that don't use TS, we offer this generator.
     8  
     9  This generator, from a webrpc schema/design file will code-generate:
    10  
    11  1. Client -- an isomorphic/universal Javascript client to speak to a webrpc server using the
    12  provided schema. This client is compatible with any webrpc server language (ie. Go, nodejs, etc.).
    13  As the client is isomorphic, means you can use this within a Web browser or use the client in a 
    14  server like nodejs -- both without needing any dependencies. I suggest to read the generated TS
    15  output of the generated code, and you shall see, its nothing fancy, just the sort of thing you'd
    16  write by hand.
    17  
    18  2. Server -- a nodejs Javascript server handler. See examples.
    19  
    20  
    21  ## webrpc-gen extras
    22  
    23  The `webrpc-gen` tool accepts an `-extra` cli flag, which is passed down to the generator, and
    24  we use it for some basic toggling during code-generation. For `javascript` generator, we make
    25  es6 code that includes module "exports" by default, but, if you'd like to use the client in a
    26  UMD scenario without having to use babel or something like it, you can pass `-extra=noexports`
    27  option to the cli.. like we do in the [hello-webrpc](../../_examples/hello-webrpc) example. 
    28  
    29  ie..
    30  
    31  ```
    32  webrpc-gen -schema=hello-api.webrpc.json -target=js -extra=noexports -client -out=./webapp/client.gen.js
    33  ```