Skip to content

Commit

Permalink
update the build toolchain
Browse files Browse the repository at this point in the history
  • Loading branch information
Fil committed Sep 5, 2018
1 parent ce44fc4 commit 6de3b64
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 57 deletions.
15 changes: 15 additions & 0 deletions .eslintrc.json
@@ -0,0 +1,15 @@
{
"extends": "eslint:recommended",
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 8
},
"env": {
"es6": true
},
"rules": {
"no-cond-assign": 0,
"no-constant-condition": 0,
"no-floating-decimal": 2
}
}
4 changes: 2 additions & 2 deletions .gitignore
@@ -1,6 +1,6 @@
*.sublime-workspace
.DS_Store
build/
dist/
test/output/
node_modules
npm-debug.log
package-lock.json
2 changes: 1 addition & 1 deletion .npmignore
@@ -1,3 +1,3 @@
*.sublime-*
build/*.zip
dist/*.zip
test/
23 changes: 0 additions & 23 deletions index.js

This file was deleted.

33 changes: 17 additions & 16 deletions package.json
@@ -1,11 +1,12 @@
{
"name": "d3-geo-polygon",
"version": "1.4.2",
"version": "1.5.0",
"description": "Clipping and geometric operations for spherical polygons.",
"keywords": [
"d3",
"d3-module",
"geo",
"cartography",
"projection",
"polygon"
],
"homepage": "https://github.com/d3/d3-geo-polygon",
Expand All @@ -24,30 +25,30 @@
"url": "https://visionscarto.net"
}
],
"main": "build/d3-geo-polygon.js",
"unpkg": "build/d3-geo-polygon.min.js",
"jsdelivr": "build/d3-geo-polygon.min.js",
"module": "index",
"main": "dist/d3-geo-polygon.js",
"unpkg": "dist/d3-geo-polygon.min.js",
"jsdelivr": "dist/d3-geo-polygon.min.js",
"module": "src/index.js",
"repository": {
"type": "git",
"url": "https://github.com/d3/d3-geo-polygon.git"
},
"scripts": {
"pretest": "rm -rf build && mkdir build && rollup -c --banner \"$(preamble)\"",
"test": "tape 'test/**/*-test.js' && eslint index.js src",
"prepublishOnly": "npm run test && mkdir -p test/output && test/compare-images && uglifyjs -b beautify=false,preamble=\"'$(preamble)'\" build/d3-geo-polygon.js -c -m -o build/d3-geo-polygon.min.js",
"postpublish": "git push && git push --tags && zip -j build/d3-geo-polygon.zip -- LICENSE README.md build/d3-geo-polygon.js build/d3-geo-polygon.min.js"
"pretest": "rollup -c",
"test": "tape 'test/**/*-test.js' && eslint src",
"prepublishOnly": "rm -rf dist && yarn test && mkdir -p test/output && test/compare-images",
"postpublish": "git push && git push --tags && zip -j dist/d3-geo-polygon.zip -- LICENSE README.md dist/d3-geo-polygon.js dist/d3-geo-polygon.min.js"
},
"dependencies": {
"d3-array": "1",
"d3-geo": "^1.11.1",
"d3-geo-projection": "2"
},
"devDependencies": {
"d3-geo": "^1.10",
"eslint": "4",
"package-preamble": "0.1",
"rollup": "0.50",
"tape": "4",
"uglify-js": "3"
"canvas": "1",
"eslint": "5",
"rollup": "0.64",
"rollup-plugin-terser": "1",
"tape": "4"
}
}
47 changes: 32 additions & 15 deletions rollup.config.js
@@ -1,19 +1,36 @@
export default {
input: "index",
external: [
"d3-array",
"d3-geo",
"d3-geo-projection"
],
import {terser} from "rollup-plugin-terser";
import * as meta from "./package.json";

const config = {
input: "src/index.js",
external: Object.keys(meta.dependencies || {}).filter(key => /^d3-/.test(key)),
output: {
extend: true,
file: "build/d3-geo-polygon.js",
file: `dist/${meta.name}.js`,
name: "d3",
format: "umd",
globals: {
"d3-array": "d3",
"d3-geo": "d3",
"d3-geo-projection": "d3"
indent: false,
extend: true,
banner: `// ${meta.homepage} v${meta.version} Copyright ${(new Date).getFullYear()} ${meta.author.name}`,
globals: Object.assign({}, ...Object.keys(meta.dependencies || {}).filter(key => /^d3-/.test(key)).map(key => ({[key]: "d3"})))
},
plugins: []
};

export default [
config,
{
...config,
output: {
...config.output,
file: `dist/${meta.name}.min.js`
},
name: "d3"
plugins: [
...config.plugins,
terser({
output: {
preamble: config.output.banner
}
})
]
}
};
];
14 changes: 14 additions & 0 deletions src/index.js
@@ -0,0 +1,14 @@
export {default as geoClipPolygon} from "./clip/polygon";
export {default as geoPolyhedral} from "./polyhedral/index";
export {default as geoPolyhedralButterfly} from "./polyhedral/butterfly";
export {default as geoPolyhedralCollignon} from "./polyhedral/collignon";
export {default as geoPolyhedralWaterman} from "./polyhedral/waterman";
export {default as geoPolyhedralVoronoi} from "./polyhedral/voronoi";
export {default as geoDodecahedral} from "./polyhedral/dodecahedral";
export {default as geoCox, coxRaw as geoCoxRaw} from "./cox.js";
export {default as geoTetrahedralLee, leeRaw as geoLeeRaw} from "./tetrahedralLee.js";
export {default as geoGrayFullerRaw} from "./grayfuller";
export {default as geoAirocean} from "./airocean";
export {default as geoIcosahedral} from "./icosahedral";
export {default as geoCubic} from "./cubic";
export {default as geoCahillKeyes, cahillKeyesRaw as geoCahillKeyesRaw} from "./cahillKeyes";

0 comments on commit 6de3b64

Please sign in to comment.