MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / init_github_template

Function init_github_template

crates/cli/src/subcommands/init.rs:1461–1477  ·  view source on GitHub ↗
(config: &TemplateConfig, project_path: &Path, is_server_only: bool)

Source from the content-addressed store, hash-verified

1459}
1460
1461fn init_github_template(config: &TemplateConfig, project_path: &Path, is_server_only: bool) -> anyhow::Result<()> {
1462 let repo = config.github_repo.as_ref().unwrap();
1463 clone_github_template(repo, project_path, is_server_only)?;
1464
1465 let package_path = project_path.join("package.json");
1466 if package_path.exists() {
1467 let content = fs::read_to_string(&package_path)?;
1468 let mut package: serde_json::Value = serde_json::from_str(&content)?;
1469 package["name"] = json!(config.project_name.clone());
1470 let updated_content = serde_json::to_string_pretty(&package)?;
1471 fs::write(package_path, updated_content)?;
1472 }
1473
1474 println!("{}", "Note: Custom templates require manual configuration.".yellow());
1475
1476 Ok(())
1477}
1478
1479fn init_empty(config: &TemplateConfig, project_path: &Path) -> anyhow::Result<()> {
1480 match config.server_lang {

Callers 1

init_from_templateFunction · 0.85

Calls 6

clone_github_templateFunction · 0.85
from_strFunction · 0.85
joinMethod · 0.80
OkFunction · 0.50
unwrapMethod · 0.45
as_refMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…