aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorJoris2020-02-13 18:54:18 +0100
committerJoris2020-02-15 10:59:25 +0100
commit7a01b001ccc4a7bda3da92486903540e3f9754fd (patch)
treefbe269faa319fd7f21049612f8a62c0c169f369e /Makefile
parent8328c11ac6706e3adf9b09877c02897132b8927a (diff)
downloadcooking-7a01b001ccc4a7bda3da92486903540e3f9754fd.tar.gz
cooking-7a01b001ccc4a7bda3da92486903540e3f9754fd.tar.bz2
cooking-7a01b001ccc4a7bda3da92486903540e3f9754fd.zip
Set up bucklescript
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile51
1 files changed, 15 insertions, 36 deletions
diff --git a/Makefile b/Makefile
index 21b2356..240bde1 100644
--- a/Makefile
+++ b/Makefile
@@ -1,45 +1,24 @@
-BUILD_DIRECTORY = ".build"
+export PATH := node_modules/.bin:$(PATH)
build: static/main.js
@echo "Building site"
- zola build
+ @zola build
-static/main.js: $(shell find src)
+static/main.js: node_modules $(shell find src \( -type d -o \( -type f -a -regex ".*\.ml" \) \))
@echo "Building $@"
-ifeq ($(DEV_MODE), true)
- @tsc \
- --strict \
- --noUnusedLocals \
- --noUnusedParameters \
- --noImplicitReturns \
- --outDir $(BUILD_DIRECTORY) \
- --module es2015 \
- src/main.ts
- @rollup \
- --input $(BUILD_DIRECTORY)/main.js \
- --file $@ \
- --format iife
-else
- @tsc \
- --strict \
- --noUnusedLocals \
- --noUnusedParameters \
- --noImplicitReturns \
- --outDir $(BUILD_DIRECTORY) \
- --module es2015 \
- src/main.ts
- @rollup \
- --input $(BUILD_DIRECTORY)/main.js \
- --file $@ \
- --format iife
- @terser $@ \
- --output $@ \
- --compress \
- --mangle
-endif
+ @bsb -make-world
+ @rollup --config rollup.config.js
+ @terser $@ --output $@ --compress --mangle
+
+node_modules: package.json
+ @bsb -init init
+ @mv init/node_modules .
+ @rm -rf init
+ @npm install
+ @touch -c node_modules
clean:
@echo "Cleaning"
- @rm -rf $(BUILD_DIRECTORY)
- @rm -rf public
@rm -f static/main.js
+ @rm -rf node_modules lib
+ @find src -name '*.bs.js' -exec rm {} \;