From af884a991b65b1c1d1df10e03a4279d0d2eda03f Mon Sep 17 00:00:00 2001 From: Tipragot Date: Sat, 3 Feb 2024 14:06:10 +0100 Subject: [PATCH 1/7] add print --- src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib.rs b/src/lib.rs index 0c7e7b0..2c15369 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -30,6 +30,7 @@ fn build_app() { let project_name = project_name .trim_start_matches("name = \"") .trim_end_matches('"'); + println!("Project name: {}", project_name); // Build WASM let mut config = CrateConfig::new(Some(project_folder.to_path_buf())) -- 2.43.4 From 42345dce93ae45451bd9ff5b9ddad8a3bf8ced1a Mon Sep 17 00:00:00 2001 From: Tipragot Date: Sat, 3 Feb 2024 14:09:53 +0100 Subject: [PATCH 2/7] dqsd --- src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib.rs b/src/lib.rs index 2c15369..e3b123e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -20,6 +20,7 @@ fn build_app() { let output_folder = project_folder.join("web"); // Get the project name + println!("Project folder: {}", project_folder.display()); let cargo_file = fs::File::open(project_folder.join("Cargo.toml")).expect("unable to open Cargo.toml"); let project_name = BufReader::new(cargo_file) -- 2.43.4 From c99fed240254155bb1d9ba145fa6a195e4c9d7a1 Mon Sep 17 00:00:00 2001 From: Tipragot Date: Sat, 3 Feb 2024 14:16:11 +0100 Subject: [PATCH 3/7] qsd --- src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib.rs b/src/lib.rs index e3b123e..bb2ce35 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -21,6 +21,7 @@ fn build_app() { // Get the project name println!("Project folder: {}", project_folder.display()); + println!("AAA: ", env!("CARGO_PKG_NAME")); let cargo_file = fs::File::open(project_folder.join("Cargo.toml")).expect("unable to open Cargo.toml"); let project_name = BufReader::new(cargo_file) -- 2.43.4 From 3c40fc3d817c4e038b2862a66fe2bcfc5ca8085d Mon Sep 17 00:00:00 2001 From: Tipragot Date: Sat, 3 Feb 2024 14:16:42 +0100 Subject: [PATCH 4/7] qsdqsd --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index bb2ce35..8aa8922 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -21,7 +21,7 @@ fn build_app() { // Get the project name println!("Project folder: {}", project_folder.display()); - println!("AAA: ", env!("CARGO_PKG_NAME")); + println!("AAA: {}", env!("CARGO_PKG_NAME")); let cargo_file = fs::File::open(project_folder.join("Cargo.toml")).expect("unable to open Cargo.toml"); let project_name = BufReader::new(cargo_file) -- 2.43.4 From 55baadf979fa1fc24a8b7b5ee7a5fd64aed3d57b Mon Sep 17 00:00:00 2001 From: Tipragot Date: Sat, 3 Feb 2024 14:17:26 +0100 Subject: [PATCH 5/7] sqS --- src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 8aa8922..aaebfe1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,16 +7,16 @@ pub use dioxus_fullstack::prelude::*; #[cfg(all(not(target_arch = "wasm32"), debug_assertions))] /// Compile le site en webassembly et génaire le fichier de style avec tailwind. fn build_app() { - use std::fs; use std::io::{BufRead, BufReader}; use std::path::{Path, PathBuf}; + use std::{env, fs}; use dioxus_cli::{CrateConfig, ExecutableType}; use railwind::{CollectionOptions, SourceOptions}; use regex::Regex; use walkdir::WalkDir; - let project_folder = Path::new(env!("CARGO_MANIFEST_DIR")); + let project_folder = env::current_dir().expect("unable to get current directory"); let output_folder = project_folder.join("web"); // Get the project name -- 2.43.4 From 8c3b6b98f2ae98fa7a8dc300c916605fe1bb59e3 Mon Sep 17 00:00:00 2001 From: Tipragot Date: Sat, 3 Feb 2024 14:35:05 +0100 Subject: [PATCH 6/7] dqsddddd --- src/lib.rs | 36 ++++++++++++++++-------------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index aaebfe1..86a4050 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,13 +5,13 @@ pub use dioxus::prelude::*; pub use dioxus_fullstack::prelude::*; #[cfg(all(not(target_arch = "wasm32"), debug_assertions))] -/// Compile le site en webassembly et génaire le fichier de style avec tailwind. +/// Compile le site en webassembly et génère le fichier de style avec tailwind. fn build_app() { use std::io::{BufRead, BufReader}; - use std::path::{Path, PathBuf}; + use std::path::PathBuf; use std::{env, fs}; - use dioxus_cli::{CrateConfig, ExecutableType}; + use dioxus_cli::CrateConfig; use railwind::{CollectionOptions, SourceOptions}; use regex::Regex; use walkdir::WalkDir; @@ -20,28 +20,24 @@ fn build_app() { let output_folder = project_folder.join("web"); // Get the project name - println!("Project folder: {}", project_folder.display()); - println!("AAA: {}", env!("CARGO_PKG_NAME")); - let cargo_file = - fs::File::open(project_folder.join("Cargo.toml")).expect("unable to open Cargo.toml"); - let project_name = BufReader::new(cargo_file) - .lines() - .map_while(Result::ok) - .find(|l| l.starts_with("name = ")) - .expect("unable to find project name"); - let project_name = project_name - .trim_start_matches("name = \"") - .trim_end_matches('"'); - println!("Project name: {}", project_name); + // let cargo_file = + // fs::File::open(project_folder.join("Cargo.toml")).expect("unable to open + // Cargo.toml"); let project_name = BufReader::new(cargo_file) + // .lines() + // .map_while(Result::ok) + // .find(|l| l.starts_with("name = ")) + // .expect("unable to find project name"); + // let project_name = project_name + // .trim_start_matches("name = \"") + // .trim_end_matches('"'); // Build WASM - let mut config = CrateConfig::new(Some(project_folder.to_path_buf())) + let mut config = CrateConfig::new(Some(project_folder.clone())) .expect("unable to load the project configuration"); config.release = true; config.asset_dir = project_folder.join("assets"); config.out_dir = output_folder.clone(); config.dioxus_config.web.resource.style = Some(vec![PathBuf::from("style.css")]); - config.executable = ExecutableType::Binary(project_name.to_string()); dioxus_cli::build(&config, false).expect("unable to build webassembly"); let index_content = dioxus_cli::gen_page(&config.dioxus_config, false); fs::write(output_folder.join("index.html"), index_content).expect("unable to write index.html"); @@ -93,8 +89,8 @@ pub fn launch< { build_app(); let config = ServeConfigBuilder::new(component, Props::default()) - .index_path(concat!(env!("CARGO_MANIFEST_DIR"), "/web/index.html")) - .assets_path(concat!(env!("CARGO_MANIFEST_DIR"), "/web")); + .index_path("web/index.html") + .assets_path("web"); LaunchBuilder::new(|cx| render!("Hello World")) .server_cfg(config) .launch(); -- 2.43.4 From 591306c47c47ad81dd2cf21804e412c42a4170cc Mon Sep 17 00:00:00 2001 From: Tipragot Date: Sat, 3 Feb 2024 14:42:02 +0100 Subject: [PATCH 7/7] Best --- src/lib.rs | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 86a4050..0f1d641 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -7,7 +7,6 @@ pub use dioxus_fullstack::prelude::*; #[cfg(all(not(target_arch = "wasm32"), debug_assertions))] /// Compile le site en webassembly et génère le fichier de style avec tailwind. fn build_app() { - use std::io::{BufRead, BufReader}; use std::path::PathBuf; use std::{env, fs}; @@ -19,18 +18,6 @@ fn build_app() { let project_folder = env::current_dir().expect("unable to get current directory"); let output_folder = project_folder.join("web"); - // Get the project name - // let cargo_file = - // fs::File::open(project_folder.join("Cargo.toml")).expect("unable to open - // Cargo.toml"); let project_name = BufReader::new(cargo_file) - // .lines() - // .map_while(Result::ok) - // .find(|l| l.starts_with("name = ")) - // .expect("unable to find project name"); - // let project_name = project_name - // .trim_start_matches("name = \"") - // .trim_end_matches('"'); - // Build WASM let mut config = CrateConfig::new(Some(project_folder.clone())) .expect("unable to load the project configuration"); -- 2.43.4