Skip to content

Instantly share code, notes, and snippets.

@pitluga
Created February 12, 2016 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pitluga/28f01696a85be68f589b to your computer and use it in GitHub Desktop.
Save pitluga/28f01696a85be68f589b to your computer and use it in GitHub Desktop.
PATH := node_modules/.bin:$(PATH)
SHELL := /bin/bash
browser_files := $(shell find src/browser -type f -name '*.js')
browser_specs := $(shell find test/browser -type f -name '*_spec.js')
browser_bundle := build/browser.js
karma_config := test/browser/karma.conf.js
browser_test := build/browser.spec.done
client_files := $(shell find src/client -type f -name '*.js')
client_specs := $(shell find test/client -type f -name '*_spec.js')
client_test := build/client.spec.done
.PHONY: all autotest clean test watch
all: $(browser_bundle) $(browser_test) $(client_test)
test: $(browser_test) $(client_test)
clean:
rm -rf build
watch:
watchify -t reactify $(browser_files) -o $(browser_bundle)
autotest:
karma start $(karma_config) --auto-watch --no-single-run
$(browser_bundle): $(browser_files)
mkdir -p $(dir $@)
browserify -t reactify $(browser_files) > $@
$(client_test): $(client_files) $(client_specs)
jasmine-node $(client_specs)
touch $(client_test)
$(browser_test): $(browser_bundle) $(browser_specs)
karma start $(karma_config) --no-auto-watch --single-run --port 9877
touch $(browser_test)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment