feat(devex): add a unified just command surface
- Command surface: - add a root `Justfile` with namespaced `api`, `ui`, and `release` modules so humans and agents can use the same entrypoints from the repo root - add project-local Justfiles for `booklore-api`, `booklore-ui`, and `tools/release` so each area remains self-contained and can still be driven from inside its own directory - standardize local developer workflows around `just check`, `just test`, `just api run`, `just ui dev`, `just db-up`, and `just image-build` - Workflow integration: - update the reusable test suite workflow to install `just` and run backend and frontend CI steps through the Justfiles instead of hardcoded shell commands - update the semantic-release workflows to install `just` and invoke release tooling via `just release install`, `just release preview`, and `just release run` - keep the Docker image publication workflows on the native Docker actions while moving the project-command logic into the canonical command surface - Documentation: - split backend and frontend implementation guidance into `booklore-api/README.md`, `booklore-api/CONTRIBUTING.md`, `booklore-ui/README.md`, and `booklore-ui/CONTRIBUTING.md` - simplify the top-level `README.md` and `CONTRIBUTING.md` so they stay focused on overview, policy, and navigation while pointing to component-specific guides for deeper detail - align contributor-facing examples on the `just` interface instead of mixing ad hoc Gradle, npm, Docker, and Compose commands - Developer environment: - add `mise.toml` to pin the expected Java and Node toolchain versions for local work - switch the development Compose defaults from the old Booklore database values to Grimmory-oriented defaults - keep the command layout ready for a future API/UI split without forcing that packaging change yet
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
set shell := ["bash", "-eu", "-o", "pipefail", "-c"]
|
||||
|
||||
mod api 'booklore-api/Justfile'
|
||||
mod ui 'booklore-ui/Justfile'
|
||||
mod release 'tools/release/Justfile'
|
||||
|
||||
compose_file := env_var_or_default('GRIMMORY_COMPOSE_FILE', 'dev.docker-compose.yml')
|
||||
compose_cmd := 'docker compose -f ' + compose_file
|
||||
db_service := 'backend_db'
|
||||
local_image_tag := env_var_or_default('GRIMMORY_IMAGE_TAG', 'grimmory:local')
|
||||
local_container_name := 'grimmory-local'
|
||||
local_db_url := 'jdbc:mariadb://localhost:3366/grimmory?createDatabaseIfNotExist=true'
|
||||
local_db_user := 'grimmory'
|
||||
local_db_password := 'grimmory'
|
||||
|
||||
# Show the primary developer and agent command surface, including submodule recipes.
|
||||
help:
|
||||
@just --list --list-submodules
|
||||
|
||||
# List recipes in a specific module, for example `just list api` or `just list ui`.
|
||||
list module='':
|
||||
@if [[ -n "{{ module }}" ]]; then \
|
||||
just --list "{{ module }}"; \
|
||||
else \
|
||||
just --list --list-submodules; \
|
||||
fi
|
||||
|
||||
# Install the common local prerequisites used by the UI and API workflows.
|
||||
bootstrap: ui::install api::version
|
||||
|
||||
# Run the full local verification pass used before opening a PR.
|
||||
check: api::check ui::check
|
||||
|
||||
# Run the frontend and backend test suites.
|
||||
test: api::test ui::test
|
||||
|
||||
# Build both application components without publishing a container image.
|
||||
build: api::build ui::build
|
||||
|
||||
# Start the Docker-based development stack in the foreground.
|
||||
dev-up:
|
||||
{{ compose_cmd }} up
|
||||
|
||||
# Start the Docker-based development stack in the background.
|
||||
dev-up-detached:
|
||||
{{ compose_cmd }} up -d
|
||||
|
||||
# Start only the development database service from the compose stack.
|
||||
db-up:
|
||||
{{ compose_cmd }} up -d {{ db_service }}
|
||||
|
||||
# Stop only the development database service from the compose stack.
|
||||
db-down:
|
||||
{{ compose_cmd }} stop {{ db_service }}
|
||||
|
||||
# Stop the Docker-based development stack.
|
||||
dev-down:
|
||||
{{ compose_cmd }} down
|
||||
|
||||
# Tail logs from the full dev stack or a single service with `just dev-logs backend`.
|
||||
dev-logs service='':
|
||||
@if [[ -n "{{ service }}" ]]; then \
|
||||
{{ compose_cmd }} logs -f "{{ service }}"; \
|
||||
else \
|
||||
{{ compose_cmd }} logs -f; \
|
||||
fi
|
||||
|
||||
# Build the production image locally with buildx. Usage: `just image-build [platform] [tag]`.
|
||||
image-build platform='linux/amd64' tag=local_image_tag:
|
||||
docker buildx build --platform "{{ platform }}" -t "{{ tag }}" --load .
|
||||
|
||||
# Run the locally built production image against the expected development defaults.
|
||||
image-run tag=local_image_tag db_url=local_db_url db_user=local_db_user db_password=local_db_password:
|
||||
docker run --rm -it \
|
||||
--name "{{ local_container_name }}" \
|
||||
--network host \
|
||||
-e "SPRING_DATASOURCE_URL={{ db_url }}" \
|
||||
-e "SPRING_DATASOURCE_USERNAME={{ db_user }}" \
|
||||
-e "SPRING_DATASOURCE_PASSWORD={{ db_password }}" \
|
||||
-v ./shared/data:/app/data \
|
||||
-v ./shared/books:/books \
|
||||
-v ./shared/bookdrop:/bookdrop \
|
||||
-p 6060:6060 \
|
||||
"{{ tag }}"
|
||||
|
||||
# Show the resolved tool versions that the local commands expect to find.
|
||||
doctor:
|
||||
@echo "just: $$(just --version)"
|
||||
@echo "java: $$(java -version 2>&1 | head -n 1)"
|
||||
@echo "node: $$(node --version)"
|
||||
@echo "npm: $$(npm --version)"
|
||||
@echo "docker: $$(docker --version)"
|
||||
Reference in New Issue
Block a user