feat: commit code
This commit is contained in:
1 parent
c54d467730
commit
f4ed207649
2 files changed
+6
-6
No files matched your search
@@ -34,7 +34,7 @@ pub struct FileMap {
|
|||||||
|
|
||||||
impl FileMap {
|
impl FileMap {
|
||||||
pub fn new(path: PathBuf) -> Self {
|
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>> {
|
fn find_rs_files(root: PathBuf) -> io::Result<HashMap<PathBuf, String>> {
|
||||||
let mut files = HashMap::new();
|
let mut files = HashMap::new();
|
||||||
if root.is_dir() {
|
if root.is_dir() {
|
||||||
@@ -61,7 +61,7 @@ impl FileMap {
|
|||||||
last_updated_time,
|
last_updated_time,
|
||||||
map: find_rs_files(path).unwrap(),
|
map: find_rs_files(path).unwrap(),
|
||||||
};
|
};
|
||||||
log::info!("Files updated");
|
// log::info!("Files updated");
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -78,7 +78,7 @@ pub async fn hot_reload_handler(
|
|||||||
let mut messages = Vec::new();
|
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 handle = state.last_file_rebuild.lock().unwrap();
|
||||||
let update_time = handle.last_updated_time.clone();
|
let update_time = handle.last_updated_time.clone();
|
||||||
for (k, v) in handle.map.iter() {
|
for (k, v) in handle.map.iter() {
|
||||||
|
|||||||
+3
-3
@@ -27,7 +27,7 @@ pub struct BuildManager {
|
|||||||
|
|
||||||
impl BuildManager {
|
impl BuildManager {
|
||||||
fn build(&self) -> Result<()> {
|
fn build(&self) -> Result<()> {
|
||||||
log::info!("Start to rebuild project...");
|
log::info!("🪁 Rebuild code");
|
||||||
builder::build(&self.config)?;
|
builder::build(&self.config)?;
|
||||||
// change the websocket reload state to true;
|
// change the websocket reload state to true;
|
||||||
// the page will auto-reload.
|
// 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);
|
last_file_rebuild.map.insert(path, src);
|
||||||
}
|
}
|
||||||
DiffResult::RsxChanged(changed) => {
|
DiffResult::RsxChanged(changed) => {
|
||||||
log::info!("reloading rsx");
|
log::info!("🪁 reloading rsx");
|
||||||
for (old, new) in changed.into_iter() {
|
for (old, new) in changed.into_iter() {
|
||||||
let hr = get_location(
|
let hr = get_location(
|
||||||
&path.to_path_buf(),
|
&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")]);
|
.unwrap_or_else(|| vec![PathBuf::from("src")]);
|
||||||
|
|
||||||
let mut watcher = RecommendedWatcher::new(move |_: notify::Result<notify::Event>| {
|
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 {
|
if chrono::Local::now().timestamp() > last_update_time {
|
||||||
match build_manager.build() {
|
match build_manager.build() {
|
||||||
Ok(_) => last_update_time = chrono::Local::now().timestamp(),
|
Ok(_) => last_update_time = chrono::Local::now().timestamp(),
|
||||||
|
|||||||
Reference in new issue
Block a user