File size: 1,567 Bytes
5285b72
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
SHELL=/bin/bash -eo pipefail

.PHONY: list fix check

list:
	@LC_ALL=C $(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | \
		awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | \
		sort | egrep -v -e '^[^[:alnum:]]' -e '^$@$$'

setup: setup_frontend setup_backend

setup_frontend:
	npm ci

setup_backend:
	rye sync

build: build_frontend build_backend

build_frontend:
	npx remix vite:build

build_backend: build_frontend
	docker compose build

serve_frontend:
	npx remix vite:dev --host 0.0.0.0 --port 7861

serve_backend:
	rye run uvicorn backend:app \
		--host 0.0.0.0 --port 7860 --log-level debug --reload

fix: fix_frontend fix_backend

fix_frontend:
	npx biome check --apply .

fix_backend:
	rye lint
	rye fmt

check: check_frontend check_backend

check_frontend:
	npx tsc

check_backend:
	rye run pyright

codegen_gitignore:
	for i in .gitignore.d/*.gitignore; do \
		{ echo "## $$i START"; cat $$i; echo "## $$i END"; }; \
		done > .gitignore;

codegen_config:
	jsonnet -m . config.jsonnet
	yq -i e -P '.' docker-compose.yml && yq -i e -P '.' docker-compose.yml
	yq -i e -P '.' docker-compose.vespa.yml && yq -i e -P '.' docker-compose.vespa.yml

codegen_graphql_backend:
	python -m gql_schema_codegen \
		-p ./schema/graphql_* \
		-t ./backend/generated/schema_types.py
	$$(command -v gsed &>/dev/null && echo "gsed" || echo "sed") \
		-i '1,10 s/^from typing import/from typing_extensions import/' \
		backend/generated/schema_types.py

codegen_graphql_frontend:
	npx graphql-codegen --config codegen.ts