Clean up the build process

This commit is contained in:
Aaron Fischer 2017-08-28 22:22:36 +02:00
parent 290879dafe
commit e08c4b2bb3
3 changed files with 19 additions and 10 deletions

19
Makefile Executable file
View file

@ -0,0 +1,19 @@
SHELL:=/bin/bash
all: build stat clean
build:
rm -f muri-src.zip muri.zip src/muri.min.js
uglifyjs --compress --mangle --no-dead-code --output src/muri.min.js src/*.js
(cd src && zip -q -9 ../muri.zip index.html muri.min.js assets/* assets/**/* vendor/*.min.js)
(cd src && zip -q -9 ../muri-src.zip ./* ./**/* ./**/**/* ../README)
.ONESHELL:
stat: build
@filesize=`stat --printf="%s" muri.zip` && \
echo $$filesize "byte ->" $$((100*$$filesize/13000)) "%"
clean:
rm -f src/muri.min.js muri.zip
.PHONY: build stat clean all

View file

@ -1,9 +0,0 @@
#!/usr/bin/env bash
rm -f muri-src.zip muri.zip src/muri.min.js
uglifyjs --compress --mangle --no-dead-code --output src/muri.min.js src/*.js
(cd src && zip -q -9 ../muri.zip index.html muri.min.js assets/* assets/**/* vendor/*.min.js)
(cd src && zip -q -9 ../muri-src.zip ./* ./**/* ./**/**/* ../README)
filesize=`stat --printf="%s" muri.zip`
echo $filesize "byte ->" $((100*$filesize/13000)) "%"

1
src/muri.min.js vendored
View file

@ -1 +0,0 @@
"use strict";var muri=function(){kontra.init("js13k-2017"),kontra.assets.imagePath="assets/images";var t={},r=function(t){return kontra.sprite({x:0,y:0,image:kontra.assets.images["room_"+t]})};return t.modules=[],t.start=function(){kontra.assets.load("player.png","room_stasis_dark.png","room_stasis.png").then(function(){document.getElementById("loading").style.display="none",null===kontra.store.get("current-room")&&kontra.store.set("current-room","stasis_dark");var s={stasis_dark:r("stasis_dark"),stasis:r("stasis")};kontra.gameLoop({update:function(){var r=kontra.store.get("current-room");s[r].update();for(m in t.modules)m.update()},render:function(){var r=kontra.store.get("current-room");s[r].render();for(m in t.modules)m.render()}}).start()})},t}();window.onload=muri.start;