spinframework / spinframework/spin
Naming convention for spin internal template parameters
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 6.5k
- Forks
- 310
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 24
Description
Spin provides a number of special internal parameters that can be used in templates:
async fn special_values(&self) -> HashMap<String, String> {
let mut values = HashMap::new();
let authors = crate::environment::get_authors().await.unwrap_or_default();
values.insert("authors".into(), authors.author);
values.insert("username".into(), authors.username);
values.insert("project-name".into(), self.options.name.clone());
values.insert(
"output-path".into(),
self.relative_target_dir().to_string_lossy().to_string(),
);
values
}
There are two possible improvements that could be made to the parameter naming conventions:
- A
spin-*prefix could be employed to make it clear to template authors that these parameters are provided by the spin framework e.g.spin-authors. project-namecould be improved by being made more general e.g.template-instance-nameoritem-name.project-namedoesn't make sense whenspin addis being run b/c you're actually creating a template not an application/project.
Please discuss whether these changes would be useful/worth the effort.
Note: See #1096 for the discussion that spurred this issue.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the special_values function shown in the issue and review the discussion in #1096. Determine whether a spin-* prefix and a more general replacement for project-name are warranted, then document the agreed naming convention and identify the affected template parameters.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100