mirror of https://github.com/grpc/grpc-node.git
Merge pull request #2946 from murgatroid99/proto-loader_root_file_extension
proto-loader: Apply targetFileExtension to root files
This commit is contained in:
commit
537b32f116
|
@ -47,8 +47,8 @@ type GeneratorOptions = Protobuf.IParseOptions & Protobuf.IConversionOptions & {
|
||||||
outputTemplate: string;
|
outputTemplate: string;
|
||||||
inputBranded: boolean;
|
inputBranded: boolean;
|
||||||
outputBranded: boolean;
|
outputBranded: boolean;
|
||||||
targetFileExtension?: string;
|
targetFileExtension: string;
|
||||||
importFileExtension?: string;
|
importFileExtension: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
class TextFormatter {
|
class TextFormatter {
|
||||||
|
@ -832,7 +832,7 @@ async function writeAllFiles(protoFiles: string[], options: GeneratorOptions) {
|
||||||
await fs.promises.mkdir(options.outDir, {recursive: true});
|
await fs.promises.mkdir(options.outDir, {recursive: true});
|
||||||
const basenameMap = new Map<string, string[]>();
|
const basenameMap = new Map<string, string[]>();
|
||||||
for (const filename of protoFiles) {
|
for (const filename of protoFiles) {
|
||||||
const basename = path.basename(filename).replace(/\.proto$/, '.ts');
|
const basename = path.basename(filename).replace(/\.proto$/, options.targetFileExtension);
|
||||||
if (basenameMap.has(basename)) {
|
if (basenameMap.has(basename)) {
|
||||||
basenameMap.get(basename)!.push(filename);
|
basenameMap.get(basename)!.push(filename);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@grpc/proto-loader",
|
"name": "@grpc/proto-loader",
|
||||||
"version": "0.7.14",
|
"version": "0.7.15",
|
||||||
"author": "Google Inc.",
|
"author": "Google Inc.",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue