diff --git a/index.js b/index.js deleted file mode 100644 index ffabecc..0000000 --- a/index.js +++ /dev/null @@ -1,5 +0,0 @@ -export {default as polygonArea} from "./src/area"; -export {default as polygonCentroid} from "./src/centroid"; -export {default as polygonHull} from "./src/hull"; -export {default as polygonContains} from "./src/contains"; -export {default as polygonLength} from "./src/length"; diff --git a/package.json b/package.json index 1dfa2e2..764b9e1 100644 --- a/package.json +++ b/package.json @@ -16,16 +16,17 @@ "name": "Mike Bostock", "url": "http://bost.ocks.org/mike" }, - "main": "dist/d3-polygon.min.js", - "module": "index", - "jsnext:main": "index", + "main": "dist/d3-polygon.js", + "unpkg": "dist/d3-polygon.min.js", + "jsdelivr": "dist/d3-polygon.min.js", + "module": "src/index.js", "repository": { "type": "git", "url": "https://github.com/d3/d3-polygon.git" }, "scripts": { "pretest": "rollup -c", - "test": "tape 'test/**/*-test.js' && eslint index.js src test", + "test": "tape 'test/**/*-test.js' && eslint src test", "prepublishOnly": "rm -rf dist && yarn test", "postpublish": "git push && git push --tags && cd ../d3.github.com && git pull && cp ../${npm_package_name}/dist/${npm_package_name}.js ${npm_package_name}.v1.js && cp ../${npm_package_name}/dist/${npm_package_name}.min.js ${npm_package_name}.v1.min.js && git add ${npm_package_name}.v1.js ${npm_package_name}.v1.min.js && git commit -m \"${npm_package_name} ${npm_package_version}\" && git push && cd - && zip -j dist/${npm_package_name}.zip -- LICENSE README.md dist/${npm_package_name}.js dist/${npm_package_name}.min.js" }, diff --git a/rollup.config.js b/rollup.config.js index 564ecba..804bba8 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -2,8 +2,8 @@ import {terser} from "rollup-plugin-terser"; import * as meta from "./package.json"; const config = { - input: "index.js", - external: Object.keys(meta.dependencies || {}), + input: "src/index.js", + external: Object.keys(meta.dependencies || {}).filter(key => /^d3-/.test(key)), output: { file: `dist/${meta.name}.js`, name: "d3", @@ -11,7 +11,7 @@ const config = { indent: false, extend: true, banner: `// ${meta.homepage} v${meta.version} Copyright ${(new Date).getFullYear()} ${meta.author.name}`, - globals: Object.assign({}, ...Object.keys(meta.dependencies || {}).map(key => ({[key]: "d3"}))) + globals: Object.assign({}, ...Object.keys(meta.dependencies || {}).filter(key => /^d3-/.test(key)).map(key => ({[key]: "d3"}))) }, plugins: [] }; diff --git a/src/index.js b/src/index.js new file mode 100644 index 0000000..f9aaf39 --- /dev/null +++ b/src/index.js @@ -0,0 +1,5 @@ +export {default as polygonArea} from "./area"; +export {default as polygonCentroid} from "./centroid"; +export {default as polygonHull} from "./hull"; +export {default as polygonContains} from "./contains"; +export {default as polygonLength} from "./length";