From 08d8c2c56254ad001aaf89fc6fefa1ef59b66a6d Mon Sep 17 00:00:00 2001 From: Alexander Polynomdivision Date: Thu, 20 Sep 2018 18:44:46 +0200 Subject: [PATCH] build: Write Makefiles --- Makefile | 6 ++++++ backend/Makefile | 6 ++++++ frontend/Makefile | 24 ++++++++++++++++++++++++ 3 files changed, 36 insertions(+) create mode 100644 Makefile create mode 100644 backend/Makefile create mode 100644 frontend/Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9c16b91 --- /dev/null +++ b/Makefile @@ -0,0 +1,6 @@ +.PHONY: frontend +frontend: + $(MAKE) -C frontend/ build + +backend: + $(MAKE) -C backend/ build diff --git a/backend/Makefile b/backend/Makefile new file mode 100644 index 0000000..e80f48e --- /dev/null +++ b/backend/Makefile @@ -0,0 +1,6 @@ +node_modules: + npm install + +.PHONY: build +build: + npm run-script build diff --git a/frontend/Makefile b/frontend/Makefile new file mode 100644 index 0000000..9ce55a6 --- /dev/null +++ b/frontend/Makefile @@ -0,0 +1,24 @@ +dist/minified: + mkdir -p dist/minified + +UGLIFYJS := ./node_modules/.bin/uglifyjs +# $1: The file to minify +define minify + $(shell ${UGLIFYJS} --mangle --compress -o "./dist/minified/$(notdir $1)" -- $1) +endef + +node_modules: + npm install + +.PHONY: watch +watch: node_modules + npm start + +.PHONY: build +build: node_modules dist/minified + @echo Building with parcel + ./node_modules/.bin/parcel build + + @echo Minifying + $(foreach file, $(wildcard dist/*.js), $(call minify, $(file))) + $(shell ls -lah ./dist/minified)