forked from beancount/fava
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
137 lines (113 loc) · 3.61 KB
/
Makefile
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
FRONTEND_SOURCES := $(shell find frontend/src frontend/css -type f)
TRANSLATION_SOURCES := $(wildcard src/fava/translations/*/LC_MESSAGES/messages.po)
TRANSLATION_TARGETS := $(TRANSLATION_SOURCES:messages.po=messages.mo)
.PHONY: all
all: src/fava/static/app.js $(TRANSLATION_TARGETS)
src/fava/static/app.js: $(FRONTEND_SOURCES) frontend/build.ts frontend/node_modules
rm -f src/fava/static/*
git checkout -- src/fava/static
cd frontend; npm run build
frontend/node_modules: frontend/package-lock.json
cd frontend; npm install --no-progress
touch -m frontend/node_modules
$(TRANSLATION_TARGETS): $(TRANSLATION_SOURCES)
pybabel compile -d src/fava/translations
.PHONY: clean
clean: mostlyclean
find src/fava/static ! -name 'favicon.ico' -type f -exec rm -f {} +
.PHONY: mostlyclean
mostlyclean:
rm -rf .*cache
rm -rf .eggs
rm -rf .tox
rm -rf build
rm -rf dist
rm -rf frontend/node_modules
find . -type f -name '*.py[c0]' -delete
find . -type d -name "__pycache__" -delete
find src/fava/translations -name '*.mo' -delete
.PHONY: lint
lint: frontend/node_modules
pre-commit run -a
cd frontend; npx tsc
cd frontend; npx svelte-check
tox -e lint
.PHONY: test
test: all
cd frontend; npm run test
tox -e py
.PHONY: update-snapshots
update-snapshots:
find . -name "__snapshots__" -type d -prune -exec rm -r "{}" +
-SNAPSHOT_UPDATE=1 tox -e py
tox -e py
# Update the constraints file for Python dependencies
.PHONY: update-constraints
update-constraints:
pip-compile --quiet --resolver=backtracking --all-extras --strip-extras --upgrade --output-file constraints.txt pyproject.toml
# Update the frontend dependencies.
.PHONY: update-frontend-deps
update-frontend-deps:
-cd frontend; npm outdated
cd frontend; npm update
cd frontend; npm run sync-pre-commit
touch -m frontend/node_modules
.PHONY: update-precommit
update-precommit:
pre-commit autoupdate
.PHONY: update-deps
update-deps: update-constraints update-frontend-deps update-precommit
.PHONY: docs
docs:
tox -e docs
.PHONY: run-example
run-example:
@xdg-open http://localhost:3333
BEANCOUNT_FILE= fava -p 3333 --debug tests/data/*.beancount
.PHONY: bql-grammar
bql-grammar:
contrib/scripts.py generate-bql-grammar-json
dist: src/fava/static/app.js src/fava setup.cfg pyproject.toml MANIFEST.in
rm -rf build dist
tox -e build-dist
.PHONY: before-release
before-release: bql-grammar translations-push translations-fetch
# Before making a release, CHANGES needs to be updated and
# a tag should be created too.
#
# Also, fava.pythonanywhere.com should be updated.
.PHONY: upload
upload: dist
twine upload dist/*
# Extract translation strings.
.PHONY: translations-extract
translations-extract:
pybabel extract -F src/fava/translations/babel.conf -o src/fava/translations/messages.pot .
# Extract translation strings and upload them to POEditor.com.
# Requires the environment variable POEDITOR_TOKEN to be set to an API token
# for POEditor.
.PHONY: translations-push
translations-push: translations-extract
contrib/scripts.py upload-translations
# Download translations from POEditor.com. (also requires POEDITOR_TOKEN)
.PHONY: translations-fetch
translations-fetch:
contrib/scripts.py download-translations
# Build and upload the website.
.PHONY: gh-pages
gh-pages:
git checkout main
git checkout --orphan gh-pages
tox -e docs
ls | grep -v 'build' | xargs rm -r
mv -f build/docs/* ./
rm -r build .github
touch .nojekyll
git add -A
git commit -m 'Update gh-pages' --no-verify
git push --force [email protected]:beancount/fava.git gh-pages:gh-pages
git checkout main
git branch -D gh-pages
# Create a binary using pyinstaller
dist/fava: src/fava/static/app.js
tox -e pyinstaller