mirror of
https://github.com/Xevion/dynamic-preauth.git
synced 2025-12-15 02:11:39 -06:00
chore: add bacon config and improve dev workflow
- Add bacon.toml for Rust development watching with keybindings - Update Justfile to use bacon for dev watching - Configure frontend to build to ./public for backend serving - Improve Justfile organization with comments and better task separation - Add dev-backend and dev-frontend tasks for separate workflows - Minor formatting fix in backend/src/state.rs
This commit is contained in:
35
Justfile
35
Justfile
@@ -1,3 +1,7 @@
|
||||
# Justfile for dynamic-preauth
|
||||
# Uses bacon for Rust watching, pnpm for frontend
|
||||
# Frontend builds to ./public, which backend serves as static files
|
||||
|
||||
# Variables
|
||||
image_name := "dynamic-preauth"
|
||||
container_name := "dynamic-preauth-dev"
|
||||
@@ -41,15 +45,26 @@ frontend-build:
|
||||
@echo "Building frontend..."
|
||||
pnpm --dir frontend build
|
||||
|
||||
# Development server with hot reload
|
||||
dev:
|
||||
@echo "Starting development server..."
|
||||
cargo watch -x run --bin backend
|
||||
# Development server with hot reload (backend + ensures frontend is built)
|
||||
dev: frontend-build
|
||||
@echo "Starting backend development server with bacon..."
|
||||
@echo "Frontend is served from ./public (built from frontend/)"
|
||||
bacon run
|
||||
|
||||
# Watch backend only (for when frontend is already built)
|
||||
dev-backend:
|
||||
@echo "Starting backend watch with bacon..."
|
||||
bacon run
|
||||
|
||||
# Watch and serve frontend only
|
||||
dev-frontend:
|
||||
@echo "Starting frontend dev server..."
|
||||
pnpm --dir frontend dev
|
||||
|
||||
# Simple development run (no hot reload)
|
||||
run:
|
||||
@echo "Starting server..."
|
||||
cargo run --bin backend
|
||||
cargo run --bin dynamic-preauth
|
||||
|
||||
# Build release
|
||||
build:
|
||||
@@ -61,8 +76,8 @@ audit:
|
||||
@echo "Running security audit..."
|
||||
cargo audit
|
||||
|
||||
# Build Docker image
|
||||
docker-build:
|
||||
# Build Docker image (ensures frontend is built first)
|
||||
docker-build: frontend-build
|
||||
@echo "Building Docker image..."
|
||||
docker build -t {{image_name}}:latest .
|
||||
|
||||
@@ -99,6 +114,8 @@ clean:
|
||||
ci: format-check lint frontend-check build docker-build
|
||||
@echo "CI pipeline completed!"
|
||||
|
||||
# Quick development check
|
||||
quick: format lint
|
||||
# Quick development check (format + clippy)
|
||||
quick: format
|
||||
@echo "Running quick clippy check..."
|
||||
cargo clippy --workspace --all-targets --all-features -- -D warnings
|
||||
@echo "Quick check completed!"
|
||||
|
||||
@@ -42,12 +42,8 @@ impl State {
|
||||
.unwrap_or_default()
|
||||
.to_string();
|
||||
|
||||
let key_start =
|
||||
Executable::search_pattern(&data, pattern.as_bytes(), 0).ok_or_else(|| {
|
||||
AppError::KeyPatternNotFound {
|
||||
name: name.clone(),
|
||||
}
|
||||
})?;
|
||||
let key_start = Executable::search_pattern(&data, pattern.as_bytes(), 0)
|
||||
.ok_or_else(|| AppError::KeyPatternNotFound { name: name.clone() })?;
|
||||
let key_end = key_start + pattern.len();
|
||||
|
||||
let extension = path
|
||||
|
||||
36
bacon.toml
Normal file
36
bacon.toml
Normal file
@@ -0,0 +1,36 @@
|
||||
# Bacon configuration for dynamic-preauth
|
||||
|
||||
default_job = "check"
|
||||
|
||||
[jobs.check]
|
||||
command = ["cargo", "check", "--workspace", "--all-targets", "--all-features", "--color", "always"]
|
||||
need_stdout = false
|
||||
|
||||
[jobs.clippy]
|
||||
command = ["cargo", "clippy", "--workspace", "--all-targets", "--all-features", "--color", "always", "--", "-D", "warnings"]
|
||||
need_stdout = false
|
||||
|
||||
[jobs.test]
|
||||
command = ["cargo", "test", "--workspace", "--color", "always"]
|
||||
need_stdout = true
|
||||
|
||||
[jobs.run]
|
||||
command = ["cargo", "run", "--bin", "dynamic-preauth", "--color", "always"]
|
||||
need_stdout = true
|
||||
on_success = "back"
|
||||
|
||||
[jobs.doc]
|
||||
command = ["cargo", "doc", "--workspace", "--all-features", "--no-deps", "--color", "always"]
|
||||
need_stdout = false
|
||||
|
||||
[keybindings]
|
||||
# Use 'c' to switch to check job
|
||||
c = "job:check"
|
||||
# Use 'l' to switch to clippy job
|
||||
l = "job:clippy"
|
||||
# Use 't' to switch to test job
|
||||
t = "job:test"
|
||||
# Use 'r' to switch to run job
|
||||
r = "job:run"
|
||||
# Use 'd' to switch to doc job
|
||||
d = "job:doc"
|
||||
@@ -20,6 +20,7 @@ if (
|
||||
// https://astro.build/config
|
||||
|
||||
export default defineConfig({
|
||||
outDir: "../public",
|
||||
build: {
|
||||
assets: "assets",
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user