workflow: made Makefile cross platform

This commit is contained in:
Roberto Tonino 2021-05-13 21:45:57 +02:00
parent 54cc112a47
commit 024d7e3998
1 changed files with 21 additions and 4 deletions

View File

@ -1,10 +1,27 @@
NODE_BIN ?= .\node_modules\.bin # Not including dev commands as they have issues on Window's Powershell.
# Fixing paths for different platforms
# https://stackoverflow.com/questions/4058840/makefile-that-distincts-between-windows-and-unix-like-systems
ifdef OS
RM = del /Q
FixPath = $(subst /,\,$1)
else
ifeq ($(shell uname), Linux)
RM = rm -f
FixPath = $1
endif
endif
SEP ?= '\'
# Stands for MODULES_BINARIES, abbreviated to pollute less possible the commands
M_B ?= $(call FixPath, ./node_modules/.bin/)
lint: lint:
$(NODE_BIN)\eslint ./src/** --fix $(M_B)eslint "./{src, tests}/**" --fix
test: test:
$(NODE_BIN)\jest $(M_B)jest
build: lint test build: lint test
$(NODE_BIN)\tsc $(M_B)tsc