|
1 | 1 | .PHONY: clean |
2 | 2 | clean: |
3 | | - find . -type d -name "__pycache__" -exec rm -rf {} + > /dev/null 2>&1 |
4 | | - find . -type f -name "*.pyc" -exec rm -rf {} + > /dev/null 2>&1 |
5 | | - rm -rf htmlcov |
6 | | - rm -rf .coverage |
| 3 | + @exec find . -type d -name "__pycache__" -exec rm -rf {} + > /dev/null 2>&1 |
| 4 | + @exec find . -type f -name "*.pyc" -exec rm -rf {} + > /dev/null 2>&1 |
| 5 | + @exec rm -rf htmlcov |
| 6 | + @exec rm -rf .coverage |
7 | 7 |
|
8 | 8 | .PHONY: fix |
9 | 9 | fix: |
10 | | - poetry run pyupgrade --exit-zero-even-if-changed --py39-plus fastadmin/**/*.py tests/**/*.py |
11 | | - poetry run isort --settings-path pyproject.toml fastadmin tests |
12 | | - poetry run black --config pyproject.toml fastadmin tests |
13 | | - cd frontend && make fix |
| 10 | + @echo "Run ruff" |
| 11 | + @exec poetry run ruff --fix fastadmin tests examples docs |
| 12 | + @echo "Run isort" |
| 13 | + @exec poetry run isort fastadmin tests examples docs |
| 14 | + @echo "Run black" |
| 15 | + @exec poetry run black fastadmin tests examples docs |
| 16 | + @echo "Run mypy" |
| 17 | + @exec poetry run mypy -p fastadmin -p tests -p examples -p docs |
| 18 | + @echo "Run frontend linters" |
| 19 | + @exec make -C frontend fix |
14 | 20 |
|
15 | 21 | .PHONY: lint |
16 | 22 | lint: |
17 | | - poetry run isort --diff --check-only --settings-path pyproject.toml fastadmin tests |
18 | | - poetry run black --diff --check --config pyproject.toml fastadmin tests |
19 | | - poetry run flake8 --show-source --config .flake8 fastadmin tests |
20 | | - poetry run mypy --show-error-code --install-types --non-interactive --namespace-packages --show-traceback --config-file pyproject.toml fastadmin |
21 | | - cd frontend && make lint |
| 23 | + @echo "Run ruff" |
| 24 | + @exec poetry run ruff fastadmin tests examples docs |
| 25 | + @echo "Run isort" |
| 26 | + @exec poetry run isort --check-only fastadmin tests examples docs |
| 27 | + @echo "Run black" |
| 28 | + @exec poetry run black --check --diff fastadmin tests examples docs |
| 29 | + @echo "Run mypy" |
| 30 | + @exec poetry run mypy -p fastadmin -p tests -p examples -p docs |
| 31 | + @echo "Run frontend linters" |
| 32 | + @exec make -C frontend lint |
22 | 33 |
|
23 | 34 | .PHONY: test |
24 | 35 | test: |
25 | | - poetry run python generate_db.py |
26 | | - ADMIN_ENV_FILE=example.env poetry run pytest --cov=fastadmin --cov-report=term-missing --cov-report=xml --cov-fail-under=90 -s tests |
27 | | - cd frontend && make test |
| 36 | + @exec poetry run python generate_db.py |
| 37 | + @exec env ADMIN_ENV_FILE=example.env poetry run pytest --cov=fastadmin --cov-report=term-missing --cov-report=xml --cov-fail-under=90 -s tests |
| 38 | + @exec make -C frontend test |
28 | 39 |
|
29 | 40 | .PHONY: kill |
30 | 41 | kill: |
31 | | - kill -9 $$(lsof -t -i:8090) |
32 | | - kill -9 $$(lsof -t -i:3030) |
| 42 | + @exec kill -9 $$(lsof -t -i:8090) |
| 43 | + @exec kill -9 $$(lsof -t -i:3030) |
33 | 44 |
|
34 | 45 | .PHONY: collectstatic |
35 | 46 | collectstatic: |
36 | | - rm -rf ./fastadmin/static/js |
37 | | - rm -rf ./fastadmin/static/css |
38 | | - cp -rf ./frontend/build/static/js/ ./fastadmin/static/js/ |
39 | | - cp -rf ./frontend/build/static/css/ ./fastadmin/static/css/ |
40 | | - mv fastadmin/static/js/main*.js fastadmin/static/js/main.min.js |
41 | | - mv fastadmin/static/css/main*.css fastadmin/static/css/main.min.css |
42 | | - rm fastadmin/static/js/*.txt |
| 47 | + @exec rm -rf ./fastadmin/static/js |
| 48 | + @exec rm -rf ./fastadmin/static/css |
| 49 | + @exec cp -rf ./frontend/build/static/js/ ./fastadmin/static/js/ |
| 50 | + @exec cp -rf ./frontend/build/static/css/ ./fastadmin/static/css/ |
| 51 | + @exec mv fastadmin/static/js/main*.js fastadmin/static/js/main.min.js |
| 52 | + @exec mv fastadmin/static/css/main*.css fastadmin/static/css/main.min.css |
| 53 | + @exec rm fastadmin/static/js/*.txt |
43 | 54 |
|
44 | 55 | .PHONY: install |
45 | 56 | install: |
46 | | - poetry install --all-extras |
47 | | - make -C frontend install |
| 57 | + @exec poetry install --all-extras |
| 58 | + @exec make -C frontend install |
48 | 59 |
|
49 | 60 |
|
50 | 61 | .PHONY: docs |
51 | 62 | docs: |
52 | | - make -C docs build |
53 | | - cp ./docs/README.md ./README.md |
| 63 | + @exec make -C docs build |
54 | 64 |
|
55 | 65 |
|
56 | 66 | .PHONY: build |
57 | 67 | build: |
58 | | - make docs |
59 | | - make -C frontend build |
60 | | - make collectstatic |
| 68 | + @exec make docs |
| 69 | + @exec make -C frontend build |
| 70 | + @exec make collectstatic |
61 | 71 |
|
62 | 72 | .PHONY: pre-commit-install |
63 | 73 | pre-commit-install: |
64 | | - poetry run pip install pre-commit |
65 | | - poetry run pre-commit install |
| 74 | + @exec poetry run pip install pre-commit |
| 75 | + @exec poetry run pre-commit install |
66 | 76 |
|
67 | 77 | .PHONY: pre-commit |
68 | 78 | pre-commit: |
69 | | - poetry run pre-commit run --all-files |
| 79 | + @exec poetry run pre-commit run --all-files |
70 | 80 |
|
71 | 81 | .PHONY: push |
72 | | -push: |
73 | | - make fix |
74 | | - make lint |
75 | | - make test |
76 | | - make build |
77 | | - make pre-commit |
78 | | - git stash |
79 | | - git checkout main |
80 | | - git pull origin main |
81 | | - git stash pop |
82 | | - git add . |
83 | | - git commit -am "$(message)" |
84 | | - git push origin main |
| 82 | +pre-push: |
| 83 | + @exec make fix |
| 84 | + @exec make lint |
| 85 | + @exec make pre-commit-install |
| 86 | + @exec make pre-commit |
| 87 | + @exec make docs |
| 88 | + @exec make build |
0 commit comments