Initial scaffold for AvtoAmbor parts inventory
SvelteKit 2 + Svelte 4 + adapter-node, SQLite via better-sqlite3 (WAL, foreign keys on). Bilingual EN/Тоҷикӣ throughout, locale persisted in localStorage. Pages: dashboard (totals, low stock, recent movements), parts list with search and sort, part create/edit, record movement (in/out/adjust with smart unit-price and adjust-quantity prefill), suppliers list with inline add. Schema: categories, suppliers, parts (with _en/_tg name+description columns, dirams for money), stock_movements with check on movement_type. On-hand updates are done in JS inside a transaction with the movement insert. Dockerized dev: docker compose, named project, bind-mounted data/ for DB persistence. Seed contains 6 categories, 4 suppliers, 31 realistic parts (Lada / Nexia / Opel / Toyota bias). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
56
Makefile
Normal file
56
Makefile
Normal file
@ -0,0 +1,56 @@
|
||||
.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:5173)"
|
||||
@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."
|
||||
Reference in New Issue
Block a user