feat: commit code

This commit is contained in:
YuKun Liu committed 2022-07-06 00:22:40 +08:00
1 parent c54d467730
commit f4ed207649
2 files changed
+6 -6

No files matched your search

+3 -3
View File
@@ -34,7 +34,7 @@ pub struct FileMap {
impl FileMap {
pub fn new(path: PathBuf) -> Self {
log::info!("Searching files for changes since last compile...");
log::info!("🔮 Searching files for changes since last compile...");
fn find_rs_files(root: PathBuf) -> io::Result<HashMap<PathBuf, String>> {
let mut files = HashMap::new();
if root.is_dir() {
@@ -61,7 +61,7 @@ impl FileMap {
last_updated_time,
map: find_rs_files(path).unwrap(),
};
log::info!("Files updated");
// log::info!("Files updated");
result
}
}
@@ -78,7 +78,7 @@ pub async fn hot_reload_handler(
let mut messages = Vec::new();
{
log::info!("Finding updates since last compile...");
log::info!("🔮 Finding updates since last compile...");
let handle = state.last_file_rebuild.lock().unwrap();
let update_time = handle.last_updated_time.clone();
for (k, v) in handle.map.iter() {
+3 -3
View File
@@ -27,7 +27,7 @@ pub struct BuildManager {
impl BuildManager {
fn build(&self) -> Result<()> {
log::info!("Start to rebuild project...");
log::info!("🪁 Rebuild code");
builder::build(&self.config)?;
// change the websocket reload state to true;
// the page will auto-reload.
@@ -118,7 +118,7 @@ pub async fn startup_hot_reload(port: u16, config: CrateConfig) -> Result<()> {
last_file_rebuild.map.insert(path, src);
}
DiffResult::RsxChanged(changed) => {
log::info!("reloading rsx");
log::info!("🪁 reloading rsx");
for (old, new) in changed.into_iter() {
let hr = get_location(
&path.to_path_buf(),
@@ -269,7 +269,7 @@ pub async fn startup_default(port: u16, config: CrateConfig) -> Result<()> {
.unwrap_or_else(|| vec![PathBuf::from("src")]);
let mut watcher = RecommendedWatcher::new(move |_: notify::Result<notify::Event>| {
log::info!("reload required");
// log::info!("🚧 reload required");
if chrono::Local::now().timestamp() > last_update_time {
match build_manager.build() {
Ok(_) => last_update_time = chrono::Local::now().timestamp(),