Commit 96217142 authored by Doris Tam's avatar Doris Tam 🌷 Committed by Robert Lyon
Browse files

Bug 1988096: Add nvm support in Makefile + .nvmrc

Note: the version in .nvmrc may need to be updated for older/newer versions of Mahara

Change-Id: I5c273bc8d66768352ff0a112bd09bbee24066b25
parent 5a2ec9c3
Loading
Loading
Loading
Loading

.nvmrc

0 → 100644
+1 −0
Original line number Diff line number Diff line
8
 No newline at end of file
+14 −3
Original line number Diff line number Diff line
@@ -32,6 +32,12 @@ CCEND=$(shell echo "\033[0m")

all: css

nvmsh := $(shell ls -l ${HOME}/.nvm/nvm.sh 2>/dev/null)

define nvm_check
	. ${HOME}/.nvm/nvm.sh && nvm install
endef

production = true
css:
	$(info Rebuilding CSS on host)
@@ -44,12 +50,17 @@ endif
ifeq (, $(shell which gulp))
	$(error ERROR: Can't find the "gulp" executable. Try doing "sudo npm install -g gulp")
endif
ifndef nvmsh
	$(error ERROR: Can't find the "nvm" executable at path ${HOME}/.nvm/nvm.sh - either install or make path executable)
endif

ifndef npmsetup
	npm install
	@echo "System node version: " && node -v;
	@$(nvm_check) && nvm ls --no-alias
	@$(nvm_check) && npm install
endif
	@echo "Building CSS..."
	@if gulp css --production $(production) ; then echo "Done!"; else npm install; gulp css --production $(production);  fi

	@if $(nvm_check) && npm rebuild node-sass && gulp css --production $(production) ; then echo "Done!"; else $(nvm_check) && npm rebuild node-sass && npm install; gulp css --production $(production);  fi
clean-css:
	find ./htdocs/theme/* -maxdepth 1 -name "style" -type d -exec rm -Rf {} \;