mirror of
https://github.com/tuono-labs/tuono
synced 2026-07-29 22:02:46 -07:00
Update static build html structures (#20)
* fix: improve static build output structure * feat: update version to v0.8.3
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "tuono"
|
name = "tuono"
|
||||||
version = "0.8.2"
|
version = "0.8.3"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["V. Ageno <valerioageno@yahoo.it>"]
|
authors = ["V. Ageno <valerioageno@yahoo.it>"]
|
||||||
description = "The react/rust fullstack framework"
|
description = "The react/rust fullstack framework"
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ impl App {
|
|||||||
.unwrap()
|
.unwrap()
|
||||||
.replace(&format!("{base_path_str}/src/routes"), "")
|
.replace(&format!("{base_path_str}/src/routes"), "")
|
||||||
.replace(".rs", "")
|
.replace(".rs", "")
|
||||||
|
.replace(".mdx", "")
|
||||||
.replace(".tsx", "");
|
.replace(".tsx", "");
|
||||||
|
|
||||||
if entry.extension().unwrap() == "rs" {
|
if entry.extension().unwrap() == "rs" {
|
||||||
|
|||||||
@@ -104,9 +104,9 @@ pub fn app() -> std::io::Result<()> {
|
|||||||
sleep(Duration::from_secs(1))
|
sleep(Duration::from_secs(1))
|
||||||
}
|
}
|
||||||
|
|
||||||
app.route_map
|
for (_, route) in app.route_map {
|
||||||
.iter()
|
route.save_ssg_html(&reqwest)
|
||||||
.for_each(|(_, route)| route.save_ssg_html(&reqwest));
|
}
|
||||||
|
|
||||||
// Close server
|
// Close server
|
||||||
let _ = rust_server.kill();
|
let _ = rust_server.kill();
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ impl Route {
|
|||||||
.send()
|
.send()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
|
||||||
let file_path = PathBuf::from(format!("out/static{}.html", &self.path));
|
let file_path = self.html_file_path();
|
||||||
|
|
||||||
let parent_dir = file_path.parent().unwrap();
|
let parent_dir = file_path.parent().unwrap();
|
||||||
|
|
||||||
@@ -123,6 +123,11 @@ impl Route {
|
|||||||
io::copy(&mut response, &mut data_file).expect("Failed to write the JSON on the file");
|
io::copy(&mut response, &mut data_file).expect("Failed to write the JSON on the file");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn html_file_path(&self) -> PathBuf {
|
||||||
|
let cleaned_path = self.path.replace("index", "");
|
||||||
|
PathBuf::from(format!("out/static{}/index.html", cleaned_path))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
@@ -162,4 +167,22 @@ mod tests {
|
|||||||
assert_eq!(dyn_info.axum_route, "/:posts");
|
assert_eq!(dyn_info.axum_route, "/:posts");
|
||||||
assert_eq!(dyn_info.module_import, "dyn_posts");
|
assert_eq!(dyn_info.module_import, "dyn_posts");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn should_define_the_correct_html_build_path() {
|
||||||
|
let routes = [
|
||||||
|
("/index", "out/static/index.html"),
|
||||||
|
("/documentation", "out/static/documentation/index.html"),
|
||||||
|
(
|
||||||
|
"/documentation/routing",
|
||||||
|
"out/static/documentation/routing/index.html",
|
||||||
|
),
|
||||||
|
];
|
||||||
|
|
||||||
|
for (path, html) in routes {
|
||||||
|
let route = Route::new(path.to_string());
|
||||||
|
|
||||||
|
assert_eq!(route.html_file_path(), PathBuf::from(html))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "tuono_lib"
|
name = "tuono_lib"
|
||||||
version = "0.8.2"
|
version = "0.8.3"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["V. Ageno <valerioageno@yahoo.it>"]
|
authors = ["V. Ageno <valerioageno@yahoo.it>"]
|
||||||
description = "The react/rust fullstack framework"
|
description = "The react/rust fullstack framework"
|
||||||
@@ -32,7 +32,7 @@ regex = "1.10.5"
|
|||||||
either = "1.13.0"
|
either = "1.13.0"
|
||||||
tower-http = {version = "0.5.2", features = ["fs"]}
|
tower-http = {version = "0.5.2", features = ["fs"]}
|
||||||
|
|
||||||
tuono_lib_macros = {path = "../tuono_lib_macros", version = "0.8.2"}
|
tuono_lib_macros = {path = "../tuono_lib_macros", version = "0.8.3"}
|
||||||
# Match the same version used by axum
|
# Match the same version used by axum
|
||||||
tokio-tungstenite = "0.21.0"
|
tokio-tungstenite = "0.21.0"
|
||||||
futures-util = { version = "0.3", default-features = false, features = ["sink", "std"] }
|
futures-util = { version = "0.3", default-features = false, features = ["sink", "std"] }
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "tuono_lib_macros"
|
name = "tuono_lib_macros"
|
||||||
version = "0.8.2"
|
version = "0.8.3"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "The react/rust fullstack framework"
|
description = "The react/rust fullstack framework"
|
||||||
keywords = [ "react", "typescript", "fullstack", "web", "ssr"]
|
keywords = [ "react", "typescript", "fullstack", "web", "ssr"]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "tuono-fs-router-vite-plugin",
|
"name": "tuono-fs-router-vite-plugin",
|
||||||
"version": "0.8.2",
|
"version": "0.8.3",
|
||||||
"description": "Plugin for the tuono's file system router. Tuono is the react/rust fullstack framework",
|
"description": "Plugin for the tuono's file system router. Tuono is the react/rust fullstack framework",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite build --watch",
|
"dev": "vite build --watch",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "tuono-lazy-fn-vite-plugin",
|
"name": "tuono-lazy-fn-vite-plugin",
|
||||||
"version": "0.8.2",
|
"version": "0.8.3",
|
||||||
"description": "Plugin for the tuono's lazy fn. Tuono is the react/rust fullstack framework",
|
"description": "Plugin for the tuono's lazy fn. Tuono is the react/rust fullstack framework",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite build --watch",
|
"dev": "vite build --watch",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "tuono",
|
"name": "tuono",
|
||||||
"version": "0.8.2",
|
"version": "0.8.3",
|
||||||
"description": "The react/rust fullstack framework",
|
"description": "The react/rust fullstack framework",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite build --watch",
|
"dev": "vite build --watch",
|
||||||
|
|||||||
Reference in New Issue
Block a user