Set up the project structure per the new-project guide, adapted from the Python skeleton to the Node/TS stack fixed in SPEC.md (reuses docmost-mcp). Scaffold only — the sync engine is not implemented yet. - src/settings.ts: single config layer on zod, schema keyed by real ENV names; credentials and own-service address have no default (fail fast). - src/config-errors.ts: loadSettingsOrExit — clear startup message naming the missing/invalid env var instead of a raw stack trace; exit(1). - src/index.ts: thin entry point that validates config and logs (stub). - test/: vitest unit tests for settings parsing and config errors (10 tests). - Makefile (install/env/build/test/run/dev/clean), strict tsconfig, vitest. - Dockerfile (single-stage, no EXPOSE, prunes dev deps), docker-compose (daemon, volume on /app/data, watchtower), ghcr CI with build needs test. - .env.example, .gitignore/.dockerignore, AGENTS.md, README.md. - Pinned deps (dotenv, zod) + committed package-lock.json.
32 lines
756 B
Makefile
32 lines
756 B
Makefile
.DEFAULT_GOAL := help
|
|
|
|
.PHONY: help install env build test run dev clean
|
|
|
|
help: ## Show this help
|
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
|
|
| awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-12s\033[0m %s\n", $$1, $$2}'
|
|
|
|
node_modules: package.json package-lock.json
|
|
npm ci
|
|
@touch node_modules
|
|
|
|
install: node_modules ## Install dependencies (npm ci)
|
|
|
|
env: ## Create .env from the template if missing
|
|
@test -f .env || cp .env.example .env
|
|
|
|
build: install ## Compile TypeScript to build/
|
|
npm run build
|
|
|
|
test: install ## Run the test suite
|
|
npm test
|
|
|
|
run: build ## Build and run the app
|
|
node build/index.js
|
|
|
|
dev: install ## Run in watch mode (tsx)
|
|
npm run dev
|
|
|
|
clean: ## Remove build artifacts and node_modules
|
|
rm -rf build node_modules
|