@parkhub/create-proto-files-paths-map

0.2.0 • Public • Published

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');
  });

Readme

Keywords

none

Package Sidebar

Install

npm i @parkhub/create-proto-files-paths-map

Weekly Downloads

2

Version

0.2.0

License

none

Last publish

Collaborators

  • stephemer
  • akunz_ph
  • zoefiri
  • thielt
  • daytonpe
  • realtschoegl
  • loganbfisher
  • accloudcoder
  • novym
  • justin-ben
  • gregwwalters