Skip to content

Commit

Permalink
Merge branch 'Turfjs:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
maral authored Nov 5, 2023
2 parents eaed409 + 6cb60c9 commit f47829e
Show file tree
Hide file tree
Showing 349 changed files with 11,170 additions and 6,572 deletions.
6 changes: 3 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ const rules = {
module.exports = {
root: true,
ignorePatterns: ["**/dist/**"],
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint"],
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
"prettier/@typescript-eslint",
"plugin:prettier/recommended",
],
parserOptions: {
ecmaVersion: 6,
sourceType: "module",
},
env: { es6: true },
env: { es6: true, node: true },
rules,

overrides: [
Expand Down
21 changes: 4 additions & 17 deletions .github/workflows/turf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,15 @@ jobs:

strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
node-version: [16.x, 18.x, 20.x]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

# figure out the yarn cache directory
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

# cache the yarn data to speed up builds
- uses: actions/cache@v2
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
cache: "yarn"

- run: yarn --frozen-lockfile
- run: git diff --exit-code
Expand Down
41 changes: 25 additions & 16 deletions .monorepolint.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,6 @@ module.exports = {
publishConfig: {
access: "public",
},
exports: {
"./package.json": "./package.json",
".": {
types: "./index.d.ts",
import: "./dist/es/index.js",
require: "./dist/js/index.js",
},
},
},
},
includePackages: [...TS_PACKAGES, ...JS_PACKAGES],
Expand All @@ -130,6 +122,14 @@ module.exports = {
entries: {
types: "dist/js/index.d.ts",
files: ["dist"],
exports: {
"./package.json": "./package.json",
".": {
types: "./dist/js/index.d.ts",
import: "./dist/es/index.js",
require: "./dist/js/index.js",
},
},
},
},
includePackages: TS_PACKAGES,
Expand All @@ -139,6 +139,14 @@ module.exports = {
entries: {
types: "index.d.ts",
files: ["dist", "index.d.ts"],
exports: {
"./package.json": "./package.json",
".": {
types: "./index.d.ts",
import: "./dist/es/index.js",
require: "./dist/js/index.js",
},
},
},
},
includePackages: JS_PACKAGES,
Expand All @@ -156,16 +164,16 @@ module.exports = {
{
options: {
scripts: {
docs: "node ../../scripts/generate-readmes",
test: "npm-run-all test:*",
docs: "tsx ../../scripts/generate-readmes.ts",
test: "npm-run-all --npm-path npm test:*",
},
},
excludePackages: [MAIN_PACKAGE],
},
{
options: {
scripts: {
build: "npm-run-all build:*",
build: "npm-run-all --npm-path npm build:*",
"build:js": "tsc",
"build:es":
'tsc --outDir dist/es --module esnext --declaration false && echo \'{"type":"module"}\' > dist/es/package.json',
Expand Down Expand Up @@ -194,31 +202,31 @@ module.exports = {
{
options: {
scripts: {
"test:tape": "node -r esm test.js",
"test:tape": "tsx test.js",
},
},
includePackages: JS_TAPE_PACKAGES,
},
{
options: {
scripts: {
"test:tape": "ts-node -r esm test.js",
"test:tape": "tsx test.js",
},
},
includePackages: TS_TAPE_PACKAGES,
},
{
options: {
scripts: {
bench: "node -r esm bench.js",
bench: "tsx bench.js",
},
},
includePackages: JS_TAPE_PACKAGES,
},
{
options: {
scripts: {
bench: "ts-node bench.js",
bench: "tsx bench.js",
},
},
includePackages: TS_TAPE_PACKAGES,
Expand Down Expand Up @@ -252,7 +260,7 @@ module.exports = {
tslib: "^2.3.0",
},
devDependencies: {
"ts-node": "*",
tsx: "*",
typescript: "*",
},
},
Expand All @@ -262,6 +270,7 @@ module.exports = {
options: {
devDependencies: {
rollup: "*",
tsx: "*",
},
},
includePackages: JS_PACKAGES,
Expand Down
7 changes: 7 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,10 @@ packages/turf-directional-mean/test/in/bus_route_utm.json

# is actually output
packages/turf/turf.min.js

# Ignore test fixture json in case intentional line breaks help with coord
# readability.
packages/turf-*/test/in/**
packages/turf-*/test/out/**
packages/turf-*/test/true/**
packages/turf-*/test/false/**
4 changes: 3 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
{}
{
"trailingComma": "es5"
}
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ We intend to keep making breaking changes before 7.0.0 is fully released. If you
- Move distribution JS to target ES2017 (#2237)
- [`@turf/helpers`](helpers) Correct the conversion factor for degrees (#2177)
- [`@turf/helpers`](helpers) polygon() will now throw if the first and last coordinates are not the same (#2173)
- [`@turf/helpers`](helpers) Separate AreaUnits into its own type (#2393)
- [`@turf/area`](area) Fix earth radius to use WGS84 median earth radius (#2166)
- [`@turf/turf`](turf) Remove re-exports for turf 4.x compatability (#2183)
- [`@turf/rectangle-grid`](rectangle-grid) Fix correctness for large areas (#2106)
Expand All @@ -22,6 +23,7 @@ We intend to keep making breaking changes before 7.0.0 is fully released. If you
- [`@turf/boolean-point-in-polygon`](boolean-point-in-polygon) Move to point-in-polygon-hao library for performance and correctness (#1893)
- [`@turf/line-intersect`][line-intersect] Move to sweepline-intersections library for performance (#2033)
- [`@turf/boolean-contains`](boolean-contains) Add multipolygon support (#2338)
- [`@turf/nearest-point`](nearest-point) Add unit option (#2415)

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

## 📖 Documentation
- [`@turf/bbox`][bbox] Improve documentation (#2153)
Expand All @@ -52,6 +57,9 @@ We intend to keep making breaking changes before 7.0.0 is fully released. If you
- [`@turf/buffer`](buffer) Clean up Typescript types (#2188)
- [`@turf/polygon-smooth`](polygon-smooth) Clean up a typo (#2293)
- [`@turf/nearest-point-on-line`](nearest-point-on-line) Clean up typescript types (#2296)
- [`@turf/boolean-touches`](boolean-touches) Add boolean-touches to docs (#2431)
- [`@turf/boolean-equals`](boolean-equals) Improve docs (#2412)

- Remove Bower references (#2146)
- Fix typo in README (#2313)
- Lots of cleanup for CONTRIBUTING, README, and RELEASING (#2186)
Expand All @@ -63,6 +71,7 @@ We intend to keep making breaking changes before 7.0.0 is fully released. If you
- [`@turf/turf](turf) Add booleanTouches export (#2170)
- [`@turf/turf](turf) Add booleanConcave export (#2265)
- [`@turf/helpers](helpers) Make isObject a little more accurate (#2176)
- Add custom types entry point to exports, required by Typescript for node16, nodenext and bundler module resolution strategies (#2400, #2452)
- types.ts tests are now run in strict mode (#2363)
- Uses tslib now for smaller bundles (#2165)
- Remove object-assign dependency from all packages (#2241)
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@

***A modular geospatial engine written in JavaScript***

[turfjs.org](http://turfjs.org/)
[turfjs.org](https://turfjs.org/)

- - -

[Turf](https://turfjs.org) is a [JavaScript library](https://en.wikipedia.org/wiki/JavaScript_library) for [spatial analysis](http://en.wikipedia.org/wiki/Spatial_analysis). It includes traditional spatial operations, helper functions for creating [GeoJSON](http://geojson.org) data, and data classification and statistics tools. Turf can be added to your website as a client-side plugin, or you can [run Turf server-side](https://www.npmjs.com/package/@turf/turf) with [Node.js](http://nodejs.org/) (see below).
[Turf](https://turfjs.org) is a [JavaScript library](https://en.wikipedia.org/wiki/JavaScript_library) for [spatial analysis](https://en.wikipedia.org/wiki/Spatial_analysis). It includes traditional spatial operations, helper functions for creating [GeoJSON](https://geojson.org) data, and data classification and statistics tools. Turf can be added to your website as a client-side plugin, or you can [run Turf server-side](https://www.npmjs.com/package/@turf/turf) with [Node.js](https://nodejs.org/) (see below).

## Installation

Expand Down Expand Up @@ -66,7 +66,7 @@ Ports of Turf.js are available in:

## Data in Turf

Turf uses <a href='http://geojson.org/'>GeoJSON</a> for all geographic data. Turf expects the data to be standard <a href='http://en.wikipedia.org/wiki/World_Geodetic_System'>WGS84</a> longitude, latitude coordinates. Check out <a href='http://geojson.io/#id=gist:anonymous/844f013aae8354eb889c&map=12/38.8955/-77.0135'>geojson.io</a> for a tool to easily create this data.
Turf uses <a href='https://geojson.org/'>GeoJSON</a> for all geographic data. Turf expects the data to be standard <a href='https://en.wikipedia.org/wiki/World_Geodetic_System'>WGS84</a> longitude, latitude coordinates. Check out <a href='https://geojson.io/#id=gist:anonymous/844f013aae8354eb889c&map=12/38.8955/-77.0135'>geojson.io</a> for a tool to easily create this data.

> **NOTE:** Turf expects data in (longitude, latitude) order per the GeoJSON standard.
Expand Down
1 change: 1 addition & 0 deletions documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ toc:
- booleanParallel
- booleanPointInPolygon
- booleanPointOnLine
- booleanTouches
- booleanWithin
- name: Unit Conversion
- bearingToAzimuth
Expand Down
2 changes: 1 addition & 1 deletion examples/browser/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down
2 changes: 1 addition & 1 deletion examples/create-react-app/public/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down
2 changes: 1 addition & 1 deletion examples/es-modules-single-module/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down
2 changes: 1 addition & 1 deletion examples/es-modules/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down
13 changes: 3 additions & 10 deletions lerna.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
{
"packages": [
"packages/*"
],
"npmClient": "yarn",
"version": "7.0.0-alpha.2",
"command": {
"bootstrap": {
"useWorkspaces": true,
"ignoreScripts": true
},
"publish": {
"registry": "https://registry.npmjs.org"
}
},
"npmClient": "yarn",
"version": "7.0.0-alpha.0"
}
}
22 changes: 22 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"tasksRunnerOptions": {
"default": {
"runner": "nx/tasks-runners/default",
"options": {
"cacheableOperations": ["build", "test", "last-checks"]
}
}
},
"targetDefaults": {
"build": {
"dependsOn": ["^build"],
"outputs": ["{projectRoot}/dist"]
},
"test": {
"dependsOn": ["^test"]
},
"last-checks": {
"dependsOn": ["^last-checks"]
}
}
}
28 changes: 15 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
"lint:escheck-esm": "es-check --module es8 packages/*/dist/es/index.js",
"lint:escheck-es5": "es-check es5 packages/turf/turf.min.js",
"postlint": "documentation lint packages/turf-*/index.js",
"prepare": "lerna bootstrap && lerna run build && node ./scripts/add-import-extensions.js",
"prepare": "lerna run build && node ./scripts/add-import-extensions.js",
"pretest": "npm run lint",
"test": "lerna run test",
"posttest": "lerna run --scope @turf/turf last-checks",
"docs": "node ./scripts/generate-readmes"
"docs": "tsx ./scripts/generate-readmes.ts"
},
"husky": {
"hooks": {
Expand All @@ -39,33 +39,35 @@
},
"devDependencies": {
"@types/geojson": "7946.0.8",
"@types/node": "^17.0.2",
"@typescript-eslint/eslint-plugin": "^4.8.0",
"@typescript-eslint/parser": "^4.8.0",
"@types/node": "18.11.9",
"@typescript-eslint/eslint-plugin": "^6.8.0",
"@typescript-eslint/parser": "^6.8.0",
"acorn": "^7.4.1",
"camelcase": "*",
"d3-queue": "*",
"decamelize": "*",
"dependency-tree": "^8.1.2",
"documentation": "^13.2.5",
"es-check": "^5.1.4",
"eslint": "~7.13.0",
"eslint-config-prettier": "^6.15.0",
"documentation": "^14.0.2",
"es-check": "^7.1.1",
"eslint": "^8.51.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.1",
"esm": "^3.2.25",
"fs-extra": "*",
"husky": "^4.2.3",
"lerna": "^4.0.0",
"lerna": "^7.3.0",
"lint-staged": "^10.0.8",
"load-json-file": "*",
"meow": "*",
"monorepolint": "^0.5.0-alpha.20",
"npm-run-all": "^4.1.5",
"prettier": "^2.1.2",
"prettier": "^3.0.3",
"progress": "*",
"rollup": "^2.34.2",
"tape": "*",
"tape": "^5.7.0",
"ts-node": "^9.0.0",
"typescript": "^3.8.3",
"tsx": "^3.12.8",
"typescript": "^5.2.2",
"yamljs": "*"
}
}
Loading

0 comments on commit f47829e

Please sign in to comment.