diff --git a/index.js b/index.js index e6012f069cc4b98bcba8ec3f4e4456cf9e5e3974..9aea753a1773740fd3cc4b3fa2093b5aa0cd8b72 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,6 @@ export { version -} from "./package.json"; +} from "./build/version"; export { bisect, diff --git a/package.json b/package.json index 71b4f8fe069ad97382dae274d71be37a3a1557e9..8550ea684b3dfbedef4320648861f609489a0803 100644 --- a/package.json +++ b/package.json @@ -18,14 +18,15 @@ "name": "Mike Bostock", "url": "http://bost.ocks.org/mike" }, - "main": "build/d3.js", + "main": "build/d3.node.js", + "browser": "build/d3.js", "jsnext:main": "index", "repository": { "type": "git", "url": "https://github.com/mbostock/d3.git" }, "scripts": { - "pretest": "mkdir -p build && rollup -c -o build/d3.js -- index.js", + "pretest": "mkdir -p build && node -e 'process.stdout.write(\"export var version = \\\"\" + require(\"./package.json\").version + \"\\\";\\n\");' > build/version.js && rollup -c -o build/d3.js -- index.js && rollup -e `node -e 'process.stdout.write(Object.keys(require(\"./package.json\").dependencies).join(\",\"));'` -f cjs -- index.js | grep -v '^exports.event =' > build/d3.node.js && echo '\nObject.defineProperty(exports, \"event\", {get: function() { return d3Selection.event; }});' >> build/d3.node.js", "test": "faucet `find test -name '*-test.js'`", "prepublish": "npm run test && uglifyjs build/d3.js -c -m -o build/d3.min.js && rm -f build/d3.zip && zip -j build/d3.zip -- LICENSE README.md build/d3.js build/d3.min.js", "postpublish": "VERSION=`node -e 'console.log(require(\"./package.json\").version)'`; git push && cp -v build/d3.js ../d3.github.com/d3.v${VERSION}.js && cp -v build/d3.min.js ../d3.github.com/d3.v${VERSION}.min.js && cd ../d3.github.com && git add d3.v${VERSION}.js d3.v${VERSION}.min.js && git commit -m \"d3 ${VERSION}\" && git push" @@ -33,7 +34,6 @@ "devDependencies": { "faucet": "0.0", "rollup": "0.25", - "rollup-plugin-json": "2", "rollup-plugin-node-resolve": "1", "tape": "4", "uglify-js": "2" diff --git a/rollup.config.js b/rollup.config.js index 3e0ae2a565ada53a7e1fd4bbd97739f859dd2ca5..03a5dd7d1a2401fed2185d13a92761f1cd83f7ee 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,8 +1,7 @@ -import json from "rollup-plugin-json"; import node from "rollup-plugin-node-resolve"; export default { - plugins: [node({jsnext: true}), json()], + plugins: [node({jsnext: true})], moduleName: "d3", format: "umd" };