|
| 1 | +use serde::{Deserialize, Serialize}; |
| 2 | + |
| 3 | +/// Schema used in `examples/templates.toml` and services that parses it |
| 4 | +#[derive(Debug, Default, Serialize, Deserialize)] |
| 5 | +pub struct TemplateDefinition { |
| 6 | + /// Title of the template |
| 7 | + title: String, |
| 8 | + /// A short description of the template |
| 9 | + description: Option<String>, |
| 10 | + /// Path relative to the repo root |
| 11 | + path: Option<String>, |
| 12 | + /// "starter" OR "template" (default) OR "tutorial" |
| 13 | + #[serde(default)] |
| 14 | + r#type: TemplateType, |
| 15 | + /// List of areas where this template is useful. Examples: "Web app", "Discord bot", "Monitoring", "Automation", "Utility" |
| 16 | + use_cases: Vec<String>, |
| 17 | + /// List of keywords that describe the template. Examples: "axum", "serenity", "typescript", "saas", "fullstack", "database" |
| 18 | + tags: Vec<String>, |
| 19 | + /// URL to a live instance of the template (if relevant) |
| 20 | + live_demo: Option<String>, |
| 21 | + |
| 22 | + /// If this template is available in the `cargo shuttle init --template` short-hand options, add that name here |
| 23 | + template: Option<String>, |
| 24 | + |
| 25 | + /// Set this to true if this is a community template outside of the shuttle-examples repo |
| 26 | + community: Option<bool>, |
| 27 | + /// GitHub username of the author of the community template |
| 28 | + author: Option<String>, |
| 29 | + /// URL to the repo of the community template |
| 30 | + repo: Option<String>, |
| 31 | +} |
| 32 | + |
| 33 | +#[derive(Debug, Default, Serialize, Deserialize)] |
| 34 | +#[serde(rename_all = "lowercase")] |
| 35 | +pub enum TemplateType { |
| 36 | + Starter, |
| 37 | + #[default] |
| 38 | + Template, |
| 39 | + Tutorial, |
| 40 | +} |
0 commit comments