2016-03-14 22:25:49 +03:00
|
|
|
var fs = require("fs"),
|
|
|
|
rollup = require("rollup"),
|
2016-09-19 19:11:00 +03:00
|
|
|
dependencies = require("./package.json").dependencies;
|
2016-03-14 22:25:49 +03:00
|
|
|
|
|
|
|
rollup.rollup({
|
|
|
|
entry: "index.js",
|
|
|
|
external: Object.keys(dependencies)
|
|
|
|
}).then(function(bundle) {
|
2017-01-21 02:09:01 +03:00
|
|
|
var code = bundle.generate({format: "cjs"}).code + "Object.defineProperty(exports, \"event\", {get: function() { return d3Selection.event; }});\n";
|
2016-03-14 22:25:49 +03:00
|
|
|
return new Promise(function(resolve, reject) {
|
|
|
|
fs.writeFile("build/d3.node.js", code, "utf8", function(error) {
|
|
|
|
if (error) return reject(error);
|
|
|
|
else resolve();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}).catch(abort);
|
|
|
|
|
|
|
|
function abort(error) {
|
|
|
|
console.error(error.stack);
|
|
|
|
}
|