umap/Makefile

134 lines
3.9 KiB
Makefile
Raw Normal View History

.DEFAULT_GOAL := help
.PHONY: install
install: ## Install the dependencies
python3 -m pip install --upgrade pip
python3 -m pip install -e .
.PHONY: develop
develop: ## Install the test and dev dependencies
python3 -m pip install -e .[test,dev]
playwright install
.PHONY: format
format: ## Format the code and templates files
2024-03-25 13:27:57 -05:00
-djlint umap/templates --reformat
-isort --profile black umap/
-ruff format --target-version=py310 umap/
2023-06-20 08:40:32 -05:00
.PHONY: lint
lint: ## Lint the code and template files
2024-03-25 13:27:57 -05:00
npx eslint umap/static/umap/
djlint umap/templates --lint
isort --check --profile black umap/
ruff format --check --target-version=py310 umap/
2024-01-29 12:36:05 -06:00
vermin --no-tips --violations -t=3.10- umap/
docs: ## Compile the docs
mkdocs build
2023-06-20 09:00:02 -05:00
.PHONY: version
version: ## Display the current version
@hatch version
2023-08-15 09:49:04 -05:00
.PHONY: patch
patch: ## Bump the current version to a new patch one
@hatch version fix
2023-08-15 09:49:04 -05:00
.PHONY: minor
minor: ## Bump the current version to a new minor one
@hatch version minor
.PHONY: docker
docker: ## Create a new Docker image and publish it
$(eval VERSION=$(shell hatch version))
@echo "Version to build: ${VERSION}"
docker build -t umap/umap:${VERSION} .
docker push umap/umap:${VERSION}
2023-06-17 08:36:50 -05:00
.PHONY: build
build: ## Build the Python package before release
2023-07-01 10:44:24 -05:00
@hatch build --clean
2023-06-17 08:36:50 -05:00
2023-06-17 08:50:36 -05:00
.PHONY: publish
publish: ## Publish the Python package to Pypi
@hatch publish
make clean
test: testpy testjs
testpy:
pytest -xv umap/tests/
test-integration:
pytest -xv umap/tests/integration/
clean:
rm -f dist/*
rm -rf build/*
2018-05-19 04:12:19 -05:00
compilemessages:
2018-09-08 10:01:22 -05:00
umap compilemessages
2018-07-07 16:03:10 -05:00
umap generate_js_locale
2018-09-08 10:01:22 -05:00
messages:
cd umap && umap makemessages -l en
2024-03-25 07:52:48 -05:00
node node_modules/leaflet-i18n/bin/i18n.js --dir_path=umap/static/umap/js/ --dir_path=umap/static/umap/vendors/measurable/ --locale_dir_path=umap/static/umap/locale/ --locale_codes=en --mode=json --clean --default_values --expressions=_,translate
2018-07-07 16:15:26 -05:00
vendors:
npm run vendors
2018-06-02 07:44:59 -05:00
installjs:
npm install
testjs: node_modules
node_modules/mocha/bin/mocha.js umap/static/umap/unittests/
tx_push:
tx push -s
tx_pull:
tx pull
2023-05-12 12:57:03 -05:00
jsdir = umap/static/umap/js/
filepath = "${jsdir}*.js"
.PHONY: pretty
2023-05-12 12:57:03 -05:00
pretty: ## Apply PrettierJS to all JS files (or specified `filepath`)
./node_modules/prettier/bin-prettier.js --write ${filepath}
.PHONY: lebab
lebab: ## Convert JS `filepath` to modern syntax with Lebab, then prettify
./node_modules/lebab/bin/index.js --replace ${filepath} --transform arrow,arrow-return
Apply Lebab for let/const conversions As far as I understand, it default to `let` in these cases because the tool cannot figure out if a `const` is possible. It has to be checked manually: ``` ./node_modules/lebab/bin/index.js --replace "umap/static/umap/js/*.js" --transform let umap/static/umap/js/umap.xhr.js: 228: warning Unable to transform var (let) umap/static/umap/js/umap.ui.js: 83: warning Unable to transform var (let) umap/static/umap/js/umap.slideshow.js: 15: warning Unable to transform var (let) 83: warning Unable to transform var (let) umap/static/umap/js/umap.popup.js: 100: warning Unable to transform var (let) umap/static/umap/js/umap.permissions.js: 14: warning Unable to transform var (let) umap/static/umap/js/umap.layer.js: 195: warning Unable to transform var (let) 436: warning Unable to transform var (let) 568: warning Unable to transform var (let) 584: warning Unable to transform var (let) 989: warning Unable to transform var (let) 1088: warning Unable to transform var (let) 1098: warning Unable to transform var (let) umap/static/umap/js/umap.js: 124: warning Unable to transform var (let) 223: warning Unable to transform var (let) 343: warning Unable to transform var (let) 376: warning Unable to transform var (let) 406: warning Unable to transform var (let) 849: warning Unable to transform var (let) 732: warning Unable to transform var (let) 948: warning Unable to transform var (let) 959: warning Unable to transform var (let) 878: warning Unable to transform var (let) 1085: warning Unable to transform var (let) umap/static/umap/js/umap.icon.js: 145: warning Unable to transform var (let) 184: warning Unable to transform var (let) umap/static/umap/js/umap.forms.js: 453: warning Unable to transform var (let) umap/static/umap/js/umap.features.js: 15: warning Unable to transform var (let) 101: warning Unable to transform var (let) 143: warning Unable to transform var (let) 373: warning Unable to transform var (let) 429: warning Unable to transform var (let) 890: warning Unable to transform var (let) 949: warning Unable to transform var (let) umap/static/umap/js/umap.core.js: 149: warning Unable to transform var (let) 175: warning Unable to transform var (let) umap/static/umap/js/umap.controls.js: 665: warning Unable to transform var (let) 876: warning Unable to transform var (let) 1249: warning Unable to transform var (let) ```
2023-05-22 09:13:45 -05:00
./node_modules/lebab/bin/index.js --replace ${filepath} --transform let
2023-05-30 13:53:53 -05:00
./node_modules/lebab/bin/index.js --replace ${filepath} --transform template
$(MAKE) pretty filepath=${filepath}
.PHONY: lebab-all
lebab-all: $(jsdir)* ## Convert all JS files to modern syntax with Lebab + prettify
for file in $^ ; do $(MAKE) lebab filepath=$${file}; done
2023-06-27 07:01:04 -05:00
icons:
scour -i umap/static/umap/img/source/24.svg -o umap/static/umap/img/24.svg --strip-xml-prolog --enable-comment-stripping
2023-06-28 00:33:34 -05:00
scour -i umap/static/umap/img/source/24-white.svg -o umap/static/umap/img/24-white.svg --strip-xml-prolog --enable-comment-stripping
scour -i umap/static/umap/img/source/16.svg -o umap/static/umap/img/16.svg --strip-xml-prolog --enable-comment-stripping
scour -i umap/static/umap/img/source/16-white.svg -o umap/static/umap/img/16-white.svg --strip-xml-prolog --enable-comment-stripping
2023-06-27 07:01:04 -05:00
.PHONY: help
help:
@python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
# See https://daniel.feldroy.com/posts/autodocumenting-makefiles
define PRINT_HELP_PYSCRIPT # start of Python section
import re, sys
output = []
# Loop through the lines in this file
for line in sys.stdin:
# if the line has a command and a comment start with
# two pound signs, add it to the output
match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
if match:
target, help = match.groups()
output.append("\033[36m%-20s\033[0m %s" % (target, help))
# Sort the output in alphanumeric order
output.sort()
# Print the help result
print('\n'.join(output))
endef
export PRINT_HELP_PYSCRIPT # End of python section