From 024d7e3998a7311d13ed62a3c5fc2220afc984a2 Mon Sep 17 00:00:00 2001 From: Roberto Tonino Date: Thu, 13 May 2021 21:45:57 +0200 Subject: [PATCH] workflow: made Makefile cross platform --- server/Makefile | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/server/Makefile b/server/Makefile index 0e0347f..1ffbc5e 100644 --- a/server/Makefile +++ b/server/Makefile @@ -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: - $(NODE_BIN)\eslint ./src/** --fix + $(M_B)eslint "./{src, tests}/**" --fix test: - $(NODE_BIN)\jest + $(M_B)jest build: lint test - $(NODE_BIN)\tsc + $(M_B)tsc