Related d3/d3-random@11a8974796.
This commit is contained in:
Mike Bostock 2016-03-14 12:25:49 -07:00
Родитель a520723b34
Коммит 3896582667
5 изменённых файлов: 56 добавлений и 12 удалений

21
bin/rollup Executable file
Просмотреть файл

@ -0,0 +1,21 @@
#!/usr/bin/env node
var rollup = require("rollup"),
nodeResolve = require("rollup-plugin-node-resolve");
rollup.rollup({
entry: "index.js",
plugins: [nodeResolve({jsnext: true})]
}).then(function(bundle) {
return bundle.write({
format: "umd",
moduleName: "d3",
dest: "build/d3.js"
});
}).then(function() {
console.warn("↳ build/d3.js");
}).catch(abort);
function abort(error) {
console.error(error.stack);
}

29
bin/rollup-node Executable file
Просмотреть файл

@ -0,0 +1,29 @@
#!/usr/bin/env node
var fs = require("fs"),
rollup = require("rollup"),
dependencies = require("../package.json").dependencies;
rollup.rollup({
entry: "index.js",
external: Object.keys(dependencies)
}).then(function(bundle) {
var code = bundle.generate({
format: "cjs"
}).code.replace(
/^exports\.event = (.*);$/m,
"Object.defineProperty(exports, \"event\", {get: function() { return $1; }});"
);
return new Promise(function(resolve, reject) {
fs.writeFile("build/d3.node.js", code, "utf8", function(error) {
if (error) return reject(error);
else resolve();
});
});
}).then(function() {
console.warn("↳ build/d3.node.js");
}).catch(abort);
function abort(error) {
console.error(error.stack);
}

Просмотреть файл

@ -1,6 +1,6 @@
export {
version
} from "./build/version";
} from "./build/package";
export {
bisect,

Просмотреть файл

@ -26,13 +26,14 @@
"url": "https://github.com/mbostock/d3.git"
},
"scripts": {
"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",
"pretest": "rm -rf build && mkdir build && json2module package.json > build/package.js && bin/rollup-node",
"test": "faucet",
"prepublish": "npm run test && bin/rollup && uglifyjs build/d3.js -c -m -o 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 && cd - && zip -j build/d3.zip -- LICENSE README.md build/d3.js build/d3.min.js"
},
"devDependencies": {
"faucet": "0.0",
"json2module": "0.0",
"rollup": "0.25",
"rollup-plugin-node-resolve": "1",
"tape": "4",
@ -44,7 +45,7 @@
"d3-collection": "0.1.2",
"d3-color": "0.4.2",
"d3-dispatch": "0.4.3",
"d3-dsv": "0.3.0",
"d3-dsv": "0.3.1",
"d3-ease": "0.7.0",
"d3-format": "0.5.1",
"d3-interpolate": "0.7.0",

Просмотреть файл

@ -1,7 +0,0 @@
import node from "rollup-plugin-node-resolve";
export default {
plugins: [node({jsnext: true})],
moduleName: "d3",
format: "umd"
};