sharp was the only native dependency preventing a single-file binary. Replaced with: - jpeg-js (pure JS) for JPEG decode/resize/encode in thumbnail gen - exif-reader (pure JS) for EXIF tag parsing - Raw JPEG APP1 marker extraction for EXIF segment discovery - Raw XMP packet extraction from file bytes make build-bin produces a ~59MB self-contained Mach-O binary via bun build --compile (bun installed via nix-shell). Zero runtime dependencies. Tested: login, whoami, collections, files all work from the compiled binary. bin/quak.ts: init() called once at program start before commander parses, so libsodium is ready for all commands including those that restore sessions from disk. 118 tests pass.
49 lines
1.3 KiB
Makefile
49 lines
1.3 KiB
Makefile
.PHONY: test lint fmt fmt-check check build build-bin dev clean docker hooks
|
|
|
|
# Use `timeout` (GNU coreutils) when available so `make test` is hard-capped.
|
|
# On macOS without coreutils this is empty and the cap is skipped.
|
|
TIMEOUT := $(shell command -v timeout 2>/dev/null || command -v gtimeout 2>/dev/null)
|
|
|
|
YARN := yarn run
|
|
|
|
test:
|
|
@$(TIMEOUT) $(if $(TIMEOUT),30s,) $(YARN) vitest run --reporter=dot || \
|
|
{ echo "--- Rerunning with verbose for details ---"; \
|
|
$(YARN) vitest run --reporter=verbose; exit 1; }
|
|
|
|
lint:
|
|
@$(YARN) eslint .
|
|
@$(YARN) prettier --check .
|
|
|
|
fmt:
|
|
@$(YARN) prettier --write .
|
|
|
|
fmt-check:
|
|
@$(YARN) prettier --check .
|
|
|
|
check: test lint fmt-check
|
|
|
|
build:
|
|
@$(YARN) tsc
|
|
|
|
build-bin:
|
|
nix-shell -p bun --run "bun build bin/quak.ts --compile --outfile bin/quak"
|
|
|
|
dev:
|
|
@$(YARN) tsc --watch
|
|
|
|
clean:
|
|
@rm -rf dist coverage .vitest-cache *.tsbuildinfo
|
|
|
|
docker:
|
|
docker build -t quak .
|
|
|
|
hooks:
|
|
@printf '#!/bin/sh\nset -e\nmake lint\nmake fmt-check\n' > .git/hooks/pre-commit
|
|
@chmod +x .git/hooks/pre-commit
|
|
@echo "Installed pre-commit hook (runs make lint && make fmt-check)."
|
|
@echo "Note: tests are deliberately not in the pre-commit hook so the"
|
|
@echo "TDD red-phase commit (failing tests, no implementation yet)"
|
|
@echo "can land. CI runs make check via docker build, which catches"
|
|
@echo "any branch that ships red."
|