-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathMakefile
More file actions
74 lines (58 loc) · 2.5 KB
/
Copy pathMakefile
File metadata and controls
74 lines (58 loc) · 2.5 KB
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
VENV_BIN = python3 -m venv
VENV_DIR ?= .venv
VENV_ACTIVATE = $(VENV_DIR)/bin/activate
VENV_RUN = . $(VENV_ACTIVATE)
TEST_PATH ?= tests
PIP_CMD ?= pip
FRONTEND_FOLDER = aws_proxy/frontend
COREPACK_EXISTS := $(shell command -v corepack)
YARN_EXISTS := $(shell command -v yarn)
usage: ## Show this help
@grep -Fh "##" $(MAKEFILE_LIST) | grep -Fv fgrep | sed -e 's/:.*##\s*/##/g' | awk -F'##' '{ printf "%-25s %s\n", $$1, $$2 }'
clean: ## Clean up
rm -rf .venv/
rm -rf build/
rm -rf .eggs/
rm -rf *.egg-info/
format: ## Run ruff to format the whole codebase
($(VENV_RUN); python -m ruff format .; python -m ruff check --output-format=full --fix .)
lint: ## Run code linter to check code style
($(VENV_RUN); python -m ruff check --output-format=full . && python -m ruff format --check .)
test: ## Run tests
$(VENV_RUN); python -m pytest $(PYTEST_ARGS) $(TEST_PATH)
entrypoints: build-frontend ## Generate plugin entrypoints for Python package
$(VENV_RUN); python -m plux entrypoints
build: build-frontend entrypoints ## Build the extension
$(VENV_RUN); python -m build --no-isolation . --outdir build
@# make sure that the entrypoints are contained in the dist folder and are non-empty
@test -s localstack_extension_aws_proxy.egg-info/entry_points.txt || (echo "Entrypoints were not correctly created! Aborting!" && exit 1)
enable: $(wildcard ./build/localstack_extension_aws_proxy-*.tar.gz) ## Enable the extension in LocalStack
$(VENV_RUN); \
pip uninstall --yes localstack-extension-aws-proxy; \
localstack extensions -v install file://$?
publish: clean-dist venv dist
$(VENV_RUN); pip install --upgrade twine; twine upload dist/*
check-frontend-deps:
@if [ -z "$(YARN_EXISTS)" ]; then \
npm install --global yarn; \
fi
@if [ -z "$(COREPACK_EXISTS)" ]; then \
npm install -g corepack; \
fi
install-frontend: check-frontend-deps ## Install dependencies of the frontend
cd $(FRONTEND_FOLDER) && yarn install
build-frontend: # Build the React app
@if [ ! -d "$(FRONTEND_FOLDER)/node_modules" ]; then \
$(MAKE) install-frontend; \
fi
cd $(FRONTEND_FOLDER); rm -rf build && NODE_ENV=prod npm run build
start-frontend: ## Start the frontend in dev mode (hot reload)
cd $(FRONTEND_FOLDER); yarn start
install: install-frontend ## Install dependencies
test -d .venv || $(VENV_BIN) .venv
$(VENV_RUN); pip install -e .
$(VENV_RUN); pip install -e .[test]
touch $(VENV_DIR)/bin/activate
clean-dist: clean
rm -rf dist/
.PHONY: build clean clean-dist dist install publish test