Add buf beta scaffold command to setup buf.yaml in a git repository#4418
Add buf beta scaffold command to setup buf.yaml in a git repository#4418
buf beta scaffold command to setup buf.yaml in a git repository#4418Conversation
|
The latest Buf updates on your PR. Results from workflow Buf CI / buf (pull_request).
|
cmd/buf/buf.go
Outdated
| push.NewCommand("push", builder), | ||
| convert.NewCommand("convert", builder), | ||
| curl.NewCommand("curl", builder), | ||
| scaffold.NewCommand("scaffold", builder), |
There was a problem hiding this comment.
I am thinking should this be in beta first, but I don't think we want this to be buf config scaffold
| if err != nil { | ||
| return err | ||
| } | ||
| return bufcli.PutBufYAMLFileForDirPath(ctx, dirPath, bufYAMLFile) |
There was a problem hiding this comment.
I think before we write the bufYAMLFile to disk permanently, we should validate that this produces a workspace that compiles, which is a little tricky. With the way our APIs are currently structured, I think I would temporarily write the buf.yaml to disk, and then use Controller to attempt to GetImage based on the dirPath (since buf.yaml is written in the same place as dirPath, which would be the "input" in this case), and if it succeds, great, keep it written and return. If it fails, we would not write the the buf.yaml, but maybe we have a verbose option of providing the roots we found or something? Would need to look into the UX of the failing case a little but, but yeah... I think some validation step is useful.
There was a problem hiding this comment.
added the build validation, but yes we might need to see how to present the build error as otherwise this can be confusing
buf scaffold command to setup buf.yaml in a git repositorybuf beta scaffold command to setup buf.yaml in a git repository
fix #3159