@@ -13,7 +13,7 @@ use std::{
13
13
pub use config:: { BoundariesConfig , Permissions , Rule } ;
14
14
use git2:: Repository ;
15
15
use globwalk:: Settings ;
16
- use indicatif:: ProgressIterator ;
16
+ use indicatif:: { ProgressBar , ProgressIterator } ;
17
17
use miette:: { Diagnostic , NamedSource , Report , SourceSpan } ;
18
18
use regex:: Regex ;
19
19
use swc_common:: {
@@ -230,14 +230,21 @@ impl BoundariesResult {
230
230
}
231
231
232
232
impl Run {
233
- pub async fn check_boundaries ( & self ) -> Result < BoundariesResult , Error > {
233
+ pub async fn check_boundaries ( & self , show_progress : bool ) -> Result < BoundariesResult , Error > {
234
234
let rules_map = self . get_processed_rules_map ( ) ;
235
235
let packages: Vec < _ > = self . pkg_dep_graph ( ) . packages ( ) . collect ( ) ;
236
236
let repo = Repository :: discover ( self . repo_root ( ) ) . ok ( ) . map ( Mutex :: new) ;
237
237
let mut result = BoundariesResult :: default ( ) ;
238
238
let global_implicit_dependencies = self . get_implicit_dependencies ( & PackageName :: Root ) ;
239
- println ! ( "Checking packages..." ) ;
240
- for ( package_name, package_info) in packages. into_iter ( ) . progress ( ) {
239
+
240
+ let progress = if show_progress {
241
+ println ! ( "Checking packages..." ) ;
242
+ ProgressBar :: new ( packages. len ( ) as u64 )
243
+ } else {
244
+ ProgressBar :: hidden ( )
245
+ } ;
246
+
247
+ for ( package_name, package_info) in packages. into_iter ( ) . progress_with ( progress) {
241
248
if !self . filtered_pkgs ( ) . contains ( package_name)
242
249
|| matches ! ( package_name, PackageName :: Root )
243
250
{
0 commit comments