-
Notifications
You must be signed in to change notification settings - Fork 349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Only generate files in fileToGenerate #283
Conversation
integration/codegen.ts
Outdated
@@ -31,7 +31,7 @@ async function generate(binFile: string, baseDir: string, parameter: string) { | |||
const options = optionsFromParameter(parameter || ''); | |||
const typeMap = createTypeMap(request, options); | |||
|
|||
for (let file of request.protoFile) { | |||
for (let file of request.fileToGenerate) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This causes compile errors due to the generateFile
call on line 38 still wanting the FileDescriptorProto
but fileToGenerate
is just a string[]
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will take a look!
eae93e4
to
4909095
Compare
@stephenh How about that? |
src/plugin.ts
Outdated
if (descriptor === undefined) { | ||
throw new Error(`Cannot find descriptor for file-to-generate: ${fileName}`); | ||
} | ||
const [path, code] = generateFile(ctx, descriptor); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, this looks good. Just to make sure src/plugin.ts
and integration/codegen.ts
stay in sync (I've had bugs come up from them drifting before), how about:
- Add a new
function protoFilesToGenerate(request): FileDescriptorProto[]
insrc/plugin.ts
that returnsrequest.protoFile.filter(f => request.filesToGenerate.includes(f.name));
- Make line 23 in
src/plugin.ts
beprotoFilesToGenerate(request).map(async file =>
- Make line 34 in
codegen.ts
befor (let file of protoFilesToGenerate(request)) {
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds reasonable, will make the change.
4909095
to
7acf283
Compare
🎉 This PR is included in version 1.79.8 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Fixes stephenh#294. This commit puts changes from stephenh#283 behind the flag.
According to doc comments in
plugin.proto
from Google: