- Implement ephemeral staging mode (APP_ENV=staging) to isolate test/dev DB writes in /tmp - Add read-only posts management dashboard under /guanli/posts with live links and comment counters - Add hot re-indexing endpoint (/guanli/reindex) to refresh Markdown without restarting server - Replace static recommended search config with dynamic frequency-based trending searches - Remove early scaffold mockup file (dropbox/zh.md) and clean legacy mock test queries - Add native Makefile with dev, dev-persistent, test, lint, and docker targets - Update test suite and documentation for development workflows
53 lines
2.2 KiB
Makefile
53 lines
2.2 KiB
Makefile
.PHONY: help dev dev-persistent test lint clean docker-build docker-run
|
|
|
|
# Default target
|
|
all: help
|
|
|
|
help:
|
|
@echo "========================================================================"
|
|
@echo " pengzhan.dev — Engineering Makefile"
|
|
@echo "========================================================================"
|
|
@echo "Available commands:"
|
|
@echo " make dev Start local server in Ephemeral Staging Mode"
|
|
@echo " (Safe by default: site.db is NEVER mutated)"
|
|
@echo " make dev-persistent Start local server in Persistent DB Mode"
|
|
@echo " (Changes to comments & logs write to site.db)"
|
|
@echo " make test Run complete automated test suite (in isolated temp DB)"
|
|
@echo " make lint Run comprehensive project linter (JS, EJS, CSS)"
|
|
@echo " make clean Remove temporary staging DBs and build caches"
|
|
@echo " make docker-build Build multi-stage production Docker image"
|
|
@echo " make docker-run Run production Docker container on port 3000"
|
|
@echo "========================================================================"
|
|
|
|
dev:
|
|
@echo "Starting dev server in Safe Ephemeral Staging Mode..."
|
|
@echo "-> Production sample-content/data/site.db is protected from writes."
|
|
APP_ENV=staging node --watch --watch-path=server --watch-path=views --watch-path=public server/index.js
|
|
|
|
dev-persistent:
|
|
@echo "Starting dev server in Persistent DB Mode..."
|
|
@echo "-> Writes will be recorded to sample-content/data/site.db."
|
|
node --watch --watch-path=server --watch-path=views --watch-path=public server/index.js
|
|
|
|
test:
|
|
@echo "Running automated test suite..."
|
|
NODE_ENV=test node test/test.js
|
|
|
|
lint:
|
|
@echo "Running project linter..."
|
|
node scripts/lint.js
|
|
|
|
clean:
|
|
@echo "Cleaning temporary test and staging artifacts..."
|
|
@rm -f /tmp/site.staging-*.db /tmp/site.staging-*.db-*
|
|
@rm -f sample-content/data/*.db-journal sample-content/data/*.db-wal sample-content/data/*.db-shm
|
|
@echo "Clean complete."
|
|
|
|
docker-build:
|
|
@echo "Building Docker image pengzhan.dev:latest..."
|
|
docker build -t pengzhan.dev:latest .
|
|
|
|
docker-run:
|
|
@echo "Running Docker container on http://localhost:3000..."
|
|
docker run --rm -p 3000:3000 -v $(PWD)/sample-content:/app/content pengzhan.dev:latest
|