Skip to content

Commit 537b32f

Browse files
authored
Merge pull request #2946 from murgatroid99/proto-loader_root_file_extension
proto-loader: Apply targetFileExtension to root files
2 parents c2b914d + 7905a76 commit 537b32f

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/proto-loader/bin/proto-loader-gen-types.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ type GeneratorOptions = Protobuf.IParseOptions & Protobuf.IConversionOptions & {
4747
outputTemplate: string;
4848
inputBranded: boolean;
4949
outputBranded: boolean;
50-
targetFileExtension?: string;
51-
importFileExtension?: string;
50+
targetFileExtension: string;
51+
importFileExtension: string;
5252
}
5353

5454
class TextFormatter {
@@ -832,7 +832,7 @@ async function writeAllFiles(protoFiles: string[], options: GeneratorOptions) {
832832
await fs.promises.mkdir(options.outDir, {recursive: true});
833833
const basenameMap = new Map<string, string[]>();
834834
for (const filename of protoFiles) {
835-
const basename = path.basename(filename).replace(/\.proto$/, '.ts');
835+
const basename = path.basename(filename).replace(/\.proto$/, options.targetFileExtension);
836836
if (basenameMap.has(basename)) {
837837
basenameMap.get(basename)!.push(filename);
838838
} else {

packages/proto-loader/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@grpc/proto-loader",
3-
"version": "0.7.14",
3+
"version": "0.7.15",
44
"author": "Google Inc.",
55
"contributors": [
66
{

0 commit comments

Comments
 (0)