@@ -10,8 +10,8 @@ use reqwest::Url;
1010use serde:: { Deserialize , Serialize } ;
1111use serde_json:: json;
1212use std:: collections:: HashMap ;
13- use std:: { fmt, fs} ;
1413use std:: path:: { Path , PathBuf } ;
14+ use std:: { fmt, fs} ;
1515use toml_edit:: { value, DocumentMut , Item } ;
1616use xmltree:: { Element , XMLNode } ;
1717
@@ -337,7 +337,10 @@ fn run_pm(pm: PackageManager, args: &[&str], cwd: &Path) -> std::io::Result<std:
337337
338338#[ cfg( not( windows) ) ]
339339fn run_pm ( pm : PackageManager , args : & [ & str ] , cwd : & Path ) -> std:: io:: Result < std:: process:: ExitStatus > {
340- std:: process:: Command :: new ( pm. to_string ( ) ) . args ( args) . current_dir ( cwd) . status ( )
340+ std:: process:: Command :: new ( pm. to_string ( ) )
341+ . args ( args)
342+ . current_dir ( cwd)
343+ . status ( )
341344}
342345
343346#[ derive( Debug , Clone , Copy , PartialEq , Eq , Hash ) ]
@@ -384,7 +387,10 @@ pub fn prompt_for_typescript_package_manager() -> anyhow::Result<Option<PackageM
384387 } )
385388}
386389
387- pub fn install_typescript_dependencies ( package_dir : & Path , package_manager : Option < PackageManager > ) -> anyhow:: Result < ( ) > {
390+ pub fn install_typescript_dependencies (
391+ package_dir : & Path ,
392+ package_manager : Option < PackageManager > ,
393+ ) -> anyhow:: Result < ( ) > {
388394 if let Some ( pm) = package_manager {
389395 println ! ( "Installing dependencies with {}..." , pm) ;
390396
@@ -398,7 +404,10 @@ pub fn install_typescript_dependencies(package_dir: &Path, package_manager: Opti
398404 ) ;
399405 args_map. insert ( "bun" , vec ! [ "install" ] ) ;
400406
401- let args: & [ & str ] = args_map. get ( pm. to_string ( ) . as_str ( ) ) . map ( |v| v. as_slice ( ) ) . unwrap_or ( & [ ] ) ;
407+ let args: & [ & str ] = args_map
408+ . get ( pm. to_string ( ) . as_str ( ) )
409+ . map ( |v| v. as_slice ( ) )
410+ . unwrap_or ( & [ ] ) ;
402411
403412 // Run and stream output cross-platform
404413 let status = run_pm ( pm, args, package_dir) ;
@@ -475,10 +484,12 @@ pub async fn exec_init(config: &mut Config, args: &ArgMatches, is_interactive: b
475484 ensure_empty_directory ( & template_config. project_name , & template_config. project_path ) ?;
476485 init_from_template ( & template_config, & template_config. project_path , is_server_only) . await ?;
477486
478- if template_config. server_lang == Some ( ServerLanguage :: TypeScript ) && template_config. client_lang == Some ( ClientLanguage :: TypeScript ) {
487+ if template_config. server_lang == Some ( ServerLanguage :: TypeScript )
488+ && template_config. client_lang == Some ( ClientLanguage :: TypeScript )
489+ {
479490 // If server & client are TypeScript, handle dependency installation
480491 // NOTE: All server templates must have their server code in `spacetimedb/` directory
481- // This is not a requirement in general, but is a requirement for all templates
492+ // This is not a requirement in general, but is a requirement for all templates
482493 // i.e. `spacetime dev` is valid on non-templates.
483494 let pm = if is_interactive {
484495 prompt_for_typescript_package_manager ( ) ?
@@ -504,7 +515,7 @@ pub async fn exec_init(config: &mut Config, args: &ArgMatches, is_interactive: b
504515 None
505516 } ;
506517 // NOTE: All server templates must have their server code in `spacetimedb/` directory
507- // This is not a requirement in general, but is a requirement for all templates
518+ // This is not a requirement in general, but is a requirement for all templates
508519 // i.e. `spacetime dev` is valid on non-templates.
509520 let server_dir = template_config. project_path . join ( "spacetimedb" ) ;
510521 install_typescript_dependencies ( & server_dir, pm) ?;
0 commit comments