Created
October 5, 2019 10:13
-
-
Save theorm/2b6e38ffe9614b78fb6ddd24eb17ab4b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { loadSync, Options } from '@grpc/proto-loader' | |
| import { PackageDefinition } from 'grpc' | |
| const ProtoBaseDir = process.env.JETSETTER_SCHEMAS_PATH || `${__dirname}/../../../schemas` | |
| const DefaultLoadOptions = { | |
| keepCase: true, | |
| longs: String, | |
| enums: String, | |
| defaults: false, | |
| oneofs: true, | |
| includeDirs: [ | |
| 'proto/services', | |
| 'proto/messages' | |
| ].map(p => `${ProtoBaseDir}/${p}`) | |
| } as Options | |
| export function readPackageDefinition(path: string): PackageDefinition { | |
| // console.debug('Load options', JSON.stringify(DefaultLoadOptions)) | |
| return loadSync(path, DefaultLoadOptions) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment