Files
worldmonitor/Makefile
Elie Habib f336418c17 feat(advisories): gold standard migration for security advisories (#1637)
* feat(advisories): gold standard migration for security advisories

Move security advisories from client-side RSS fetching (24 feeds per
page load) to Railway cron seed with Redis-read-only Vercel handler.

- Add seed script fetching via relay RSS proxy with domain allowlist
- Add ListSecurityAdvisories proto, handler, and RPC cache tier
- Add bootstrap hydration key for instant page load
- Rewrite client service: bootstrap -> RPC fallback, no browser RSS
- Wire health.js, seed-health.js, and dataSize tracking

* fix(advisories): empty RPC returns ok:true, use full country map

P1 fixes from Codex review:
- Return ok:true for empty-but-successful RPC responses so the panel
  clears to empty instead of stuck loading on cold environments
- Replace 50-entry hardcoded country map with 251-entry shared config
  generated from the project GeoJSON + aliases, matching coverage of
  the old client-side nameToCountryCode matcher

* fix(advisories): add Cote d'Ivoire and other missing country aliases

Adds 14 missing aliases including "cote d ivoire" (US State Dept
title format), common article-prefixed names (the Bahamas, the
Gambia), and alternative official names (Czechia, Eswatini, Cabo
Verde, Timor-Leste).

* fix(proto): inject @ts-nocheck via Makefile generate target

buf generate does not emit @ts-nocheck, but tsc strict mode rejects
the generated code. Adding a post-generation sed step in the Makefile
ensures both CI proto-freshness (make generate + diff) and CI
typecheck (tsc --noEmit) pass consistently.
2026-03-15 11:54:08 +04:00

74 lines
2.5 KiB
Makefile

.PHONY: help lint generate breaking format check clean deps install install-buf install-plugins install-npm install-playwright
.DEFAULT_GOAL := help
# Variables
PROTO_DIR := proto
GEN_CLIENT_DIR := src/generated/client
GEN_SERVER_DIR := src/generated/server
DOCS_API_DIR := docs/api
# Go install settings
GO_PROXY := GOPROXY=direct
GO_PRIVATE := GOPRIVATE=github.com/SebastienMelki
GO_INSTALL := $(GO_PROXY) $(GO_PRIVATE) go install
# Required tool versions
BUF_VERSION := v1.64.0
SEBUF_VERSION := v0.7.0
help: ## Show this help message
@echo 'Usage: make [target]'
@echo ''
@echo 'Targets:'
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-20s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
install: install-buf install-plugins install-npm install-playwright deps ## Install everything (buf, sebuf plugins, npm deps, proto deps, browsers)
install-buf: ## Install buf CLI
@if command -v buf >/dev/null 2>&1; then \
echo "buf already installed: $$(buf --version)"; \
else \
echo "Installing buf..."; \
$(GO_INSTALL) github.com/bufbuild/buf/cmd/buf@$(BUF_VERSION); \
echo "buf installed!"; \
fi
install-plugins: ## Install sebuf protoc plugins (requires Go)
@echo "Installing sebuf protoc plugins $(SEBUF_VERSION)..."
@$(GO_INSTALL) github.com/SebastienMelki/sebuf/cmd/protoc-gen-ts-client@$(SEBUF_VERSION)
@$(GO_INSTALL) github.com/SebastienMelki/sebuf/cmd/protoc-gen-ts-server@$(SEBUF_VERSION)
@$(GO_INSTALL) github.com/SebastienMelki/sebuf/cmd/protoc-gen-openapiv3@$(SEBUF_VERSION)
@echo "Plugins installed!"
install-npm: ## Install npm dependencies
npm install
install-playwright: ## Install Playwright browsers for e2e tests
npx playwright install chromium
deps: ## Install/update buf proto dependencies
cd $(PROTO_DIR) && buf dep update
lint: ## Lint protobuf files
cd $(PROTO_DIR) && buf lint
generate: clean ## Generate code from proto definitions
@mkdir -p $(GEN_CLIENT_DIR) $(GEN_SERVER_DIR) $(DOCS_API_DIR)
cd $(PROTO_DIR) && buf generate
@find $(GEN_CLIENT_DIR) $(GEN_SERVER_DIR) -name '*.ts' -exec sed -i.bak '1s;^;// @ts-nocheck\n;' {} \; -exec rm -f {}.bak \;
@echo "Code generation complete!"
breaking: ## Check for breaking changes against main
cd $(PROTO_DIR) && buf breaking --against '.git#branch=main,subdir=proto'
format: ## Format protobuf files
cd $(PROTO_DIR) && buf format -w
check: lint generate ## Run all checks (lint + generate)
clean: ## Clean generated files
@rm -rf $(GEN_CLIENT_DIR)
@rm -rf $(GEN_SERVER_DIR)
@rm -rf $(DOCS_API_DIR)
@echo "Clean complete!"