Skip to content

Commit 62e2a41

Browse files
committed
Add custom build
1 parent 1126611 commit 62e2a41

File tree

4 files changed

+83
-1
lines changed

4 files changed

+83
-1
lines changed

custom.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
export { version } from "./dist/package.js";
2+
3+
export { select, selectAll } from "d3-selection";
4+
5+
export * from "d3-selection-multi";
6+
export { transition } from "d3-transition";
7+
8+
export {
9+
easeElasticOut,
10+
easeSinOut,
11+
easeBackOut,
12+
easeLinear,
13+
easeCubicOut,
14+
easeExpOut
15+
} from "d3-ease";
16+
17+
export { arc, pie } from "d3-shape";
18+
19+
export { entries } from "d3-collection";
20+
21+
export { interpolate, interpolateNumber } from "d3-interpolate";

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"index.js"
2929
],
3030
"scripts": {
31-
"pretest": "rimraf dist && mkdir dist && json2module package.json > dist/package.js && rollup -c",
31+
"pretest": "rimraf dist && mkdir dist && json2module package.json > dist/package.js && rollup -c && rollup -c rollup-custom.config.js",
3232
"test": "tape 'test/**/*-test.js'",
3333
"prepublishOnly": "yarn test",
3434
"postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../d3/dist/d3.js d3.v5.js && cp ../d3/dist/d3.min.js d3.v5.min.js && git add d3.v5.js d3.v5.min.js && git commit -m \"d3 ${npm_package_version}\" && git push && cd - && cd ../d3-bower && git pull && cp ../d3/LICENSE ../d3/README.md ../d3/dist/d3.js ../d3/dist/d3.min.js . && git add -- LICENSE README.md d3.js d3.min.js && git commit -m \"${npm_package_version}\" && git tag -am \"${npm_package_version}\" v${npm_package_version} && git push && git push --tags && cd - && zip -j dist/d3.zip -- LICENSE README.md API.md CHANGES.md dist/d3.js dist/d3.min.js"
@@ -67,6 +67,7 @@
6767
"d3-scale": "2",
6868
"d3-scale-chromatic": "1",
6969
"d3-selection": "1",
70+
"d3-selection-multi": "^1.0.1",
7071
"d3-shape": "1",
7172
"d3-time": "1",
7273
"d3-time-format": "2",

rollup-custom.config.js

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import ascii from "rollup-plugin-ascii";
2+
import node from "rollup-plugin-node-resolve";
3+
import { terser } from "rollup-plugin-terser";
4+
import * as meta from "./package.json";
5+
6+
const copyright = `// ${meta.homepage} v${
7+
meta.version
8+
} Copyright ${new Date().getFullYear()} ${meta.author.name}`;
9+
10+
function onwarn(message, warn) {
11+
if (message.code === "CIRCULAR_DEPENDENCY") return;
12+
warn(message);
13+
}
14+
15+
export default [
16+
{
17+
input: "index.js",
18+
external: Object.keys(meta.dependencies || {}).filter(key =>
19+
/^d3-/.test(key)
20+
),
21+
output: {
22+
file: "dist/d3-custom.node.js",
23+
format: "cjs"
24+
},
25+
onwarn
26+
},
27+
{
28+
input: "custom.js",
29+
plugins: [node(), ascii()],
30+
output: {
31+
extend: true,
32+
banner: copyright,
33+
file: "dist/d3-custom.js",
34+
format: "umd",
35+
indent: false,
36+
name: "d3"
37+
},
38+
onwarn
39+
},
40+
{
41+
input: "custom.js",
42+
plugins: [node(), ascii(), terser({ output: { preamble: copyright } })],
43+
output: {
44+
extend: true,
45+
file: "dist/d3-custom.min.js",
46+
format: "umd",
47+
indent: false,
48+
name: "d3"
49+
},
50+
onwarn
51+
}
52+
];

yarn.lock

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,14 @@ d3-scale@2:
263263
d3-time "1"
264264
d3-time-format "2"
265265

266+
d3-selection-multi@^1.0.1:
267+
version "1.0.1"
268+
resolved "https://registry.yarnpkg.com/d3-selection-multi/-/d3-selection-multi-1.0.1.tgz#cd6c25413d04a2cb97470e786f2cd877f3e34f58"
269+
integrity sha1-zWwlQT0EosuXRw54byzYd/PjT1g=
270+
dependencies:
271+
d3-selection "1"
272+
d3-transition "1"
273+
266274
d3-selection@1, d3-selection@^1.1.0:
267275
version "1.4.1"
268276
resolved "https://registry.yarnpkg.com/d3-selection/-/d3-selection-1.4.1.tgz#98eedbbe085fbda5bafa2f9e3f3a2f4d7d622a98"

0 commit comments

Comments
 (0)