.PHONY: test compile dev

install:
	npm install

build: install compile

compile:
	./node_modules/browserify/bin/cmd.js -p [ tsify ] ./src/service.ts --standalone simplehttpservice -o ./dist/service.js
	./node_modules/uglifyjs/bin/uglifyjs < ./dist/service.js > ./dist/service.min.js
 	 

test-browser: compile
	./node_modules/browserify/bin/cmd.js -p [ tsify ] ./src/ajax.ts -o ./dist/ajax.js
	./node_modules/browserify/bin/cmd.js -p [ tsify ] ./src/http.ts -o ./dist/http.js
	./node_modules/browserify/bin/cmd.js ./test/browser.js -o ./dist/test.js

test-server: build
	./node_modules/mocha/bin/mocha ./test/node.js

dev:
	watchify ./test/main.js -o ./dist/test.js

run: build test-browser
	python -m SimpleHTTPServer 8083 &
	open -a Google\ Chrome 'http://localhost:8083'
