Files
avtoambor/Makefile
2026-05-16 07:41:38 +05:00

57 lines
2.0 KiB
Makefile

.PHONY: help install run build db-init db-reset docker-build docker-shell clean clean-all
DC := docker compose
help:
@echo ""
@echo " ╔════════════════════════════════════════════════╗"
@echo " ║ AvtoAmbor — auto parts inventory (dev tasks) ║"
@echo " ╚════════════════════════════════════════════════╝"
@echo ""
@echo " make install Install npm dependencies inside the container"
@echo " make run Start the dev server (http://localhost:3000)"
@echo " make build Production build into ./build (adapter-node)"
@echo " make db-init Create data/avtoambor.db from schema + seed (skip if exists)"
@echo " make db-reset DELETE and recreate data/avtoambor.db (asks first)"
@echo " make docker-build Rebuild the Docker image"
@echo " make docker-shell Open an interactive bash shell in the container"
@echo " make clean Remove node_modules and build/ (keeps data/)"
@echo " make clean-all Also wipe data/ (destroys the DB)"
@echo ""
install:
@$(DC) run --rm app npm install
run:
@$(DC) up
build:
@$(DC) run --rm app npm run build
db-init:
@if [ -f data/avtoambor.db ]; then \
echo "data/avtoambor.db already exists — skipping. Use 'make db-reset' to recreate."; \
else \
mkdir -p data && $(DC) run --rm app node scripts/init-db.js; \
fi
db-reset:
@printf "This will DELETE data/avtoambor.db. Continue? [y/N] " && read ans && [ "$$ans" = "y" ] || (echo "aborted." && exit 1)
@rm -f data/avtoambor.db data/avtoambor.db-shm data/avtoambor.db-wal
@mkdir -p data
@$(DC) run --rm app node scripts/init-db.js
docker-build:
@$(DC) build
docker-shell:
@$(DC) run --rm app bash
clean:
@rm -rf node_modules build .svelte-kit
@echo "removed node_modules, build/, .svelte-kit/ (data/ kept)"
clean-all: clean
@rm -rf data
@echo "wiped data/ as well."