More comprehensive templates option #3127
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We have a tension in the template system between those who want the generate code to give users a clear roadmap to all the things and those who were extremely burned by 2010s Microsoft project templates that gave you 44 files of an entire working N-tier application that you had to spend half a day deleting code out of to get it back to a point where-- uh anyway some of us were cautious about overdoing it.
This PR explores offering a command line flag on
new/add
which is passed through to the template and can be used by the template to add optional fields, comments, links, etc. that may feel like clutter to some but provide helpful pointers to others. The flag is currently called--explain
and is defaulted to false: both of these are up for grabs (in particular, the default means that users need to know that the flag exists to get the extra stuff, which may well be perverse).Another possible approach is, instead of making it a system-level flag, have it as a parameter within each template, where it could be prompted for. This avoids the need for new users to know about the magic flag. But having it at system level opens the door to adding more guidance outside of template execution, e.g. displaying instructions on how to run
spin build
andspin up
. (A future thing could also allow for displaying template-specific guidance e.g. "you'll need Rust 1.99 and the wasm32-wasip7 target, here's how to get them.")The PR currently updates just one template, ye olde http-rust. If we decide we want to do this, and once we are aligned on the approach, it should be easy to update others.
Sample generated manifest from
spin new http-rust explain-test -a --explain
:(Draft for now because if we go forward there will be more to do on other templates.)