build: Write Makefiles

This commit is contained in:
Alexander Polynomdivision 2018-09-20 18:44:46 +02:00
parent 909149fdc7
commit 08d8c2c562
3 changed files with 36 additions and 0 deletions

6
Makefile Normal file
View File

@ -0,0 +1,6 @@
.PHONY: frontend
frontend:
$(MAKE) -C frontend/ build
backend:
$(MAKE) -C backend/ build

6
backend/Makefile Normal file
View File

@ -0,0 +1,6 @@
node_modules:
npm install
.PHONY: build
build:
npm run-script build

24
frontend/Makefile Normal file
View File

@ -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)