2
2
.ONESHELL :
3
3
ENV_PREFIX =$(shell python3 -c "if __import__('pathlib') .Path('.venv/bin/pip').exists(): print('.venv/bin/')")
4
4
USING_POETRY =$(shell grep "tool.poetry" pyproject.toml && echo "yes")
5
- USING_DOCKER =$(shell grep "USE_DOCKER=true" .env && echo "yes")
6
- USING_PNPM =$(shell python3 -c "if __import__('pathlib') .Path('pnpm-lock.yaml').exists(): print('yes')")
7
- USING_YARN =$(shell python3 -c "if __import__('pathlib') .Path('yarn.lock').exists(): print('yes')")
8
5
USING_NPM =$(shell python3 -c "if __import__('pathlib') .Path('package-lock.json').exists(): print('yes')")
9
6
VENV_EXISTS =$(shell python3 -c "if __import__('pathlib') .Path('.venv/bin/activate').exists(): print('yes')")
10
7
NODE_MODULES_EXISTS =$(shell python3 -c "if __import__('pathlib') .Path('node_modules').exists(): print('yes')")
11
- PYTHON_PACKAGES =$(shell if poetry --version > /dev/null; then poetry export -f requirements.txt --without-hashes |cut -d'=' -f1 |cut -d ' ' -f1; fi)
12
8
VERSION := $(shell grep -m 1 version pyproject.toml | tr -s ' ' | tr -d '"' | tr -d "'" | cut -d' ' -f3)
13
9
SRC_DIR =src
14
10
BUILD_DIR =dist
@@ -20,9 +16,6 @@ ifndef VERBOSE
20
16
endif
21
17
22
18
23
- REPO_INFO ?= $(shell git config --get remote.origin.url)
24
- COMMIT_SHA ?= git-$(shell git rev-parse --short HEAD)
25
-
26
19
help : # # Display this help
27
20
@awk ' BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST )
28
21
@@ -32,8 +25,6 @@ upgrade: ## Upgrade all dependencies to the latest stable versions
32
25
@if [ " $( USING_POETRY) " ]; then poetry update; fi
33
26
@echo " Python Dependencies Updated"
34
27
@if [ " $( USING_NPM) " ]; then npm upgrade --latest; fi
35
- @if [ " $( USING_YARN) " ]; then yarn upgrade; fi
36
- @if [ " $( USING_PNPM) " ]; then pnpm upgrade --latest; fi
37
28
@echo " Node Dependencies Updated"
38
29
$(ENV_PREFIX ) pre-commit autoupdate
39
30
@echo " Updated Pre-commit"
@@ -44,10 +35,8 @@ install: ## Install the project in dev mode.
44
35
@if [ " $( VENV_EXISTS) " ]; then echo " Removing existing virtual environment" ; fi
45
36
@if [ " $( NODE_MODULES_EXISTS) " ]; then echo " Removing existing node environment" ; fi
46
37
if [ " $( VENV_EXISTS) " ]; then rm -Rf .venv; fi
47
- if [ " $( USING_POETRY) " ]; then poetry config virtualenvs.in-project true --local && poetry config virtualenvs.options.always-copy true --local && python3 -m venv --copies .venv && source .venv/bin/activate && .venv/bin/pip install -U wheel setuptools cython pip && poetry install --with lint,dev,docs && mkdir -p {./src/app/domain/web/public,./src/app/domain/web/resources}; fi
48
- if [ " $( USING_NPM) " ]; then npm ci && npm run build; fi
49
- if [ " $( USING_YARN) " ]; then yarn install && yarn run build; fi
50
- if [ " $( USING_PNPM) " ]; then pnpm install && pnpm run build; fi
38
+ if [ " $( USING_POETRY) " ]; then poetry config virtualenvs.in-project true --local && poetry config virtualenvs.options.always-copy true --local && python3 -m venv --copies .venv && source .venv/bin/activate && .venv/bin/pip install -U wheel setuptools cython pip && poetry install --with lint,dev,docs; fi
39
+ if [ " $( USING_NPM) " ]; then npm ci; fi
51
40
@echo " => Install complete. ** If you want to re-install re-run 'make install'"
52
41
53
42
@@ -60,20 +49,20 @@ migrations: ## Generate database migrations
60
49
.PHONY : migrate
61
50
migrate : # # Generate database migrations
62
51
@echo " ATTENTION: Will apply all database migrations."
63
- @env PYTHONPATH=src $(ENV_PREFIX ) / app database upgrade-database
52
+ @env PYTHONPATH=src $(ENV_PREFIX ) app database upgrade-database
64
53
65
54
.PHONY : squash-migrations
66
55
squash-migrations : # # Generate database migrations
67
56
@echo " ATTENTION: This operation will wipe all migrations and recreate from an empty state."
68
57
@env PYTHONPATH=src $(ENV_PREFIX ) app database purge-database --no-prompt
69
58
rm -Rf src/app/lib/db/migrations/versions/* .py
70
59
@while [ -z " $$ MIGRATION_MESSAGE" ]; do read -r -p " Initial migration message: " MIGRATION_MESSAGE; done ;
71
- @env PYTHONPATH=src $(ENV_PREFIX ) / alembic -c src/app/lib/db/alembic.ini revision --autogenerate -m " $$ {MIGRATION_MESSAGE}"
60
+ @env PYTHONPATH=src $(ENV_PREFIX ) alembic -c src/app/lib/db/alembic.ini revision --autogenerate -m " $$ {MIGRATION_MESSAGE}"
72
61
73
62
74
63
.PHONY : build
75
64
build :
76
- if [ " $( USING_NPM ) " ] ; then npm run build ; fi
65
+ @echo " => Building package... "
77
66
if [ " $( USING_POETRY) " ]; then poetry build; fi
78
67
79
68
.PHONY : test
0 commit comments