-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
129 lines (94 loc) · 2.69 KB
/
Makefile
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# 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="[email protected]"
DEV_PYTHON=python3
VENV_NAME?=venv
JS_DIR=js
VENV_BIN=$(shell pwd)/$(VENV_NAME)/bin
.PHONY: all
all:
@echo "make install-js"
@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."
@echo "make create-messages"
@echo " Create locale messages (.pot)."
@echo "make update-messages"
@echo " Update locale messages from .pot file."
@echo "make docs"
@echo " Build project documentation."
@echo "make docs-watch"
@echo " Start styleguidist server."
@echo "make clean"
@echo " Remove python artifacts and virtualenv."
# Preparation
.PHONY: venv
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
# Installation
.PHONY: install-js
install-js: package.json
npm install --save-dev
# Publishing
.PHONY: collect-files
collect-files:
sh scripts/collect_files.sh
.PHONY: pack
pack: collect-files
cd dist && npm pack
.PHONY: publish-beta
publish-beta: collect-files
sh scripts/publish.sh beta
.PHONY: publish-latest
publish-latest: collect-files
sh scripts/publish.sh latest
# Linting
.PHONY: lint
lint:
npm run lint
.PHONY: lint-js-fix
lint-js-fix:
npm run lint:fix
# Testing
.PHONY: test
test:
npm test
.PHONY: test-js-watch
test-js-watch:
cd $(JS_DIR); npm test -- --watch
.PHONY: test-js-update-snapshots
test-js-update-snapshots:
npm test -- -u
# Translations
.PHONY: create-messages
create-messages: venv
$(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)
.PHONY: update-messages
update-messages: venv
$(VENV_BIN)/pybabel update -i ./translations/forisjs.pot -d ./translations -D forisjs --update-header-comment
# Documentation
.PHONY: docs
docs:
npm run-script docs
.PHONY: docs-watch
docs-watch:
npm run-script docs:watch
# Other
.PHONY: clean
clean:
rm -rf node_modules dist