File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 1+ const { exec } = require ( 'child_process' ) ;
2+
3+ // Configuration Variables
4+ const branchName = '17-6.1.0' ;
5+ const protoUrl = `https://raw.githubusercontent.com/pganalyze/libpg_query/${ branchName } /protobuf/pg_query.proto` ;
6+ const inFile = 'libpg_query/protobuf/pg_query.proto' ;
7+ const outFile = 'proto.js' ;
8+
9+ const protogenCmd = [
10+ 'pg-proto-parser' ,
11+ 'protogen' ,
12+ '--protoUrl' ,
13+ protoUrl ,
14+ '--inFile' ,
15+ inFile ,
16+ '--outFile' ,
17+ outFile ,
18+ '--originalPackageName' ,
19+ 'protobufjs/minimal' ,
20+ '--newPackageName' ,
21+ '@launchql/protobufjs/minimal'
22+ ] ;
23+
24+ // Step 2: Generate proto.js using pbjs (Assuming pbjs is installed and accessible)
25+ function generateProtoJS ( callback ) {
26+ exec ( protogenCmd . join ( ' ' ) , ( error , stdout , stderr ) => {
27+ if ( error ) {
28+ console . error ( `Error during code generation: ${ error . message } ` ) ;
29+ return ;
30+ }
31+ console . log ( 'Generated proto.js from proto file.' ) ;
32+ callback ( ) ;
33+ } ) ;
34+ }
35+
36+ generateProtoJS ( ( ) => {
37+ console . log ( 'all done 🎉' ) ;
38+ } ) ;
You can’t perform that action at this time.
0 commit comments