feat: build standard d3-module for d3v4+ & update examples #51
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With the release of version 4,
d3
moved over to a modular approach, wherein everything is a plugin that extends off the maind3
module. In doing so, they setup a standard approach to buildingd3
modules. I originally recommendedwebpack
for bundling source code, but the rest of thed3
universe uses rollup with a standard configuration (example ford3-shape
).Summarized, a standard d3-module for v4+ entails:
d3-geomap
(instead ofd3.geomap
)For convenience, I've added the following:
rollup-plugin-babel
to transpile ES6rollup-plugin-postcss
to compile sassrollup-plugin-serve
d3-geo-projection
(user can load if needed - the default projection is available ind3-geo
)d3-geomap
class to not styles to global DOM, e.g.<text>
I've made several other small changes around the edges that I am happy to explain if you're wondering why they were made.
Below are the breaking changes. Do note, the API does not need to be changed, but I think making each of the exports distinct calls really clears up usage.
BREAKING CHANGES:
dist/d3-geomap.js
anddist/d3-geomap.min.js
dist/d3-geomap.css
anddist/d3-geomap.min.css
d3.geomap()
,d3.choropleth()
, andd3.colorbrewer()
d3-geomap
class must be added to map elements for default styling