@@ -32,7 +32,7 @@ use turborepo_repository::package_graph::{PackageGraph, PackageName, PackageNode
32
32
use turborepo_scm:: SCM ;
33
33
use turborepo_telemetry:: events:: generic:: GenericEventBuilder ;
34
34
use turborepo_ui:: {
35
- cprint, cprintln, sender:: UISender , tui, tui:: AppSender , wui:: WebUISender , BOLD_GREY , GREY , UI ,
35
+ cprint, cprintln, sender:: UISender , tui, tui:: TuiSender , wui:: WebUISender , BOLD_GREY , GREY , UI ,
36
36
} ;
37
37
38
38
pub use crate :: run:: error:: Error ;
@@ -73,6 +73,10 @@ pub struct Run {
73
73
should_print_prelude : bool ,
74
74
}
75
75
76
+ type UIResult = Result < Option < ( UISender , JoinHandle < Result < ( ) , turborepo_ui:: Error > > ) > , Error > ;
77
+ type WuiResult = Result < Option < ( WebUISender , JoinHandle < Result < ( ) , turborepo_ui:: Error > > ) > , Error > ;
78
+ type TuiResult = Result < Option < ( TuiSender , JoinHandle < Result < ( ) , turborepo_ui:: Error > > ) > , Error > ;
79
+
76
80
impl Run {
77
81
fn has_persistent_tasks ( & self ) -> bool {
78
82
self . engine . has_persistent_tasks
@@ -183,9 +187,7 @@ impl Run {
183
187
&& tui:: terminal_big_enough ( ) ?)
184
188
}
185
189
186
- pub fn start_ui (
187
- & self ,
188
- ) -> Result < Option < ( UISender , JoinHandle < Result < ( ) , turborepo_ui:: Error > > ) > , Error > {
190
+ pub fn start_ui ( & self ) -> UIResult {
189
191
match self . opts . run_opts . ui_mode {
190
192
UIMode :: Tui => self
191
193
. start_terminal_ui ( )
@@ -196,9 +198,7 @@ impl Run {
196
198
. map ( |res| res. map ( |( sender, handle) | ( UISender :: Wui ( sender) , handle) ) ) ,
197
199
}
198
200
}
199
- pub fn start_web_ui (
200
- & self ,
201
- ) -> Result < Option < ( WebUISender , JoinHandle < Result < ( ) , turborepo_ui:: Error > > ) > , Error > {
201
+ pub fn start_web_ui ( & self ) -> WuiResult {
202
202
let ( tx, rx) = tokio:: sync:: broadcast:: channel ( 100 ) ;
203
203
204
204
let handle = tokio:: spawn ( turborepo_ui:: wui:: start_ws_server ( rx) ) ;
@@ -207,9 +207,7 @@ impl Run {
207
207
}
208
208
209
209
#[ allow( clippy:: type_complexity) ]
210
- pub fn start_terminal_ui (
211
- & self ,
212
- ) -> Result < Option < ( AppSender , JoinHandle < Result < ( ) , turborepo_ui:: Error > > ) > , Error > {
210
+ pub fn start_terminal_ui ( & self ) -> TuiResult {
213
211
// Print prelude here as this needs to happen before the UI is started
214
212
if self . should_print_prelude {
215
213
self . print_run_prelude ( ) ;
@@ -225,7 +223,7 @@ impl Run {
225
223
return Ok ( None ) ;
226
224
}
227
225
228
- let ( sender, receiver) = AppSender :: new ( ) ;
226
+ let ( sender, receiver) = TuiSender :: new ( ) ;
229
227
let handle = tokio:: task:: spawn_blocking ( move || Ok ( tui:: run_app ( task_names, receiver) ?) ) ;
230
228
231
229
Ok ( Some ( ( sender, handle) ) )
0 commit comments