dpaste/Makefile

74 lines
2.2 KiB
Makefile
Raw Permalink Normal View History

#
# Makefile that handles all the static file compilation and
# adds some helper tools for daily development.
#
SHELL=/bin/bash -eu -o pipefail
define N # newline
endef
.PHONY: test
test: ## Run Django tests
docker-compose run --rm app pytest dpaste/
.PHONY: code-cleanup
code-cleanup: ## Black and isort the Python codebase
2019-12-08 22:47:39 +11:00
autoflake --remove-all-unused-imports --ignore-init-module-imports --remove-unused-variables \
2019-12-09 05:44:07 +11:00
--in-place --exclude "**/migrations/*,dpaste/settings/local.py" -r dpaste
isort -rc dpaste
2020-01-08 23:19:52 +11:00
black --exclude='/(migrations)/' dpaste
2019-12-08 22:47:39 +11:00
.PHONY: docs
docs: ## Compile the documentation
docker-compose run --rm app sphinx-build docs docs/_build/html
.PHONY: docs-watch
2019-12-08 22:47:39 +11:00
docs-watch: ## Compile the documentation and watch for changes
docker-compose run -p 8000:8000 --rm app sphinx-autobuild --host 0 --port 8000 docs docs/_build/html
.PHONY: css
css: ## Compile SCSS files
npx sass --no-source-map --style=compressed client/scss/dpaste.scss:dpaste/static/dpaste.css
.PHONY: css-watch
2023-02-18 06:29:43 +11:00
css-watch: ## Compile SCSS files (watch stylesheets and recompile when they change)
2019-12-09 08:57:00 +11:00
npx sass --watch client/scss/dpaste.scss:dpaste/static/dpaste.css
.PHONY: js
js: ## Compile JS files
npx uglifyjs --compress="drop_console=true,ecma=6" --mangle="toplevel" --output=dpaste/static/dpaste.js client/js/dpaste.js
2019-12-08 20:29:33 +11:00
.PHONY: release-docker
release-docker:
set -ex
2019-12-19 03:47:42 +11:00
rm -f .coverage
pip-compile --dry-run setup.py
2019-12-08 20:29:33 +11:00
docker build --build-arg BUILD_EXTRAS=production -t barttc/dpaste:latest .
2019-12-19 03:55:08 +11:00
docker run --rm barttc/dpaste:latest pytest dpaste/
2019-12-08 20:29:33 +11:00
@echo -e "\n\n💫 All fine. Now do: docker push barttc/dpaste:latest"
2019-12-08 22:47:39 +11:00
.PHONY: release-pypi
release-pypi:
set -ex
2019-12-19 03:47:42 +11:00
rm -f .coverage
pip-compile --dry-run setup.py
docker-compose build
2019-12-08 22:47:39 +11:00
docker-compose run --rm app pytest dpaste/
rm -rf ./node_modules
npm ci
make css
make js
python setup.py sdist && python setup.py bdist_wheel --universal
@echo -e "\n\n💫 All fine. Now do: twine upload dist/* --sign"
.PHONY: help
help:
@echo -e "Available make commands:"
@echo -e ""
@echo -e "$$(grep -hE '^\S+:.*##' $(MAKEFILE_LIST) | sort | sed -e 's/:.*##\s*/:/' -e 's/^\(.\+\):\(.*\)/\\x1b[36m\1\\x1b[m:\2/' | column -c2 -t -s :)"
.DEFAULT_GOAL := start