1
0
mirror of https://github.com/ianstormtaylor/slate.git synced 2025-03-13 17:59:42 +01:00
slate/Makefile

77 lines
1.5 KiB
Makefile
Raw Normal View History

2016-06-15 12:07:12 -07:00
# Binaries.
bin = ./node_modules/.bin
2016-06-17 19:57:37 -07:00
babel = $(bin)/babel
2016-06-15 12:07:12 -07:00
browserify = $(bin)/browserify
2016-06-24 12:13:38 -07:00
exorcist = $(bin)/exorcist
2016-07-06 20:19:19 -07:00
eslint = $(bin)/eslint
2016-07-11 12:34:22 -07:00
http-server = $(bin)/http-server
gh-pages = $(bin)/gh-pages
2016-06-15 12:07:12 -07:00
mocha = $(bin)/mocha
mocha-phantomjs = $(bin)/mocha-phantomjs
node = node
watchify = $(bin)/watchify
2016-07-13 15:04:11 -07:00
# Options.
babel_flags =
browserify_flags = --debug --transform babelify
eslint_flags = --ignore-pattern "build.js"
mocha_flags = --compilers js:babel-core/register --require source-map-support/register --reporter spec
2016-06-15 12:07:12 -07:00
# Flags.
DEBUG ?=
2016-06-23 15:39:44 -07:00
GREP ?=
2016-06-15 12:07:12 -07:00
# Config.
ifeq ($(DEBUG),true)
mocha += debug
node += debug
endif
2016-07-06 20:19:19 -07:00
# Run all of the checks.
check: lint test
2016-06-15 12:07:12 -07:00
# Remove the generated files.
clean:
2016-07-11 16:44:37 -07:00
@ rm -rf ./dist ./node_modules
2016-06-15 12:07:12 -07:00
2016-06-17 19:57:37 -07:00
# Build the source.
2016-07-13 15:04:11 -07:00
dist: $(shell find ./lib) package.json
@ $(babel) $(babel_flags) --out-dir ./dist ./lib
2016-06-17 19:57:37 -07:00
2016-06-24 10:22:48 -07:00
# Build the examples.
examples:
2016-07-13 15:04:11 -07:00
@ $(browserify) $(browserify_flags) ./examples/index.js --outfile ./examples/build.js
2016-06-21 19:34:51 -07:00
# Deploy the latest examples to GitHub pages.
gh-pages:
@ $(gh-pages) --dist ./examples
2016-06-15 12:07:12 -07:00
# Install the dependencies.
2016-06-21 10:43:04 -07:00
install:
2016-06-15 12:07:12 -07:00
@ npm install
2016-06-21 10:43:04 -07:00
2016-07-07 08:35:13 -07:00
# Lint the source files.
2016-06-21 10:43:04 -07:00
lint:
2016-07-13 15:04:11 -07:00
@ $(eslint) $(eslint_flags) "lib/**/*.js" "examples/**/*.js"
2016-06-15 12:07:12 -07:00
2016-07-13 15:04:11 -07:00
# Start the server.
start:
2016-07-11 12:34:22 -07:00
@ $(http-server) ./examples
2016-06-15 12:07:12 -07:00
# Run the tests.
2016-07-13 15:04:11 -07:00
test:
@ $(mocha) $(mocha_flags) --fgrep "$(GREP)" ./test/server.js
2016-06-15 12:07:12 -07:00
2016-07-11 18:36:45 -07:00
# Watch the source.
2016-07-13 15:04:11 -07:00
watch-dist:
@ $(MAKE) dist babel_flags="$(babel_flags) --watch"
2016-07-11 18:36:45 -07:00
2016-06-24 10:22:48 -07:00
# Watch the examples.
watch-examples:
2016-07-13 15:04:11 -07:00
@ $(MAKE) examples browserify=$(watchify)
2016-06-21 19:34:51 -07:00
2016-06-15 12:07:12 -07:00
# Phony targets.
.PHONY: examples
.PHONY: test