Skip to content

Commit

Permalink
Bundle d3 and lodash in build artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
johnwalley committed Dec 29, 2016
1 parent 2edd86b commit 450693c
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ See a demo [here](https://bl.ocks.org/johnwalley/a0734cf335b44365026adae40cce594
If you use NPM, `npm install d3-bumps-chart`. Otherwise, download the [latest release](https://github.com/johnwalley/d3-bumps-chart/releases/latest). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3_bumps_chart` global is exported:

```html
<script src="https://d3js.org/d3.v4.min.js"></script>
<script src="https://cdn.jsdelivr.net/lodash/4.15.0/lodash.min.js"></script>
<script src="../build/d3-bumps-chart.js"></script>

<script>
Expand Down
2 changes: 0 additions & 2 deletions example/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

<head>
<link rel="stylesheet" href="./bumps.css" >
<script src="https://d3js.org/d3.v4.min.js"></script>
<script src="https://cdn.jsdelivr.net/lodash/4.15.0/lodash.min.js"></script>
<script src="../build/d3-bumps-chart.js"></script>
</head>

Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "d3-bumps-chart",
"version": "0.3.3",
"version": "0.4.0",
"description": "Draw bumps charts.",
"keywords": [
"d3",
Expand All @@ -21,7 +21,7 @@
"url": "https://github.com/johnwalley/d3-bumps-chart.git"
},
"scripts": {
"pretest": "rm -rf build && mkdir build && rollup -c -f umd -g d3-array:d3,d3-dsv:d3,d3-selection:d3,d3-scale:d3,d3-shape:d3,d3-transition:d3,lodash:_ -n d3_bumps_chart -o build/d3-bumps-chart.js -- index.js",
"pretest": "rm -rf build && mkdir build && rollup -c -f umd -n d3_bumps_chart -o build/d3-bumps-chart.js -- index.js",
"test": "tape test/**/*-test.js && eslint index.js src",
"prepublish": "npm run test && uglifyjs --preamble \"$(preamble)\" build/d3-bumps-chart.js -c -m -o build/d3-bumps-chart.min.js",
"postpublish": "zip -j build/d3-bumps-chart.zip -- LICENSE README.md build/d3-bumps-chart.js build/d3-bumps-chart.min.js"
Expand All @@ -33,13 +33,14 @@
"d3-selection": "^1.0.2",
"d3-shape": "^1.0.3",
"d3-transition": "^1.0.2",
"lodash": "^4.15.0"
"lodash-es": "^4.17.3"
},
"devDependencies": {
"babel-preset-es2015": "^6.14.0",
"eslint": "2",
"rollup": "0.34",
"rollup-plugin-babel": "^2.6.1",
"rollup-plugin-node-resolve": "^2.0.0",
"tape": "4",
"uglify-js": "^2.7.3"
}
Expand Down
11 changes: 9 additions & 2 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import babel from 'rollup-plugin-babel';
import nodeResolve from 'rollup-plugin-node-resolve';

export default {
plugins: [ babel({
plugins: [
babel({
exclude: 'node_modules/**'
}) ]
}),
nodeResolve({
jsnext: true,
main: true
}),
]
};
5 changes: 4 additions & 1 deletion src/util.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { findKey, uniq, uniqBy } from 'lodash';
import findKey from 'lodash-es/findKey';
import uniq from 'lodash-es/uniq';
import uniqBy from 'lodash-es/uniqBy';

import { csvParse } from 'd3-dsv';
import { min, max } from 'd3-array';

Expand Down

0 comments on commit 450693c

Please sign in to comment.