blob: 37ddc201ce63f3843e1deb5711ecb0980623875e [file] [log] [blame]
PATH := bin:node_modules/.bin:$(PATH)
PATH := $(PATH):$(V23_ROOT)/third_party/cout/node/bin
SHELL := /bin/bash -euo pipefail
js_files := $(shell find browser -name "*.js")
css_files := $(shell find stylesheets -name "*.css")
host ?= 127.0.0.1
port ?= 8088
.DEFAULT_GOAL := all
.DELETE_ON_ERROR:
.PHONY: all
all: public/bundle.js public/bundle.css
@true # silences `watch make`
.PHONY: deploy-production
deploy-production: all
make -C $(V23_ROOT)/infrastructure/deploy playground-production
.PHONY: deploy-staging
deploy-staging: all
make -C $(V23_ROOT)/infrastructure/deploy playground-staging
public/bundle.js: browser/index.js $(js_files) node_modules
browserify --debug $< 1> $@
public/bundle.css: stylesheets/index.css $(css_files) node_modules
bin/compile-css $< 1> $@
node_modules: package.json
@npm prune
@npm install
@touch $@
.PHONY: start
start: all
http-server public -p $(port) -a $(host) -d --cors
.PHONY: clean
clean:
@$(RM) -rf public/bundle.*
@$(RM) -rf node_modules
@$(RM) -rf npm-debug.log
.PHONY: distclean
distclean: clean
@npm cache clean
.PHONY: dependency-check
dependency-check: package.json node_modules
dependency-check $<
.PHONY: lint
lint: dependency-check
jshint .
.PHONY: test
test: lint test-client test-browser
@true # silences `watch make`
.PHONY: test-client
test-client: node_modules
tape test/index.js
.PHONY: test-browser
test-browser: node_modules
run-browser test/index.js --phantom