protogenjs
Utility for generating interfaces from *.proto schemes.
Eliminates hardcode paths to files and folders.
Recursively reads the paths to the schemes in the specified directory and generates the correct *.js and *.d.ts files.
A configuration file is required for operation (specified by the argument --config).
Sample configuration file:
Description of parameters:
- srcPaths - an array of paths where you need to look for *.proto schemes (supports glob syntax).
- distDir - the directory in which you want to put the final *.js and *.d.ts files.
- commonFiles - an array of paths to *.proto general purpose schemes that need to be included in all other *.proto schemes (supports glob syntax).
- isolateModule - if it is set to true, then a directory with the name of the module will be created in the distDir directory.
Using
After installation, the utility will be available in 2 versions - in npm scripts and through the console indicating the full path.
Using the npm script:
// package.json"scripts":
user@ubuntu$ npm run generateuser@ubuntu$ yarn run generate
Or directly from the terminal:
user@ubuntu$ $(npm bin)/protogenjs --helpUsage examples: protogenjs -h[--help] Print this message protogenjs -p[--progress] Show progress protogenjs -c[--config] protobuf.json Run with config fileConfig file example:user@ubuntu$ $(npm bin)/protogenjs --config protobuf.json