Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adopt type: module. #61

Merged
merged 4 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,8 @@
"sourceType": "module",
"ecmaVersion": 8
},
"env": {
"es6": true
},
"rules": {
"no-cond-assign": 0,
"no-constant-condition": 0,
"no-floating-decimal": 2
"no-constant-condition": 0
}
}
18 changes: 18 additions & 0 deletions .github/eslint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"problemMatcher": [
{
"owner": "eslint-compact",
"pattern": [
{
"regexp": "^(.+):\\sline\\s(\\d+),\\scol\\s(\\d+),\\s(Error|Warning|Info)\\s-\\s(.+)\\s\\((.+)\\)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5,
"code": 6
}
]
}
]
}
30 changes: 30 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Node.js CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: yarn --frozen-lockfile
- run: |
echo ::add-matcher::.github/eslint.json
yarn run eslint src test --format=compact
- run: yarn test
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
*.sublime-workspace
.DS_Store
dist/
test/output/
node_modules
npm-debug.log
5 changes: 1 addition & 4 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2017 Mike Bostock
Copyright 2017-2024 Mike Bostock

Permission to use, copy, modify, and/or distribute this software for any purpose
with or without fee is hereby granted, provided that the above copyright notice
Expand All @@ -12,8 +12,6 @@ OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
THIS SOFTWARE.



Philippe Rivière’s implementation of the Gray-Fuller raw projection (grayfuller.js)
belongs to the public domain.

Expand All @@ -26,4 +24,3 @@ belongs to the public domain.
>
> To the extent possible under law, Philippe Rivière has waived all copyright
> and related or neighboring rights to this implementation. (Public Domain.)

109 changes: 59 additions & 50 deletions README.md

Large diffs are not rendered by default.

13 changes: 0 additions & 13 deletions d3-geo-polygon.sublime-project

This file was deleted.

Binary file removed img/airocean.png
Binary file not shown.
Binary file removed img/cahillKeyes.png
Binary file not shown.
Binary file removed img/complexLog.png
Binary file not shown.
Binary file removed img/cox.png
Binary file not shown.
Binary file removed img/cubic.png
Binary file not shown.
Binary file removed img/dodecahedral.png
Binary file not shown.
Binary file removed img/icosahedral.png
Binary file not shown.
Binary file removed img/imago.png
Binary file not shown.
Binary file removed img/polyhedralButterfly.png
Binary file not shown.
Binary file removed img/polyhedralCollignon.png
Binary file not shown.
Binary file removed img/polyhedralWaterman.png
Binary file not shown.
Binary file removed img/tetrahedralLee.png
Binary file not shown.
Binary file removed img/tetrahedralLeeSouth.png
Binary file not shown.
53 changes: 31 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,18 @@
"name": "d3-geo-polygon",
"version": "1.12.1",
"description": "Clipping and geometric operations for spherical polygons.",
"homepage": "https://github.com/d3/d3-geo-polygon",
"repository": {
"type": "git",
"url": "https://github.com/d3/d3-geo-polygon.git"
},
"keywords": [
"d3",
"d3-module",
"cartography",
"projection",
"polygon"
],
"homepage": "https://github.com/d3/d3-geo-polygon",
"license": "ISC",
"author": {
"name": "Mike Bostock",
Expand All @@ -25,35 +29,40 @@
"url": "https://visionscarto.net"
}
],
"main": "dist/d3-geo-polygon.js",
"unpkg": "dist/d3-geo-polygon.min.js",
"jsdelivr": "dist/d3-geo-polygon.min.js",
"type": "module",
"files": [
"dist/**/*.js",
"src/**/*.js"
],
"module": "src/index.js",
"repository": {
"type": "git",
"url": "https://github.com/d3/d3-geo-polygon.git"
},
"scripts": {
"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"
"main": "src/index.js",
"jsdelivr": "dist/d3-geo-polygon.min.js",
"unpkg": "dist/d3-geo-polygon.min.js",
"exports": {
"umd": "./dist/d3-geo-polygon.min.js",
"default": "./src/index.js"
},
"sideEffects": false,
"dependencies": {
"d3-array": "1 - 2",
"d3-geo": "1.12.0 - 2"
"d3-array": "2.5.0 - 3",
"d3-geo": "2 - 3"
},
"sideEffects": false,
"devDependencies": {
"canvas": "1 - 2",
"eslint": "5",
"rollup": "0.64",
"rollup-plugin-terser": "1",
"tape": "4",
"@rollup/plugin-terser": "0.4",
"canvas": "2",
"eslint": "8",
"mocha": "10",
"pixelmatch": "5",
"pngjs": "6",
"rollup": "3",
"topojson-client": "3",
"world-atlas": "1"
},
"scripts": {
"test": "mocha 'test/**/*-test.js' && eslint src test",
"prepublishOnly": "rm -rf dist && rollup -c"
},
"engines": {
"node": ">=6.0.0"
"node": ">=12"
}
}
39 changes: 27 additions & 12 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,34 @@
import {terser} from "rollup-plugin-terser";
import * as meta from "./package.json";
import { readFileSync } from "fs";
import terser from "@rollup/plugin-terser";
import meta from "./package.json" assert { type: "json" };

// Extract copyrights from the LICENSE.
const copyright = readFileSync("./LICENSE", "utf-8")
.split(/\n/g)
.filter((line) => /^Copyright\s+/.test(line))
.map((line) => line.replace(/^Copyright\s+/, ""))
.join(", ");

const config = {
input: "src/index.js",
external: Object.keys(meta.dependencies || {}).filter(key => /^d3-/.test(key)),
external: Object.keys(meta.dependencies || {}).filter((key) =>
/^d3-/.test(key)
),
output: {
file: `dist/${meta.name}.js`,
name: "d3",
format: "umd",
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"})))
banner: `// ${meta.homepage} v${meta.version} Copyright ${copyright}`,
globals: Object.assign(
{},
...Object.keys(meta.dependencies || {})
.filter((key) => /^d3-/.test(key))
.map((key) => ({ [key]: "d3" }))
),
},
plugins: []
plugins: [],
};

export default [
Expand All @@ -22,15 +37,15 @@ export default [
...config,
output: {
...config.output,
file: `dist/${meta.name}.min.js`
file: `dist/${meta.name}.min.js`,
},
plugins: [
...config.plugins,
terser({
output: {
preamble: config.output.banner
}
})
]
}
preamble: config.output.banner,
},
}),
],
},
];
40 changes: 0 additions & 40 deletions src/adder.js

This file was deleted.

Loading
Loading