From 545706e742b77f00ff7f8c95fb550c146f4df95f Mon Sep 17 00:00:00 2001 From: Dan Vanderkam Date: Wed, 28 Dec 2016 14:41:10 -0500 Subject: [PATCH] attempt to get npm distribution working --- index.js | 1 + package.json | 24 +++++++++++++----------- scripts/build.sh | 10 +++++----- 3 files changed, 19 insertions(+), 16 deletions(-) create mode 100644 index.js diff --git a/index.js b/index.js new file mode 100644 index 0000000..09aed2e --- /dev/null +++ b/index.js @@ -0,0 +1 @@ +export { default } from './src/dygraph'; diff --git a/package.json b/package.json index 508b714..a932024 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,17 @@ { "name": "dygraphs", - "version": "1.1.0", + "version": "2.0.0-rc2", "description": "dygraphs is a fast, flexible open source JavaScript charting library.", - "main": "dist/src/dygraph.js", - "directories": { - "doc": "docs", - "test": "tests" - }, + "main": "src-es5/dygraph.js", + "module": "index", + "jsnext:main": "index", + "files": [ + "index.js", + "docs", + "dist", + "src", + "src-es5" + ], "repository": { "type": "git", "url": "git://github.com/danvk/dygraphs.git" @@ -33,6 +38,7 @@ "browserify-header": "^0.9.2", "chai": "^3.3.0", "clean-css": "^3.4.23", + "core-js": "^2.4.1", "coveralls": "^2.11.2", "envify": "^3.4.0", "exorcist": "^0.4.0", @@ -43,7 +49,6 @@ "mocha": "^2.1.0", "mocha-phantomjs": "3.5.3", "mocha-phantomjs-istanbul": "0.0.2", - "obvious-closure-library": "^20140401.0.2", "parse-data-uri": "^0.2.0", "phantomjs": "^1.9.7-8", "pre-commit": "^1.0.6", @@ -61,8 +66,5 @@ }, "pre-commit": [ "tests-ok" - ], - "dependencies": { - "core-js": "^2.4.1" - } + ] } diff --git a/scripts/build.sh b/scripts/build.sh index 3122d03..ebdd1d4 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,9 +1,6 @@ #!/bin/bash -# This generates: -# - dist/dygraph.js -# - dist/dygraph.js.map -# - dist/dygraph.min.js -# - dist/dygraph.min.js.map +# This generates everything under dist: +# bundled JS, minified JS, minified CSS and source maps. set -o errexit mkdir -p dist @@ -52,6 +49,9 @@ jar -cf dist/dygraph-gwt.jar -C gwt org cp css/dygraph.css dist/ cleancss css/dygraph.css -o dist/dygraph.min.css --source-map --source-map-inline-sources +# Build ES5-compatible distribution +babel src -d src-es5 --compact false + # Remove temp files. rm dist/dygraph.tmp.js rm dist/dygraph.tmp.js.map -- 2.7.4