diff --git a/.gitignore b/.gitignore index 14388e6d..5b190012 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ /target *.db* -/static_packages/node_modules -/static_packages/dist +/static/node_modules +/static/dist diff --git a/build.rs b/build.rs index b2fd69f5..0988c416 100644 --- a/build.rs +++ b/build.rs @@ -1,20 +1,39 @@ use static_files::{resource_dir, NpmBuild}; -use std::{fs::{self, copy}, path::Path}; +use std::{ + fs::{self, copy}, + path::Path, +}; fn main() -> std::io::Result<()> { - NpmBuild::new("./static_packages") - .change_detection() - .install()?; + NpmBuild::new("./static").change_detection().install()?; - if fs::metadata(Path::new("./static_packages/dist")).is_err() { - fs::create_dir(Path::new("./static_packages/dist"))?; + let dist_path = Path::new("./static/dist"); + let nm_path = Path::new("./static/node_modules"); + + if fs::metadata(dist_path).is_err() { + fs::create_dir(dist_path)?; } - copy(Path::new("./static_packages/node_modules/feather-icons/dist/feather-sprite.svg"), Path::new("./static_packages/dist/feather-sprite.svg"))?; - copy(Path::new("./static_packages/node_modules/bulma/css/bulma.min.css"), Path::new("./static_packages/dist/bulma.min.css"))?; - copy(Path::new("./static_packages/node_modules/htmx.org/dist/htmx.min.js"), Path::new("./static_packages/dist/htmx.min.js"))?; - copy(Path::new("./static_packages/node_modules/htmx.org/dist/ext/response-targets.js"), Path::new("./static_packages/dist/response-targets.js"))?; - copy(Path::new("./static_packages/brass.jpeg"), Path::new("./static_packages/dist/brass.jpeg"))?; + copy( + nm_path.join("feather-icons/dist/feather-sprite.svg"), + dist_path.join("feather-sprite.svg"), + )?; + copy( + nm_path.join("bulma/css/bulma.min.css"), + dist_path.join("bulma.min.css"), + )?; + copy( + nm_path.join("htmx.org/dist/htmx.min.js"), + dist_path.join("htmx.min.js"), + )?; + copy( + nm_path.join("htmx.org/dist/ext/response-targets.js"), + dist_path.join("response-targets.js"), + )?; + copy( + Path::new("./static/brass.jpeg"), + dist_path.join("brass.jpeg"), + )?; - resource_dir("./static_packages/dist").build() + resource_dir("./static/dist").build() } diff --git a/static_packages/brass.jpeg b/static/brass.jpeg similarity index 100% rename from static_packages/brass.jpeg rename to static/brass.jpeg diff --git a/static_packages/package-lock.json b/static/package-lock.json similarity index 98% rename from static_packages/package-lock.json rename to static/package-lock.json index 99b0456e..863ee7b2 100644 --- a/static_packages/package-lock.json +++ b/static/package-lock.json @@ -1,5 +1,5 @@ { - "name": "static_packages", + "name": "static", "lockfileVersion": 3, "requires": true, "packages": { diff --git a/static_packages/package.json b/static/package.json similarity index 100% rename from static_packages/package.json rename to static/package.json