Skip to content

Commit 276ab4a

Browse files
committed
fix: small fixes
1 parent 37c1b76 commit 276ab4a

4 files changed

Lines changed: 29 additions & 10 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
packages:
3+
- maudit-cli
4+
release: patch
5+
---
6+
7+
Fixes missing DEV flag on rebuilds
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
packages:
3+
- maudit
4+
release: patch
5+
---
6+
7+
Updates default quality for webp to 80 to match sharp

crates/maudit-cli/src/dev.rs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use std::sync::Arc;
1111
use tokio::sync::broadcast;
1212
use tracing::{debug, error, info};
1313
use watchexec::{
14-
command::{Command, Program},
14+
command::{Command, Program, Shell},
1515
job::CommandState,
1616
Watchexec,
1717
};
@@ -55,15 +55,20 @@ pub async fn start_dev_env(cwd: &str, host: bool) -> io::Result<()> {
5555
return action;
5656
} else {
5757
info!(name: "build", "Detected changes. Rebuilding…");
58+
59+
// TODO: This kinda sucks but watchexec doesn't support setting env vars on commands
60+
// Maybe I need to use something else than watchexec
61+
let (shell, command) = if cfg!(windows) {
62+
("cmd", "/C set MAUDIT_DEV=true && set MAUDIT_QUIET=true && cargo run --quiet")
63+
} else {
64+
("sh", "MAUDIT_DEV=true MAUDIT_QUIET=true cargo run --quiet")
65+
};
66+
5867
let (_, job) = action.create_job(Arc::new(Command {
59-
program: Program::Exec {
60-
prog: "cargo".into(),
61-
args: vec![
62-
"run".into(),
63-
"--quiet".into(),
64-
"--".into(),
65-
"--quiet".into(),
66-
],
68+
program: Program::Shell {
69+
shell: Shell::new(shell),
70+
command: command.into(),
71+
args: vec![],
6772
},
6873
options: Default::default(),
6974
}));

crates/maudit/src/build/images.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub fn process_image(image: &Image, dest_path: &Path, image_options: &ImageOptio
2121
// TODO: Add a way for people to choose lossless WebP encoding, despite the larger file sizes
2222
if new_format == ImageFormat::Webp {
2323
let encoder: Encoder = Encoder::from_image(&img).unwrap();
24-
let webp: WebPMemory = encoder.encode(90f32); // TODO: Allow configuring quality
24+
let webp: WebPMemory = encoder.encode(80f32); // TODO: Allow configuring quality
2525
std::fs::write(dest_path, &*webp).unwrap();
2626
} else {
2727
let file = File::create(dest_path).unwrap();

0 commit comments

Comments
 (0)