@parkhub/create-proto-files-paths-map
v0.2.0
Published
Create Proto Files Paths Map ===================
Downloads
6
Maintainers
Keywords
Readme
Create Proto Files Paths Map
Get the full path of protofiles in the nearest protos/
directory in the form of a map keyed by a custom tag of your choosing. Full paths are used by grpc
Install
npm install @parkhub/create-proto-files-paths-map
Use
Sample project directory:
project
└───protos
│ │ proto_file_one.proto
│ │ proto_file_two.proto
└───src
│ index.js
// index.js
import createProtoFilesPathsMap from '@parkhub/create-proto-files-paths-map';
const protoFiles = [{
tag: 'myTag',
fileName: 'proto_file_one'
}, {
tag: 'mySecondTag',
fileName: 'proto_file_two'
}];
createProtoFileMap(protoFiles)
.then(protoFilesMap => {
/*
protoFilesMap is a map with the following properties:
{
myTag: /system/path/project/protos/proto_file_one.proto,
mySecondTag: /system/path/project/protos/proto_file_two.proto,
}
*/
const fileOnePath = protoFilesMap.get('myTag');
const fileTwoPath = protoFilesMap.get('mySecondTag');
});