| 1 |
FRONTEND_SOURCES := $(shell find frontend/src frontend/css -type f) |
| 2 |
|
| 3 |
all: src/fava/static/app.js |
| 4 |
|
| 5 |
|
| 6 |
src/fava/static/app.js: $(FRONTEND_SOURCES) frontend/build.ts frontend/node_modules |
| 7 |
cd frontend; npm run build |
| 8 |
|
| 9 |
|
| 10 |
frontend/node_modules: frontend/package-lock.json |
| 11 |
cd frontend; npm install --no-progress |
| 12 |
touch -m frontend/node_modules |
| 13 |
|
| 14 |
|
| 15 |
.PHONY: dev |
| 16 |
dev: .venv |
| 17 |
.venv: constraints.txt requirements.txt pyproject.toml |
| 18 |
uv venv --allow-existing |
| 19 |
uv pip sync requirements.txt |
| 20 |
touch -m .venv |
| 21 |
|
| 22 |
|
| 23 |
.PHONY: clean |
| 24 |
clean: mostlyclean |
| 25 |
find src/fava/static ! -name 'favicon.ico' -type f -exec rm -f {} + |
| 26 |
find src/fava/translations -name '*.mo' -delete |
| 27 |
|
| 28 |
|
| 29 |
.PHONY: mostlyclean |
| 30 |
mostlyclean: |
| 31 |
rm -rf .*cache |
| 32 |
rm -rf .eggs |
| 33 |
rm -rf .tox |
| 34 |
rm -rf .venv |
| 35 |
rm -rf build |
| 36 |
rm -rf dist |
| 37 |
rm -rf htmlcov |
| 38 |
rm -rf frontend/node_modules |
| 39 |
find . -type f -name '*.py[c0]' -delete |
| 40 |
find . -type d -name "__pycache__" -delete |
| 41 |
|
| 42 |
|
| 43 |
.PHONY: lint |
| 44 |
lint: frontend/node_modules |
| 45 |
pre-commit run -a |
| 46 |
cd frontend; npm exec tsc |
| 47 |
cd frontend; npm exec svelte-check |
| 48 |
tox -e lint |
| 49 |
|
| 50 |
|
| 51 |
.PHONY: test |
| 52 |
test: frontend/node_modules |
| 53 |
cd frontend; npm run test |
| 54 |
tox -e py |
| 55 |
|
| 56 |
|
| 57 |
.PHONY: update-snapshots |
| 58 |
update-snapshots: |
| 59 |
find . -name "__snapshots__" -type d -prune -exec rm -r "{}" + |
| 60 |
-SNAPSHOT_UPDATE=1 tox -e py |
| 61 |
tox -e py |
| 62 |
|
| 63 |
|
| 64 |
.PHONY: update-constraints |
| 65 |
update-constraints: |
| 66 |
uv pip compile --quiet --extra excel --extra dev --python-version 3.9 --upgrade --output-file constraints.txt pyproject.toml |
| 67 |
uv pip compile --quiet --extra excel --extra old_deps_pins --resolution=lowest --python-version 3.9 --upgrade --output-file constraints-old.txt pyproject.toml |
| 68 |
|
| 69 |
|
| 70 |
.PHONY: update-frontend-deps |
| 71 |
update-frontend-deps: |
| 72 |
-cd frontend; npm outdated |
| 73 |
cd frontend; npm update |
| 74 |
cd frontend; npm run sync-pre-commit |
| 75 |
touch -m frontend/node_modules |
| 76 |
|
| 77 |
|
| 78 |
.PHONY: update-precommit |
| 79 |
update-precommit: |
| 80 |
pre-commit autoupdate |
| 81 |
|
| 82 |
|
| 83 |
.PHONY: update |
| 84 |
update: update-constraints update-frontend-deps update-precommit |
| 85 |
|
| 86 |
|
| 87 |
.PHONY: docs |
| 88 |
docs: |
| 89 |
tox -e docs |
| 90 |
|
| 91 |
|
| 92 |
.PHONY: run-example |
| 93 |
run-example: |
| 94 |
@xdg-open http://localhost:3333 |
| 95 |
BEANCOUNT_FILE= fava -p 3333 --debug tests/data/*.beancount |
| 96 |
|
| 97 |
|
| 98 |
.PHONY: bql-grammar |
| 99 |
bql-grammar: .venv contrib/scripts.py constraints.txt |
| 100 |
uv run --no-sync python contrib/scripts.py generate-bql-grammar-json |
| 101 |
-pre-commit run prettier --files frontend/src/codemirror/bql-grammar.ts |
| 102 |
|
| 103 |
|
| 104 |
.PHONY: dist |
| 105 |
dist: |
| 106 |
rm -rf dist/*.tar.gz |
| 107 |
rm -rf dist/*.whl |
| 108 |
python -m build |
| 109 |
twine check dist/* |
| 110 |
|
| 111 |
|
| 112 |
.PHONY: before-release |
| 113 |
before-release: bql-grammar translations-push translations-fetch |
| 114 |
|
| 115 |
|
| 116 |
.PHONY: translations-extract |
| 117 |
translations-extract: .venv |
| 118 |
uv run --no-sync pybabel extract -F src/fava/translations/babel.conf -o src/fava/translations/messages.pot . |
| 119 |
|
| 120 |
|
| 121 |
|
| 122 |
|
| 123 |
.PHONY: translations-push |
| 124 |
translations-push: .venv translations-extract |
| 125 |
uv run --no-sync python contrib/scripts.py upload-translations |
| 126 |
|
| 127 |
|
| 128 |
.PHONY: translations-fetch |
| 129 |
translations-fetch: .venv |
| 130 |
uv run --no-sync python contrib/scripts.py download-translations |
| 131 |
|
| 132 |
|
| 133 |
dist/fava: src/fava/static/app.js |
| 134 |
tox -e pyinstaller |