@@ -46,7 +46,7 @@ pub async fn run_script(
46
46
workspace_name,
47
47
)
48
48
. await
49
- . map_err ( |e| anyhow:: anyhow!( "Failed to find workspace path: {}" , e ) ) ?;
49
+ . map_err ( |e| anyhow:: anyhow!( "Failed to find workspace path: {e}" ) ) ?;
50
50
log_info ( & format ! (
51
51
"Using workspace: {} at path: {}" ,
52
52
workspace_name,
@@ -67,7 +67,7 @@ pub async fn run_script(
67
67
workspace_name,
68
68
)
69
69
. await
70
- . map_err ( |e| anyhow:: anyhow!( "Failed to find workspace path: {}" , e ) ) ?
70
+ . map_err ( |e| anyhow:: anyhow!( "Failed to find workspace path: {e}" ) ) ?
71
71
} else {
72
72
std:: env:: current_dir ( ) . context ( "Failed to get current directory" ) ?
73
73
} ,
@@ -96,16 +96,14 @@ pub async fn run_script(
96
96
log_command ( pre_script, "" ) ;
97
97
ScriptService :: execute_custom_script ( & package, & pre_script_name, pre_script)
98
98
. await
99
- . map_err ( |e| {
100
- anyhow:: anyhow!( "Failed to execute pre script {}: {}" , pre_script_name, e)
101
- } ) ?;
99
+ . map_err ( |e| anyhow:: anyhow!( "Failed to execute pre script {pre_script_name}: {e}" ) ) ?;
102
100
}
103
101
104
102
// Execute main script
105
103
let script_content = if let Some ( Value :: String ( content) ) = scripts. get ( script_name) {
106
104
content
107
105
} else {
108
- anyhow:: bail!( "Script '{}' not found in package.json" , script_name ) ;
106
+ anyhow:: bail!( "Script '{script_name }' not found in package.json" ) ;
109
107
} ;
110
108
111
109
let script_args = script_args. unwrap_or_default ( ) ;
@@ -117,7 +115,7 @@ pub async fn run_script(
117
115
script_args,
118
116
)
119
117
. await
120
- . map_err ( |e| anyhow:: anyhow!( "Failed to execute script {}: {}" , script_name , e ) ) ?;
118
+ . map_err ( |e| anyhow:: anyhow!( "Failed to execute script {script_name }: {e}" ) ) ?;
121
119
122
120
// Execute post script if exists
123
121
let post_script_name = format ! ( "post{script_name}" ) ;
@@ -126,7 +124,7 @@ pub async fn run_script(
126
124
ScriptService :: execute_custom_script ( & package, & post_script_name, post_script)
127
125
. await
128
126
. map_err ( |e| {
129
- anyhow:: anyhow!( "Failed to execute post script {}: {}" , post_script_name , e )
127
+ anyhow:: anyhow!( "Failed to execute post script {post_script_name }: {e}" )
130
128
} ) ?;
131
129
}
132
130
@@ -263,7 +261,7 @@ pub async fn run_script_in_all_workspaces(
263
261
match result {
264
262
Ok ( task_result) => results. push ( task_result) ,
265
263
Err ( join_error) => {
266
- return Err ( anyhow:: anyhow!( "Task join error: {}" , join_error ) ) ;
264
+ return Err ( anyhow:: anyhow!( "Task join error: {join_error}" ) ) ;
267
265
}
268
266
}
269
267
}
@@ -372,26 +370,6 @@ mod tests {
372
370
assert ! ( topology. is_empty( ) ) ;
373
371
}
374
372
375
- #[ tokio:: test]
376
- async fn test_run_script_in_all_workspaces_no_workspaces ( ) {
377
- let _dir = tempdir ( ) . unwrap ( ) ;
378
- let package_json = r#"
379
- {
380
- "name": "test-project",
381
- "version": "1.0.0",
382
- "scripts": {
383
- "test": "echo test"
384
- }
385
- }"# ;
386
-
387
- fs:: write ( _dir. path ( ) . join ( "package.json" ) , package_json) . unwrap ( ) ;
388
- std:: env:: set_current_dir ( _dir. path ( ) ) . unwrap ( ) ;
389
-
390
- let result = run_script_in_all_workspaces ( "test" , None ) . await ;
391
- // Should succeed but do nothing when no workspaces exist
392
- assert ! ( result. is_ok( ) ) ;
393
- }
394
-
395
373
#[ tokio:: test]
396
374
#[ allow( unused_variables) ]
397
375
async fn test_need_run_with_script ( ) {
0 commit comments