Skip to content

Commit dd39d0f

Browse files
Merge branch 'master' into fix-cleancoords
2 parents 9821561 + a8de40d commit dd39d0f

File tree

215 files changed

+8658
-4842
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

215 files changed

+8658
-4842
lines changed

.eslintrc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ const rules = {
1414
module.exports = {
1515
root: true,
1616
ignorePatterns: ["**/dist/**"],
17+
parser: "@typescript-eslint/parser",
1718
plugins: ["@typescript-eslint"],
1819
extends: [
1920
"eslint:recommended",
2021
"plugin:@typescript-eslint/recommended",
21-
"prettier",
22-
"prettier/@typescript-eslint",
22+
"plugin:prettier/recommended",
2323
],
2424
parserOptions: {
2525
ecmaVersion: 6,

.github/workflows/turf.yml

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,15 @@ jobs:
1515

1616
strategy:
1717
matrix:
18-
node-version: [14.x, 16.x, 18.x, 20.x]
18+
node-version: [16.x, 18.x, 20.x]
1919

2020
steps:
21-
- uses: actions/checkout@v2
21+
- uses: actions/checkout@v3
2222
- name: Use Node.js ${{ matrix.node-version }}
23-
uses: actions/setup-node@v1
23+
uses: actions/setup-node@v3
2424
with:
2525
node-version: ${{ matrix.node-version }}
26-
27-
# figure out the yarn cache directory
28-
- name: Get yarn cache directory path
29-
id: yarn-cache-dir-path
30-
run: echo "::set-output name=dir::$(yarn cache dir)"
31-
32-
# cache the yarn data to speed up builds
33-
- uses: actions/cache@v2
34-
id: yarn-cache
35-
with:
36-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
37-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
38-
restore-keys: |
39-
${{ runner.os }}-yarn-
26+
cache: "yarn"
4027

4128
- run: yarn --frozen-lockfile
4229
- run: git diff --exit-code

.monorepolint.config.ts

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,6 @@ module.exports = {
113113
publishConfig: {
114114
access: "public",
115115
},
116-
exports: {
117-
"./package.json": "./package.json",
118-
".": {
119-
types: "./index.d.ts",
120-
import: "./dist/es/index.js",
121-
require: "./dist/js/index.js",
122-
},
123-
},
124116
},
125117
},
126118
includePackages: [...TS_PACKAGES, ...JS_PACKAGES],
@@ -130,6 +122,14 @@ module.exports = {
130122
entries: {
131123
types: "dist/js/index.d.ts",
132124
files: ["dist"],
125+
exports: {
126+
"./package.json": "./package.json",
127+
".": {
128+
types: "./dist/js/index.d.ts",
129+
import: "./dist/es/index.js",
130+
require: "./dist/js/index.js",
131+
},
132+
},
133133
},
134134
},
135135
includePackages: TS_PACKAGES,
@@ -139,6 +139,14 @@ module.exports = {
139139
entries: {
140140
types: "index.d.ts",
141141
files: ["dist", "index.d.ts"],
142+
exports: {
143+
"./package.json": "./package.json",
144+
".": {
145+
types: "./index.d.ts",
146+
import: "./dist/es/index.js",
147+
require: "./dist/js/index.js",
148+
},
149+
},
142150
},
143151
},
144152
includePackages: JS_PACKAGES,
@@ -156,16 +164,16 @@ module.exports = {
156164
{
157165
options: {
158166
scripts: {
159-
docs: "node ../../scripts/generate-readmes",
160-
test: "npm-run-all test:*",
167+
docs: "tsx ../../scripts/generate-readmes",
168+
test: "npm-run-all --npm-path npm test:*",
161169
},
162170
},
163171
excludePackages: [MAIN_PACKAGE],
164172
},
165173
{
166174
options: {
167175
scripts: {
168-
build: "npm-run-all build:*",
176+
build: "npm-run-all --npm-path npm build:*",
169177
"build:js": "tsc",
170178
"build:es":
171179
'tsc --outDir dist/es --module esnext --declaration false && echo \'{"type":"module"}\' > dist/es/package.json',
@@ -194,31 +202,31 @@ module.exports = {
194202
{
195203
options: {
196204
scripts: {
197-
"test:tape": "node -r esm test.js",
205+
"test:tape": "tsx test.js",
198206
},
199207
},
200208
includePackages: JS_TAPE_PACKAGES,
201209
},
202210
{
203211
options: {
204212
scripts: {
205-
"test:tape": "ts-node -r esm test.js",
213+
"test:tape": "tsx test.js",
206214
},
207215
},
208216
includePackages: TS_TAPE_PACKAGES,
209217
},
210218
{
211219
options: {
212220
scripts: {
213-
bench: "node -r esm bench.js",
221+
bench: "tsx bench.js",
214222
},
215223
},
216224
includePackages: JS_TAPE_PACKAGES,
217225
},
218226
{
219227
options: {
220228
scripts: {
221-
bench: "ts-node bench.js",
229+
bench: "tsx bench.js",
222230
},
223231
},
224232
includePackages: TS_TAPE_PACKAGES,
@@ -252,7 +260,7 @@ module.exports = {
252260
tslib: "^2.3.0",
253261
},
254262
devDependencies: {
255-
"ts-node": "*",
263+
tsx: "*",
256264
typescript: "*",
257265
},
258266
},
@@ -262,6 +270,7 @@ module.exports = {
262270
options: {
263271
devDependencies: {
264272
rollup: "*",
273+
tsx: "*",
265274
},
266275
},
267276
includePackages: JS_PACKAGES,

.prettierignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,10 @@ packages/turf-directional-mean/test/in/bus_route_utm.json
1010

1111
# is actually output
1212
packages/turf/turf.min.js
13+
14+
# Ignore test fixture json in case intentional line breaks help with coord
15+
# readability.
16+
packages/turf-*/test/in/**
17+
packages/turf-*/test/out/**
18+
packages/turf-*/test/true/**
19+
packages/turf-*/test/false/**

.prettierrc.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
{}
1+
{
2+
"trailingComma": "es5"
3+
}

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ We intend to keep making breaking changes before 7.0.0 is fully released. If you
77
- Move distribution JS to target ES2017 (#2237)
88
- [`@turf/helpers`](helpers) Correct the conversion factor for degrees (#2177)
99
- [`@turf/helpers`](helpers) polygon() will now throw if the first and last coordinates are not the same (#2173)
10+
- [`@turf/helpers`](helpers) Separate AreaUnits into its own type (#2393)
1011
- [`@turf/area`](area) Fix earth radius to use WGS84 median earth radius (#2166)
1112
- [`@turf/turf`](turf) Remove re-exports for turf 4.x compatability (#2183)
1213
- [`@turf/rectangle-grid`](rectangle-grid) Fix correctness for large areas (#2106)
@@ -22,6 +23,7 @@ We intend to keep making breaking changes before 7.0.0 is fully released. If you
2223
- [`@turf/boolean-point-in-polygon`](boolean-point-in-polygon) Move to point-in-polygon-hao library for performance and correctness (#1893)
2324
- [`@turf/line-intersect`][line-intersect] Move to sweepline-intersections library for performance (#2033)
2425
- [`@turf/boolean-contains`](boolean-contains) Add multipolygon support (#2338)
26+
- [`@turf/nearest-point`](nearest-point) Add unit option (#2415)
2527

2628
## 🐛 Bug Fixes
2729
- [`@turf/polygon-smooth`](polygon-smooth) Options argument is now actually optional (#2149)
@@ -42,6 +44,9 @@ We intend to keep making breaking changes before 7.0.0 is fully released. If you
4244
- [`@turf/boolean-within`](boolean-within) Fix multipoint checks (#2216)
4345
- [`@turf/points-within-polygon`](points-within-polygon) Fix dropped properties on MultiPoint results (#2227)
4446
- [`@turf/random`](random) Throws error on invalid bbox inputs (#2172)
47+
- [`@turf/boolean-parallel`](boolean-parallel) Lines with 180 degree angle between them are also considered parallel (#2475)
48+
- [`@turf/unkink-polygon`](unkink-polygon) Fix a maximum call stack size exceeded error with very large polygons (#2504)
49+
- [`@turf/line-arc`](line-arc) Number of arc segments generated wasn't related to steps value passed in (#2524)
4550

4651
## 📖 Documentation
4752
- [`@turf/bbox`][bbox] Improve documentation (#2153)
@@ -52,6 +57,9 @@ We intend to keep making breaking changes before 7.0.0 is fully released. If you
5257
- [`@turf/buffer`](buffer) Clean up Typescript types (#2188)
5358
- [`@turf/polygon-smooth`](polygon-smooth) Clean up a typo (#2293)
5459
- [`@turf/nearest-point-on-line`](nearest-point-on-line) Clean up typescript types (#2296)
60+
- [`@turf/boolean-touches`](boolean-touches) Add boolean-touches to docs (#2431)
61+
- [`@turf/boolean-equals`](boolean-equals) Improve docs (#2412)
62+
5563
- Remove Bower references (#2146)
5664
- Fix typo in README (#2313)
5765
- Lots of cleanup for CONTRIBUTING, README, and RELEASING (#2186)
@@ -63,6 +71,7 @@ We intend to keep making breaking changes before 7.0.0 is fully released. If you
6371
- [`@turf/turf](turf) Add booleanTouches export (#2170)
6472
- [`@turf/turf](turf) Add booleanConcave export (#2265)
6573
- [`@turf/helpers](helpers) Make isObject a little more accurate (#2176)
74+
- Add custom types entry point to exports, required by Typescript for node16, nodenext and bundler module resolution strategies (#2400, #2452)
6675
- types.ts tests are now run in strict mode (#2363)
6776
- Uses tslib now for smaller bundles (#2165)
6877
- Remove object-assign dependency from all packages (#2241)

documentation.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ toc:
143143
- booleanParallel
144144
- booleanPointInPolygon
145145
- booleanPointOnLine
146+
- booleanTouches
146147
- booleanWithin
147148
- name: Unit Conversion
148149
- bearingToAzimuth

examples/browser/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="utf-8" />

examples/create-react-app/public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="utf-8" />

examples/es-modules-single-module/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="utf-8" />

examples/es-modules/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html lang="en">
33
<head>
44
<meta charset="utf-8" />

lerna.json

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
{
2-
"packages": [
3-
"packages/*"
4-
],
2+
"npmClient": "yarn",
3+
"version": "7.0.0-alpha.2",
54
"command": {
6-
"bootstrap": {
7-
"useWorkspaces": true,
8-
"ignoreScripts": true
9-
},
105
"publish": {
116
"registry": "https://registry.npmjs.org"
127
}
13-
},
14-
"npmClient": "yarn",
15-
"version": "7.0.0-alpha.0"
8+
}
169
}

nx.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"tasksRunnerOptions": {
3+
"default": {
4+
"runner": "nx/tasks-runners/default",
5+
"options": {
6+
"cacheableOperations": ["build", "test", "last-checks"]
7+
}
8+
}
9+
},
10+
"targetDefaults": {
11+
"build": {
12+
"dependsOn": ["^build"],
13+
"outputs": ["{projectRoot}/dist"]
14+
},
15+
"test": {
16+
"dependsOn": ["^test"]
17+
},
18+
"last-checks": {
19+
"dependsOn": ["^last-checks"]
20+
}
21+
}
22+
}

package.json

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"lint:escheck-esm": "es-check --module es8 packages/*/dist/es/index.js",
1414
"lint:escheck-es5": "es-check es5 packages/turf/turf.min.js",
1515
"postlint": "documentation lint packages/turf-*/index.js",
16-
"prepare": "lerna bootstrap && lerna run build && node ./scripts/add-import-extensions.js",
16+
"prepare": "lerna run build && node ./scripts/add-import-extensions.js",
1717
"pretest": "npm run lint",
1818
"test": "lerna run test",
1919
"posttest": "lerna run --scope @turf/turf last-checks",
@@ -39,33 +39,35 @@
3939
},
4040
"devDependencies": {
4141
"@types/geojson": "7946.0.8",
42-
"@types/node": "^17.0.2",
43-
"@typescript-eslint/eslint-plugin": "^4.8.0",
44-
"@typescript-eslint/parser": "^4.8.0",
42+
"@types/node": "18.11.9",
43+
"@typescript-eslint/eslint-plugin": "^6.8.0",
44+
"@typescript-eslint/parser": "^6.8.0",
4545
"acorn": "^7.4.1",
4646
"camelcase": "*",
4747
"d3-queue": "*",
4848
"decamelize": "*",
4949
"dependency-tree": "^8.1.2",
50-
"documentation": "^13.2.5",
51-
"es-check": "^5.1.4",
52-
"eslint": "~7.13.0",
53-
"eslint-config-prettier": "^6.15.0",
50+
"documentation": "^14.0.2",
51+
"es-check": "^7.1.1",
52+
"eslint": "^8.51.0",
53+
"eslint-config-prettier": "^9.0.0",
54+
"eslint-plugin-prettier": "^5.0.1",
5455
"esm": "^3.2.25",
5556
"fs-extra": "*",
5657
"husky": "^4.2.3",
57-
"lerna": "^4.0.0",
58+
"lerna": "^7.3.0",
5859
"lint-staged": "^10.0.8",
5960
"load-json-file": "*",
6061
"meow": "*",
6162
"monorepolint": "^0.5.0-alpha.20",
6263
"npm-run-all": "^4.1.5",
63-
"prettier": "^2.1.2",
64+
"prettier": "^3.0.3",
6465
"progress": "*",
6566
"rollup": "^2.34.2",
66-
"tape": "*",
67+
"tape": "^5.7.0",
6768
"ts-node": "^9.0.0",
68-
"typescript": "^3.8.3",
69+
"tsx": "^3.12.8",
70+
"typescript": "^5.2.2",
6971
"yamljs": "*"
7072
}
7173
}

0 commit comments

Comments
 (0)