From 9076d5d2e76d432aef475ba403e9ab5bd3b9d2b0 Mon Sep 17 00:00:00 2001 From: Tnze <19628575+Tnze@users.noreply.github.com> Date: Wed, 19 Oct 2022 21:24:56 +0800 Subject: [PATCH] feat(cli): add prompt information when file changing detected, closes #5417 (#5428) Co-authored-by: Lucas Nogueira --- .changes/cli-watcher-info.md | 6 ++++++ tooling/cli/src/interface/rust.rs | 11 ++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 .changes/cli-watcher-info.md diff --git a/.changes/cli-watcher-info.md b/.changes/cli-watcher-info.md new file mode 100644 index 000000000..584deaa24 --- /dev/null +++ b/.changes/cli-watcher-info.md @@ -0,0 +1,6 @@ +--- +"cli.rs": patch +"cli.js": patch +--- + +Log dev watcher file change detection. diff --git a/tooling/cli/src/interface/rust.rs b/tooling/cli/src/interface/rust.rs index 8d976e8eb..be1cd910e 100644 --- a/tooling/cli/src/interface/rust.rs +++ b/tooling/cli/src/interface/rust.rs @@ -33,7 +33,7 @@ use tauri_bundler::{ use super::{AppSettings, ExitReason, Interface}; use crate::helpers::{ - app_paths::tauri_dir, + app_paths::{app_dir, tauri_dir}, config::{reload as reload_config, wix_settings, Config}, }; @@ -342,6 +342,7 @@ impl Rust { ) -> crate::Result<()> { let process = Arc::new(Mutex::new(child)); let (tx, rx) = sync_channel(1); + let app_path = app_dir(); let tauri_path = tauri_dir(); let workspace_path = get_workspace_dir()?; @@ -393,10 +394,18 @@ impl Rust { let event_path = event.path; if event_path.file_name() == Some(OsStr::new("tauri.conf.json")) { + info!("Tauri configuration changed. Rewriting manifest..."); let config = reload_config(options.config.as_deref())?; self.app_settings.manifest = rewrite_manifest(config.lock().unwrap().as_ref().unwrap())?; } else { + info!( + "File {} changed. Rebuilding application...", + event_path + .strip_prefix(&app_path) + .unwrap_or(&event_path) + .display() + ); // When tauri.conf.json is changed, rewrite_manifest will be called // which will trigger the watcher again // So the app should only be started when a file other than tauri.conf.json is changed