mirror of
				https://gitlab.nic.cz/turris/reforis/foris-js.git
				synced 2025-11-03 23:00:31 +01:00 
			
		
		
		
	Makefile: Divide phony targets & restructure recipes
This commit is contained in:
		
							
								
								
									
										49
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										49
									
								
								Makefile
									
									
									
									
									
								
							@@ -3,8 +3,6 @@
 | 
				
			|||||||
# This is free software, licensed under the GNU General Public License v3.
 | 
					# This is free software, licensed under the GNU General Public License v3.
 | 
				
			||||||
# See /LICENSE for more information.
 | 
					# See /LICENSE for more information.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.PHONY: all install-js watch-js build-js collect-files pack publish-beta publish-latest lint test test-js-update-snapshots create-messages update-messages docs docs-watch clean
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
PROJECT="Foris JS"
 | 
					PROJECT="Foris JS"
 | 
				
			||||||
# Retrieve Foris JS version from package.json 
 | 
					# Retrieve Foris JS version from package.json 
 | 
				
			||||||
VERSION= $(shell sed -En "s/.*version['\"]: ['\"](.+)['\"].*/\1/p" package.json)
 | 
					VERSION= $(shell sed -En "s/.*version['\"]: ['\"](.+)['\"].*/\1/p" package.json)
 | 
				
			||||||
@@ -15,6 +13,7 @@ DEV_PYTHON=python3
 | 
				
			|||||||
VENV_NAME?=venv
 | 
					VENV_NAME?=venv
 | 
				
			||||||
VENV_BIN=$(shell pwd)/$(VENV_NAME)/bin
 | 
					VENV_BIN=$(shell pwd)/$(VENV_NAME)/bin
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PHONY: all
 | 
				
			||||||
all:
 | 
					all:
 | 
				
			||||||
	@echo "make install-js"
 | 
						@echo "make install-js"
 | 
				
			||||||
	@echo "    Install dependencies"
 | 
						@echo "    Install dependencies"
 | 
				
			||||||
@@ -37,43 +36,89 @@ all:
 | 
				
			|||||||
	@echo "make clean"
 | 
						@echo "make clean"
 | 
				
			||||||
	@echo "    Remove python artifacts and virtualenv."
 | 
						@echo "    Remove python artifacts and virtualenv."
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Preparation
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PHONY: venv
 | 
				
			||||||
venv: $(VENV_NAME)/bin/activate
 | 
					venv: $(VENV_NAME)/bin/activate
 | 
				
			||||||
$(VENV_NAME)/bin/activate:
 | 
					$(VENV_NAME)/bin/activate:
 | 
				
			||||||
	test -d $(VENV_NAME) || $(DEV_PYTHON) -m virtualenv -p $(DEV_PYTHON) $(VENV_NAME)
 | 
						test -d $(VENV_NAME) || $(DEV_PYTHON) -m virtualenv -p $(DEV_PYTHON) $(VENV_NAME)
 | 
				
			||||||
	$(VENV_BIN)/$(DEV_PYTHON) -m pip install -r requirements.txt
 | 
						$(VENV_BIN)/$(DEV_PYTHON) -m pip install -r requirements.txt
 | 
				
			||||||
	touch $(VENV_NAME)/bin/activate
 | 
						touch $(VENV_NAME)/bin/activate
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Installation
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PHONY: install-js
 | 
				
			||||||
install-js: package.json
 | 
					install-js: package.json
 | 
				
			||||||
	npm install --save-dev
 | 
						npm install --save-dev
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Publishing
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PHONY: collect-files
 | 
				
			||||||
collect-files:
 | 
					collect-files:
 | 
				
			||||||
	sh scripts/collect_files.sh
 | 
						sh scripts/collect_files.sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PHONY: pack
 | 
				
			||||||
pack: collect-files
 | 
					pack: collect-files
 | 
				
			||||||
	cd dist && npm pack
 | 
						cd dist && npm pack
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PHONY: publish-beta
 | 
				
			||||||
publish-beta: collect-files
 | 
					publish-beta: collect-files
 | 
				
			||||||
	sh scripts/publish.sh beta
 | 
						sh scripts/publish.sh beta
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PHONY: publish-latest
 | 
				
			||||||
publish-latest: collect-files
 | 
					publish-latest: collect-files
 | 
				
			||||||
	sh scripts/publish.sh latest
 | 
						sh scripts/publish.sh latest
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Linting
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PHONY: lint
 | 
				
			||||||
lint:
 | 
					lint:
 | 
				
			||||||
	npm run lint
 | 
						npm run lint
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PHONY: lint-js-fix
 | 
				
			||||||
lint-js-fix:
 | 
					lint-js-fix:
 | 
				
			||||||
	npm run lint:fix
 | 
						npm run lint:fix
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Testing
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PHONY: test
 | 
				
			||||||
test:
 | 
					test:
 | 
				
			||||||
	npm test
 | 
						npm test
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PHONY: test-js-update-snapshots
 | 
				
			||||||
test-js-update-snapshots:
 | 
					test-js-update-snapshots:
 | 
				
			||||||
	npm test -- -u
 | 
						npm test -- -u
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Translations
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PHONY: create-messages
 | 
				
			||||||
create-messages: venv
 | 
					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)
 | 
						$(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
 | 
					update-messages: venv
 | 
				
			||||||
	$(VENV_BIN)/pybabel update -i ./translations/forisjs.pot -d ./translations -D forisjs --update-header-comment
 | 
						$(VENV_BIN)/pybabel update -i ./translations/forisjs.pot -d ./translations -D forisjs --update-header-comment
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Documentation
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PHONY: docs
 | 
				
			||||||
docs:
 | 
					docs:
 | 
				
			||||||
	npm run-script docs
 | 
						npm run-script docs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PHONY: docs-watch
 | 
				
			||||||
docs-watch:
 | 
					docs-watch:
 | 
				
			||||||
	npm run-script docs:watch
 | 
						npm run-script docs:watch
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Other
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PHONY: clean
 | 
				
			||||||
clean:
 | 
					clean:
 | 
				
			||||||
	rm -rf node_modules dist
 | 
						rm -rf node_modules dist
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user