mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-08-31 19:01:54 +02:00
update makefile
This commit is contained in:
67
Makefile
67
Makefile
@@ -11,6 +11,12 @@ mocha-phantomjs = $(bin)/mocha-phantomjs
|
|||||||
node = node
|
node = node
|
||||||
watchify = $(bin)/watchify
|
watchify = $(bin)/watchify
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
# Flags.
|
# Flags.
|
||||||
DEBUG ?=
|
DEBUG ?=
|
||||||
GREP ?=
|
GREP ?=
|
||||||
@@ -29,19 +35,12 @@ clean:
|
|||||||
@ rm -rf ./dist ./node_modules
|
@ rm -rf ./dist ./node_modules
|
||||||
|
|
||||||
# Build the source.
|
# Build the source.
|
||||||
dist: $(shell find ./lib) package.json
|
dist: $(shell find ./lib) package.json
|
||||||
@ $(babel) \
|
@ $(babel) $(babel_flags) --out-dir ./dist ./lib
|
||||||
--out-dir \
|
|
||||||
./dist \
|
|
||||||
./lib
|
|
||||||
|
|
||||||
# Build the examples.
|
# Build the examples.
|
||||||
examples:
|
examples:
|
||||||
@ $(browserify) \
|
@ $(browserify) $(browserify_flags) ./examples/index.js --outfile ./examples/build.js
|
||||||
./examples/index.js \
|
|
||||||
--debug \
|
|
||||||
--transform babelify \
|
|
||||||
| $(exorcist) ./examples/build.js.map > ./examples/build.js
|
|
||||||
|
|
||||||
# Install the dependencies.
|
# Install the dependencies.
|
||||||
install:
|
install:
|
||||||
@@ -49,55 +48,23 @@ install:
|
|||||||
|
|
||||||
# Lint the source files.
|
# Lint the source files.
|
||||||
lint:
|
lint:
|
||||||
@ $(eslint) \
|
@ $(eslint) $(eslint_flags) "lib/**/*.js" "examples/**/*.js"
|
||||||
"lib/**/*.js" \
|
|
||||||
"examples/**/*.js" --ignore-pattern "build.js"
|
|
||||||
|
|
||||||
# Start the examples server.
|
# Start the server.
|
||||||
start-examples:
|
start:
|
||||||
@ $(http-server) ./examples
|
@ $(http-server) ./examples
|
||||||
|
|
||||||
# Build the test source.
|
|
||||||
test/support/build.js: $(shell find ./lib) ./test/browser.js
|
|
||||||
@ $(browserify) \
|
|
||||||
./test/browser.js \
|
|
||||||
--debug \
|
|
||||||
--transform babelify \
|
|
||||||
--outfile ./test/support/build.js
|
|
||||||
|
|
||||||
# Run the tests.
|
# Run the tests.
|
||||||
test: test-server
|
test:
|
||||||
|
@ $(mocha) $(mocha_flags) --fgrep "$(GREP)" ./test/server.js
|
||||||
# Run the browser-side tests.
|
|
||||||
test-browser: ./test/support/build.js
|
|
||||||
@ $(mocha-phantomjs) \
|
|
||||||
--reporter spec \
|
|
||||||
./test/support/browser.html
|
|
||||||
|
|
||||||
# Run the server-side tests.
|
|
||||||
test-server:
|
|
||||||
@ $(mocha) \
|
|
||||||
--compilers js:babel-core/register \
|
|
||||||
--require source-map-support/register \
|
|
||||||
--reporter spec \
|
|
||||||
--fgrep "$(GREP)" \
|
|
||||||
./test/server.js
|
|
||||||
|
|
||||||
# Watch the source.
|
# Watch the source.
|
||||||
watch-dist: $(shell find ./lib) package.json
|
watch-dist:
|
||||||
@ $(babel) \
|
@ $(MAKE) dist babel_flags="$(babel_flags) --watch"
|
||||||
--watch \
|
|
||||||
--out-dir \
|
|
||||||
./dist \
|
|
||||||
./lib
|
|
||||||
|
|
||||||
# Watch the examples.
|
# Watch the examples.
|
||||||
watch-examples:
|
watch-examples:
|
||||||
@ $(watchify) \
|
@ $(MAKE) examples browserify=$(watchify)
|
||||||
./examples/index.js \
|
|
||||||
--debug \
|
|
||||||
--transform babelify \
|
|
||||||
--outfile "$(exorcist) ./examples/build.js.map > ./examples/build.js"
|
|
||||||
|
|
||||||
# Phony targets.
|
# Phony targets.
|
||||||
.PHONY: examples
|
.PHONY: examples
|
||||||
|
@@ -6,6 +6,7 @@
|
|||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prepublish": "make dist",
|
"prepublish": "make dist",
|
||||||
|
"start": "make start",
|
||||||
"test": "make check"
|
"test": "make check"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
Reference in New Issue
Block a user