ts-proto icon indicating copy to clipboard operation
ts-proto copied to clipboard

Add option to allow for a generated code comment

Open adayNU opened this issue 2 years ago • 3 comments

We'd like for GH / Reviewable to understand these files are generated. Would you be open to adding a flag like: --ts_proto_opt=header=true

Which would prepend something like // Code generated by protoc-gen-ts. DO NOT EDIT. to the first line of every file.

If this seems reasonable, I'd be happy to implement.

adayNU avatar Mar 09 '22 22:03 adayNU

@adayNU yep, that sounds like a good idea; a PR would be great!

stephenh avatar Mar 10 '22 04:03 stephenh

It could even be there by default. It's a comment so it will be stripped in most cases by webpack anyway.

boukeversteegh avatar May 02 '22 16:05 boukeversteegh

Yep, good point / +1 to a hard-coded value. We could someday have like a prefixFile=./my-custom-prefix.txt opt to override it, but I assume for now we could drop basically any known string into prefixDisableLinter and be good enough.

stephenh avatar May 02 '22 16:05 stephenh

I think this might be a nice feature to add. We could include additional information, like how the protoc-gen-go plugin does

// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// 	protoc-gen-go v1.29.0
// 	protoc        v4.22.2
// source: foo.proto

dasco144 avatar Apr 30 '24 16:04 dasco144

Better late than never :-) thank you @dasco144 ! :tada:

stephenh avatar May 01 '24 04:05 stephenh