sudo: false # Use container-based architecture
script: >
- ./make-prod-combined.sh &&
- ./make-tests.sh &&
- ./run-tests.sh &&
+ npm run build &&
+ npm run build-tests &&
+ npm run test &&
curl -O https://raw.githubusercontent.com/danvk/travis-weigh-in/master/weigh_in.py &&
python weigh_in.py dist/dygraph-combined.js
+++ /dev/null
-#!/bin/bash
-mkdir -p dist
-
-browserify \
- -v \
- -t babelify \
- -t [ envify --NODE_ENV production ] \
- --debug \
- --standalone Dygraph \
- src/dygraph.js \
- > dist/dygraph.js
-
-# Create dist/dygraph.js.map
-cat dist/dygraph.js | exorcist --base . dist/dygraph.js.map > /dev/null
-
-# Create dist/dygraph.js.min{,.map}
-uglifyjs --compress --mangle \
- --in-source-map dist/dygraph.js.map \
- --source-map-include-sources \
- --source-map dist/dygraph.min.js.map \
- -o dist/dygraph.min.js \
- dist/dygraph.js
-
-# Copy to the old location
-cp dist/dygraph.min.js dist/dygraph-combined.js
+++ /dev/null
-#!/bin/bash
-browserify \
- -v \
- -t babelify \
- -t [ envify --NODE_ENV development ] \
- --debug \
- -o dist/tests.js \
- auto_tests/tests/*.js
"babel-core": "^5.8.25",
"babelify": "^6.3.0",
"browserify": "^11.2.0",
+ "browserify-header": "^0.9.2",
"chai": "^3.3.0",
"coveralls": "^2.11.2",
"envify": "^3.4.0",
"watchify": "^3.4.0"
},
"scripts": {
- "test": "make test",
+ "build": "./scripts/build.sh",
+ "watch": "./scripts/watch.sh",
+ "build-tests": "./scripts/build-tests.sh",
+ "test": "./scripts/run-tests.sh",
"tests-ok": "./scripts/check-no-only.sh"
},
"pre-commit": [
+++ /dev/null
-#!/bin/bash
-# Starts the http-server and runs mocha-phantomjs-based tests
-# Note that you must run `npm run build` or `npm run watch` before running this.
-set -o errexit
-
-# Run http-server and save its PID
-http-server -p 8081 > /dev/null &
-SERVER_PID=$!
-function finish() {
- kill -TERM $SERVER_PID
-}
-trap finish EXIT
-
-# the following sleep step is not really necessary
-# as http-server starts almost instantenously;
-# but letting the server settle might help prevent
-# possible racing conditions
-sleep 1
-
-# Start the tests
-mocha-phantomjs http://localhost:8081/auto_tests/runner.html
--- /dev/null
+#!/bin/bash
+# Create dist/tests.js
+# To run the tests, run `npm run test`
+# To iterate on the tests, use `npm run watch`
+
+browserify \
+ -v \
+ -t babelify \
+ -t [ envify --NODE_ENV development ] \
+ --debug \
+ -o dist/tests.js \
+ auto_tests/tests/*.js
--- /dev/null
+#!/bin/bash
+# This generates:
+# - dist/dygraph.js
+# - dist/dygraph.js.map
+# - dist/dygraph.min.js
+# - dist/dygraph.min.js.map
+set -o errexit
+
+mkdir -p dist
+
+# Create dist/dygraph.js
+browserify \
+ -v \
+ -t babelify \
+ -t [ envify --NODE_ENV development ] \
+ --debug \
+ --standalone Dygraph \
+ src/dygraph.js \
+ > dist/dygraph.tmp.js
+
+# Create dist/dygraph.js.map
+cat dist/dygraph.tmp.js | exorcist --base . dist/dygraph.js.map > dist/dygraph.js
+
+# Create "production" bundle for minification
+browserify \
+ -v \
+ -t babelify \
+ -t [ envify --NODE_ENV production ] \
+ --debug \
+ --standalone Dygraph \
+ src/dygraph.js \
+ > dist/dygraph.tmp.js
+
+# Create dist/dygraph.tmp.js.map
+cat dist/dygraph.tmp.js | exorcist --base . dist/dygraph.tmp.js.map > /dev/null
+
+# Create dist/dygraph.js.min{,.map}
+uglifyjs --compress --mangle \
+ --in-source-map dist/dygraph.tmp.js.map \
+ --source-map-include-sources \
+ --source-map dist/dygraph.min.js.map \
+ -o dist/dygraph.min.js \
+ dist/dygraph.tmp.js
+
+# Copy to the old location
+cp dist/dygraph.min.js dist/dygraph-combined.js
+
+# Build GWT JAR
+jar -cf dist/dygraph-gwt.jar -C gwt org
+
+# Remove temp files.
+rm dist/dygraph.tmp.js
+rm dist/dygraph.tmp.js.map
--- /dev/null
+#!/bin/bash
+# Starts the http-server and runs mocha-phantomjs-based tests
+# Note that you must run `npm run build` or `npm run watch` before running this.
+set -o errexit
+
+# Run http-server and save its PID
+http-server -p 8081 > /dev/null &
+SERVER_PID=$!
+function finish() {
+ kill -TERM $SERVER_PID
+}
+trap finish EXIT
+
+# the following sleep step is not really necessary
+# as http-server starts almost instantenously;
+# but letting the server settle might help prevent
+# possible racing conditions
+sleep 1
+
+# Start the tests
+mocha-phantomjs http://localhost:8081/auto_tests/runner.html
--- /dev/null
+#!/bin/bash
+# Continually regenerate these two files:
+# - dist/dygraph.js
+# - dist/tests.js
+# As source/test files change.
+
+# Clean background processes after quit
+trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT
+
+mkdir -p dist # in case it doesn't exist; watchify needs it
+
+watchify \
+ -v \
+ -t babelify \
+ -t [ envify --NODE_ENV development ] \
+ --debug \
+ --standalone Dygraph \
+ -o dist/dygraph.js \
+ src/dygraph.js &
+
+watchify \
+ -v \
+ -t babelify \
+ -t [ envify --NODE_ENV development ] \
+ --debug \
+ -o dist/tests.js \
+ auto_tests/tests/*.js &
+
+# Wait until background processes end
+wait
+++ /dev/null
-#!/bin/bash
-watchify \
- -v \
- -t babelify \
- -t [ envify --NODE_ENV development ] \
- --debug \
- --standalone Dygraph \
- -o dist/dygraph.js \
- src/dygraph.js
+++ /dev/null
-#!/bin/bash
-watchify \
- -v \
- -t babelify \
- -t [ envify --NODE_ENV development ] \
- --debug \
- -o dist/tests.js \
- auto_tests/tests/*.js