File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11/**
2- * This file was automatically generated by pg-proto-parser@1.28.0 .
2+ * This file was automatically generated by pg-proto-parser@1.28.1 .
33* DO NOT MODIFY IT BY HAND. Instead, modify the source proto file,
44* and run the pg-proto-parser generate command to regenerate this file.
55*/
Original file line number Diff line number Diff line change 1+ import { existsSync , readFileSync } from "fs" ;
2+ import { dirname , join } from "path" ;
3+
4+ // need to search due to the dist/ folder and src/, etc.
5+ function findPackageJson ( currentDir : string ) : string {
6+ const filePath = join ( currentDir , 'package.json' ) ;
7+
8+ // Check if package.json exists in the current directory
9+ if ( existsSync ( filePath ) ) {
10+ return filePath ;
11+ }
12+
13+ // Get the parent directory
14+ const parentDir = dirname ( currentDir ) ;
15+
16+ // If reached the root directory, package.json is not found
17+ if ( parentDir === currentDir ) {
18+ throw new Error ( 'package.json not found in any parent directory' ) ;
19+ }
20+
21+ // Recursively look in the parent directory
22+ return findPackageJson ( parentDir ) ;
23+ }
24+
25+ export function readAndParsePackageJson ( ) : any {
26+ // Start searching from the current directory
27+ const pkgPath = findPackageJson ( __dirname ) ;
28+
29+ // Read and parse the package.json
30+ const str = readFileSync ( pkgPath , 'utf8' ) ;
31+ const pkg = JSON . parse ( str ) ;
32+ return pkg ;
33+ }
Original file line number Diff line number Diff line change 11import { Enum , Field , ReflectionObject } from '@launchql/protobufjs' ;
2- import pkg from '../../package.json' ;
32import { PgProtoParserOptions } from '../options' ;
43import { writeFileSync } from 'fs' ;
54import { extname , basename } from 'path' ;
5+ import { readAndParsePackageJson } from '../package' ;
6+
7+ const pkg = readAndParsePackageJson ( ) ;
68
79export const getUndefinedKey = ( enumName : string ) => {
810 // Split the name into parts where a lowercase letter is followed by an uppercase letter
Original file line number Diff line number Diff line change 11/**
2- * This file was automatically generated by pg-proto-parser@1.28.0 .
2+ * This file was automatically generated by pg-proto-parser@1.28.1 .
33* DO NOT MODIFY IT BY HAND. Instead, modify the source proto file,
44* and run the pg-proto-parser generate command to regenerate this file.
55*/
Original file line number Diff line number Diff line change 11/**
2- * This file was automatically generated by pg-proto-parser@1.28.0 .
2+ * This file was automatically generated by pg-proto-parser@1.28.1 .
33* DO NOT MODIFY IT BY HAND. Instead, modify the source proto file,
44* and run the pg-proto-parser generate command to regenerate this file.
55*/
Original file line number Diff line number Diff line change 11/**
2- * This file was automatically generated by pg-proto-parser@1.28.0 .
2+ * This file was automatically generated by pg-proto-parser@1.28.1 .
33* DO NOT MODIFY IT BY HAND. Instead, modify the source proto file,
44* and run the pg-proto-parser generate command to regenerate this file.
55*/
Original file line number Diff line number Diff line change 11/**
2- * This file was automatically generated by pg-proto-parser@1.28.0 .
2+ * This file was automatically generated by pg-proto-parser@1.28.1 .
33* DO NOT MODIFY IT BY HAND. Instead, modify the source proto file,
44* and run the pg-proto-parser generate command to regenerate this file.
55*/
Original file line number Diff line number Diff line change 11/**
2- * This file was automatically generated by pg-proto-parser@1.28.0 .
2+ * This file was automatically generated by pg-proto-parser@1.28.1 .
33* DO NOT MODIFY IT BY HAND. Instead, modify the source proto file,
44* and run the pg-proto-parser generate command to regenerate this file.
55*/
Original file line number Diff line number Diff line change 11/**
2- * This file was automatically generated by pg-proto-parser@1.28.0 .
2+ * This file was automatically generated by pg-proto-parser@1.28.1 .
33* DO NOT MODIFY IT BY HAND. Instead, modify the source proto file,
44* and run the pg-proto-parser generate command to regenerate this file.
55*/
Original file line number Diff line number Diff line change 11/**
2- * This file was automatically generated by pg-proto-parser@1.28.0 .
2+ * This file was automatically generated by pg-proto-parser@1.28.1 .
33* DO NOT MODIFY IT BY HAND. Instead, modify the source proto file,
44* and run the pg-proto-parser generate command to regenerate this file.
55*/
You can’t perform that action at this time.
0 commit comments