Skip to content

Commit c8b083a

Browse files
committed
Use root package suffix in clean log messages
1 parent f26d5c9 commit c8b083a

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

rewatch/src/build/clean.rs

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,19 +58,14 @@ pub fn remove_compile_assets(package: &packages::Package, source_file: &Path) {
5858
}
5959
}
6060

61-
pub fn clean_mjs_files(build_state: &BuildState) {
61+
fn clean_source_files(build_state: &BuildState, root_package: &packages::Package) {
6262
// get all rescript file locations
6363
let rescript_file_locations = build_state
6464
.modules
6565
.values()
6666
.filter_map(|module| match &module.source_type {
6767
SourceType::SourceFile(source_file) => {
6868
let package = build_state.packages.get(&module.package_name).unwrap();
69-
let root_package = build_state
70-
.packages
71-
.get(&build_state.root_config_name)
72-
.expect("Could not find root package");
73-
7469
Some(
7570
root_package
7671
.config
@@ -391,10 +386,6 @@ pub fn clean(path: &Path, show_progress: bool, snapshot_output: bool, build_dev_
391386
}
392387

393388
let timing_clean_mjs = Instant::now();
394-
if !snapshot_output && show_progress {
395-
println!("{} {}Cleaning mjs files...", style("[2/2]").bold().dim(), SWEEP);
396-
let _ = std::io::stdout().flush();
397-
}
398389
let mut build_state = BuildState::new(
399390
project_root.to_owned(),
400391
root_config_name,
@@ -403,15 +394,33 @@ pub fn clean(path: &Path, show_progress: bool, snapshot_output: bool, build_dev_
403394
bsc_path,
404395
);
405396
packages::parse_packages(&mut build_state);
406-
clean_mjs_files(&build_state);
397+
let root_package = build_state
398+
.packages
399+
.get(&build_state.root_config_name)
400+
.expect("Could not find root package");
401+
402+
let suffix = root_package.config.suffix.as_deref().unwrap_or(".res.mjs");
403+
404+
if !snapshot_output && show_progress {
405+
println!(
406+
"{} {}Cleaning {} files...",
407+
style("[2/2]").bold().dim(),
408+
SWEEP,
409+
suffix
410+
);
411+
let _ = std::io::stdout().flush();
412+
}
413+
414+
clean_source_files(&build_state, root_package);
407415
let timing_clean_mjs_elapsed = timing_clean_mjs.elapsed();
408416

409417
if !snapshot_output && show_progress {
410418
println!(
411-
"{}{} {}Cleaned mjs files in {:.2}s",
419+
"{}{} {}Cleaned {} files in {:.2}s",
412420
LINE_CLEAR,
413421
style("[2/2]").bold().dim(),
414422
SWEEP,
423+
suffix,
415424
timing_clean_mjs_elapsed.as_secs_f64()
416425
);
417426
let _ = std::io::stdout().flush();

0 commit comments

Comments
 (0)