build: manage all dependencies with npm now

This commit is contained in:
Max Hohlfeld 2024-07-10 22:58:58 +02:00
parent f13ce43145
commit bd9cd0f28b
5 changed files with 35 additions and 9 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
/target
*.db*
/static_packages/node_modules
/static_packages/dist

View File

@ -1,13 +1,20 @@
use static_files::NpmBuild;
use std::path::Path;
use static_files::{resource_dir, NpmBuild};
use std::{fs::{self, copy}, path::Path};
fn main() -> std::io::Result<()> {
NpmBuild::new("./static_packages")
.install()?
.change_detection()
.to_resource_dir()
.with_filter(|x: &Path| x.ends_with("feather-sprite.svg"))
.build()?;
.install()?;
Ok(())
if fs::metadata(Path::new("./static_packages/dist")).is_err() {
fs::create_dir(Path::new("./static_packages/dist"))?;
}
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"))?;
resource_dir("./static_packages/dist").build()
}

BIN
static_packages/brass.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -5,9 +5,18 @@
"packages": {
"": {
"devDependencies": {
"feather-icons": "^4.29.2"
"bulma": "^1.0.1",
"feather-icons": "^4.29.2",
"htmx.org": "^1.9.12"
}
},
"node_modules/bulma": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/bulma/-/bulma-1.0.1.tgz",
"integrity": "sha512-+xv/BIAEQakHkR0QVz+s+RjNqfC53Mx9ZYexyaFNFo9wx5i76HXArNdwW7bccyJxa5mgV/T5DcVGqsAB19nBJQ==",
"dev": true,
"license": "MIT"
},
"node_modules/classnames": {
"version": "2.5.1",
"resolved": "https://registry.npmjs.org/classnames/-/classnames-2.5.1.tgz",
@ -37,6 +46,13 @@
"classnames": "^2.2.5",
"core-js": "^3.1.3"
}
},
"node_modules/htmx.org": {
"version": "1.9.12",
"resolved": "https://registry.npmjs.org/htmx.org/-/htmx.org-1.9.12.tgz",
"integrity": "sha512-VZAohXyF7xPGS52IM8d1T1283y+X4D+Owf3qY1NZ9RuBypyu9l8cGsxUMAG5fEAb/DhT7rDoJ9Hpu5/HxFD3cw==",
"dev": true,
"license": "0BSD"
}
}
}

View File

@ -1,5 +1,7 @@
{
"devDependencies": {
"feather-icons": "^4.29.2"
"bulma": "^1.0.1",
"feather-icons": "^4.29.2",
"htmx.org": "^1.9.12"
}
}