mirror of
https://github.com/Xevion/dynamic-preauth.git
synced 2025-12-16 12:11:41 -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
|
# Variables
|
||||||
image_name := "dynamic-preauth"
|
image_name := "dynamic-preauth"
|
||||||
container_name := "dynamic-preauth-dev"
|
container_name := "dynamic-preauth-dev"
|
||||||
@@ -41,15 +45,26 @@ frontend-build:
|
|||||||
@echo "Building frontend..."
|
@echo "Building frontend..."
|
||||||
pnpm --dir frontend build
|
pnpm --dir frontend build
|
||||||
|
|
||||||
# Development server with hot reload
|
# Development server with hot reload (backend + ensures frontend is built)
|
||||||
dev:
|
dev: frontend-build
|
||||||
@echo "Starting development server..."
|
@echo "Starting backend development server with bacon..."
|
||||||
cargo watch -x run --bin backend
|
@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)
|
# Simple development run (no hot reload)
|
||||||
run:
|
run:
|
||||||
@echo "Starting server..."
|
@echo "Starting server..."
|
||||||
cargo run --bin backend
|
cargo run --bin dynamic-preauth
|
||||||
|
|
||||||
# Build release
|
# Build release
|
||||||
build:
|
build:
|
||||||
@@ -61,8 +76,8 @@ audit:
|
|||||||
@echo "Running security audit..."
|
@echo "Running security audit..."
|
||||||
cargo audit
|
cargo audit
|
||||||
|
|
||||||
# Build Docker image
|
# Build Docker image (ensures frontend is built first)
|
||||||
docker-build:
|
docker-build: frontend-build
|
||||||
@echo "Building Docker image..."
|
@echo "Building Docker image..."
|
||||||
docker build -t {{image_name}}:latest .
|
docker build -t {{image_name}}:latest .
|
||||||
|
|
||||||
@@ -99,6 +114,8 @@ clean:
|
|||||||
ci: format-check lint frontend-check build docker-build
|
ci: format-check lint frontend-check build docker-build
|
||||||
@echo "CI pipeline completed!"
|
@echo "CI pipeline completed!"
|
||||||
|
|
||||||
# Quick development check
|
# Quick development check (format + clippy)
|
||||||
quick: format lint
|
quick: format
|
||||||
|
@echo "Running quick clippy check..."
|
||||||
|
cargo clippy --workspace --all-targets --all-features -- -D warnings
|
||||||
@echo "Quick check completed!"
|
@echo "Quick check completed!"
|
||||||
|
|||||||
@@ -42,12 +42,8 @@ impl State {
|
|||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
.to_string();
|
.to_string();
|
||||||
|
|
||||||
let key_start =
|
let key_start = Executable::search_pattern(&data, pattern.as_bytes(), 0)
|
||||||
Executable::search_pattern(&data, pattern.as_bytes(), 0).ok_or_else(|| {
|
.ok_or_else(|| AppError::KeyPatternNotFound { name: name.clone() })?;
|
||||||
AppError::KeyPatternNotFound {
|
|
||||||
name: name.clone(),
|
|
||||||
}
|
|
||||||
})?;
|
|
||||||
let key_end = key_start + pattern.len();
|
let key_end = key_start + pattern.len();
|
||||||
|
|
||||||
let extension = path
|
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
|
// https://astro.build/config
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
outDir: "../public",
|
||||||
build: {
|
build: {
|
||||||
assets: "assets",
|
assets: "assets",
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user