2022-02-21 16:04:12 +01:00
|
|
|
# Copyright (C) 2019-2022 CZ.NIC z.s.p.o. (https://www.nic.cz/)
|
|
|
|
#
|
|
|
|
# This is free software, licensed under the GNU General Public License v3.
|
|
|
|
# See /LICENSE for more information.
|
|
|
|
|
|
|
|
PROJECT="Foris JS"
|
|
|
|
# Retrieve Foris JS version from package.json
|
|
|
|
VERSION= $(shell sed -En "s/.*version['\"]: ['\"](.+)['\"].*/\1/p" package.json)
|
|
|
|
COPYRIGHT_HOLDER="CZ.NIC, z.s.p.o. (https://www.nic.cz/)"
|
|
|
|
MSGID_BUGS_ADDRESS="tech.support@turris.cz"
|
|
|
|
|
2021-01-28 11:43:36 +01:00
|
|
|
DEV_PYTHON=python3
|
2019-11-14 11:28:25 +01:00
|
|
|
VENV_NAME?=venv
|
|
|
|
VENV_BIN=$(shell pwd)/$(VENV_NAME)/bin
|
|
|
|
|
2022-02-21 16:05:30 +01:00
|
|
|
.PHONY: all
|
2019-08-28 16:47:00 +02:00
|
|
|
all:
|
2019-09-10 10:30:42 +02:00
|
|
|
@echo "make install-js"
|
2022-02-21 16:07:45 +01:00
|
|
|
@echo " Install npm dependencies."
|
|
|
|
@echo "make lint"
|
|
|
|
@echo " Run linter on the project."
|
|
|
|
@echo "make test"
|
|
|
|
@echo " Run tests on the project."
|
|
|
|
@echo "make test-js-watch"
|
|
|
|
@echo " Run tests on the project in watch mode."
|
|
|
|
@echo "make test-js-update-snapshots"
|
|
|
|
@echo " Update snapshots."
|
2019-08-28 16:47:00 +02:00
|
|
|
@echo "make create-messages"
|
|
|
|
@echo " Create locale messages (.pot)."
|
|
|
|
@echo "make update-messages"
|
|
|
|
@echo " Update locale messages from .pot file."
|
2019-09-25 15:43:37 +02:00
|
|
|
@echo "make docs"
|
|
|
|
@echo " Build project documentation."
|
|
|
|
@echo "make docs-watch"
|
|
|
|
@echo " Start styleguidist server."
|
2019-08-28 16:47:00 +02:00
|
|
|
@echo "make clean"
|
|
|
|
@echo " Remove python artifacts and virtualenv."
|
|
|
|
|
2022-02-21 16:05:30 +01:00
|
|
|
|
|
|
|
# Preparation
|
|
|
|
|
|
|
|
.PHONY: venv
|
2019-11-14 11:28:25 +01:00
|
|
|
venv: $(VENV_NAME)/bin/activate
|
|
|
|
$(VENV_NAME)/bin/activate:
|
|
|
|
test -d $(VENV_NAME) || $(DEV_PYTHON) -m virtualenv -p $(DEV_PYTHON) $(VENV_NAME)
|
|
|
|
$(VENV_BIN)/$(DEV_PYTHON) -m pip install -r requirements.txt
|
|
|
|
touch $(VENV_NAME)/bin/activate
|
|
|
|
|
2022-02-21 16:05:30 +01:00
|
|
|
|
|
|
|
# Installation
|
|
|
|
|
|
|
|
.PHONY: install-js
|
2019-09-10 10:30:42 +02:00
|
|
|
install-js: package.json
|
|
|
|
npm install --save-dev
|
|
|
|
|
2022-02-21 16:05:30 +01:00
|
|
|
|
|
|
|
# Publishing
|
|
|
|
|
|
|
|
.PHONY: collect-files
|
2019-11-01 10:28:28 +01:00
|
|
|
collect-files:
|
|
|
|
sh scripts/collect_files.sh
|
2022-02-21 16:05:30 +01:00
|
|
|
|
|
|
|
.PHONY: pack
|
2019-11-01 10:28:28 +01:00
|
|
|
pack: collect-files
|
|
|
|
cd dist && npm pack
|
2022-02-21 16:05:30 +01:00
|
|
|
|
|
|
|
.PHONY: publish-beta
|
2019-11-01 10:28:28 +01:00
|
|
|
publish-beta: collect-files
|
|
|
|
sh scripts/publish.sh beta
|
2022-02-21 16:05:30 +01:00
|
|
|
|
|
|
|
.PHONY: publish-latest
|
2019-11-01 10:28:28 +01:00
|
|
|
publish-latest: collect-files
|
|
|
|
sh scripts/publish.sh latest
|
|
|
|
|
2022-02-21 16:05:30 +01:00
|
|
|
|
|
|
|
# Linting
|
|
|
|
|
|
|
|
.PHONY: lint
|
2019-09-25 13:56:08 +02:00
|
|
|
lint:
|
2019-09-10 10:30:42 +02:00
|
|
|
npm run lint
|
2022-02-21 16:05:30 +01:00
|
|
|
|
|
|
|
.PHONY: lint-js-fix
|
2020-01-09 11:25:29 +01:00
|
|
|
lint-js-fix:
|
|
|
|
npm run lint:fix
|
2019-09-10 10:30:42 +02:00
|
|
|
|
2022-02-21 16:05:30 +01:00
|
|
|
|
|
|
|
# Testing
|
|
|
|
|
|
|
|
.PHONY: test
|
2019-09-25 13:56:08 +02:00
|
|
|
test:
|
2019-09-10 10:30:42 +02:00
|
|
|
npm test
|
2022-02-21 16:05:30 +01:00
|
|
|
|
2022-02-21 16:06:05 +01:00
|
|
|
.PHONY: test-js-watch
|
|
|
|
test-js-watch:
|
|
|
|
cd $(JS_DIR); npm test -- --watch
|
|
|
|
|
2022-02-21 16:05:30 +01:00
|
|
|
.PHONY: test-js-update-snapshots
|
2019-10-24 10:12:39 +02:00
|
|
|
test-js-update-snapshots:
|
|
|
|
npm test -- -u
|
2022-02-10 15:59:07 +01:00
|
|
|
test-js-watch:
|
|
|
|
npm test -- --watch
|
2019-09-10 10:30:42 +02:00
|
|
|
|
2022-02-21 16:05:30 +01:00
|
|
|
|
|
|
|
# Translations
|
|
|
|
|
|
|
|
.PHONY: create-messages
|
2019-11-14 11:28:25 +01:00
|
|
|
create-messages: venv
|
2022-02-21 16:04:12 +01:00
|
|
|
$(VENV_BIN)/pybabel extract -F babel.cfg -o ./translations/forisjs.pot . --project=$(PROJECT) --version=$(VERSION) --copyright-holder=$(COPYRIGHT_HOLDER) --msgid-bugs-address=$(MSGID_BUGS_ADDRESS)
|
2022-02-21 16:05:30 +01:00
|
|
|
|
|
|
|
.PHONY: update-messages
|
2019-11-14 11:28:25 +01:00
|
|
|
update-messages: venv
|
2022-02-21 16:04:12 +01:00
|
|
|
$(VENV_BIN)/pybabel update -i ./translations/forisjs.pot -d ./translations -D forisjs --update-header-comment
|
2019-08-28 16:47:00 +02:00
|
|
|
|
2022-02-21 16:05:30 +01:00
|
|
|
|
|
|
|
# Documentation
|
|
|
|
|
|
|
|
.PHONY: docs
|
2019-09-25 15:43:37 +02:00
|
|
|
docs:
|
|
|
|
npm run-script docs
|
2022-02-21 16:05:30 +01:00
|
|
|
|
|
|
|
.PHONY: docs-watch
|
2019-09-25 15:43:37 +02:00
|
|
|
docs-watch:
|
|
|
|
npm run-script docs:watch
|
|
|
|
|
2022-02-21 16:05:30 +01:00
|
|
|
|
|
|
|
# Other
|
|
|
|
|
|
|
|
.PHONY: clean
|
2019-08-28 16:47:00 +02:00
|
|
|
clean:
|
|
|
|
rm -rf node_modules dist
|