211 Commits

Author SHA1 Message Date
James Beard
b7f1b4eafb v7.3.1 2025-11-27 17:43:27 +11:00
mfedderly
5a34d08b07
Bump glob@11 package.json entries (#2961) 2025-11-23 05:58:22 -05:00
mfedderly
3cc76a2290
Remove npm-run-all in favor of pnpm regex script name functionality (#2960) 2025-11-22 20:23:41 -05:00
James Beard
9f58a103e8 v7.3.0 2025-11-17 20:08:41 +11:00
James Beard
74c194ab56 Merge branch 'master' into build-tools-update 2025-05-04 21:53:40 +10:00
mfedderly
b321266374
Migrate from workspace:^ to workspace:* to pin dependency versions (#2878) 2025-05-03 14:03:24 -04:00
James Beard
fe3492acbd Updated other dev dependencies such as es-check, write-json-file, rollup, and babel. 2025-04-30 21:09:52 +10:00
James Beard
b8d4d7ed81 Intermediate commit right after pnpm interactive update and a monorepolint run to bring package versions into line with root level updates. Most significant being tsup, tsx, and typescript. Some types tests now failing though. 2025-04-30 17:09:24 +10:00
anubhav
7b27bf37dc Updated description in package.json for multiple packages 2024-12-31 12:45:36 +05:30
James Beard
7b0f0374c4 v7.2.0 2024-12-28 15:28:13 +11:00
Colin Murphy
3bbd7590c4
Replaced polygon-clipping with polyclip-ts (#2729)
* Replaced polygon-clipping with polyclip-ts

---------

Co-authored-by: colin <cmurphy@terabase.energy>
Co-authored-by: James Beard <james@smallsaucepan.com>
2024-12-22 18:01:00 +11:00
James Beard
42ad7b8fb0
Build housekeeping for December (#2760)
* Updated tape, tsup, tsx, and tslib dependencies in monorepo packages.

* Updated other build dependencies such as monorepolint, babel, rollup, and lerna. Removed MRL rule for rollup version as we only use it in one package.

* Upgraded eslint dependencies and config file.
2024-12-05 20:08:29 +11:00
James Beard
e7227f51b7
Preliminary improvements to documentation, esp internal types e.g. Units (#2727)
* Added JSDoc for internal types and constants e.g. Unts and earthRadius. Minimal other changes to bring JSDoc types into line with code types. Added GeoJsonProperties to documentation.yml for type linking.

* Generated README.md files based on updated source that now includes JSDoc for internal types and constants e.g. Units. Also synced up some out of data JSDoc types with what is in the code.

* Switched the structure of documentation.yml to be more traditionally nested. We'll use this new structure from the turf-www repo to generate the website documentation in a more robust manner.

* For some reason leaving this function documented as the default (geojsonRbush) causes @turf/turf last-checks to fail. Specifically defining it as rbush like it used to be, except with the @function tag rather than @name.
2024-10-11 12:56:42 +11:00
mfedderly
6889237200
Upgraded typescript to 5.5.4 (#2684)
Co-authored-by: Tim Welch <tim.j.welch@gmail.com>
2024-08-22 14:10:25 +10:00
Tim Welch
991415d1fc
v7.1.0 (#2697) 2024-08-09 11:41:38 -07:00
mfedderly
c8f24e0171
Update @types/geojson to 7946.0.10 minimum (#2688)
Co-authored-by: Tim Welch <tim.j.welch@gmail.com>
2024-08-08 12:53:24 -04:00
mfedderly
2fbb518991
Add explicit geojson types dependency (#2676)
* Use monorepolint to enforce @types/geojson dependency on all packages

* Apply monorepolint and run pnpm install
2024-08-07 11:34:16 -04:00
James Beard
f3d51729c0
Resolved critical parse-url vulnerability (dependency of documentation.js). Regenerated all READMEs, only changes being a shuffling of the internal link cross references. (#2664) 2024-07-28 10:20:04 +10:00
Matt Fedderly
3d3a791702
v7.0.0 2024-06-07 09:41:56 -04:00
James Beard
e0bdd0add8
Converting packages to type: module by default (#2565)
Updating Turf packags to be ESM modules rather than a CommonJS project. The build still generates and packages both ESM and CJS variants of implementation and types. From a client perspective, nothing should change about the way Turf modules are loaded or called.


* Marking all packages as "ESM first", with additional CJS files for compatibility. Flow on changes from that include requiring a js extension for relative includes, and workarounds for a couple of older third party libraries that were no longer importing smoothly. Builds successfully. Updating tests next.

* Adding js extension to more local imports in tests, and removing references to __dirname. Added some re-exporting wrapper files for older packages like rbush and sweepline-intersections. See turf-line-intersects for an example.

* Disabling some type tests in packages we were having export / import issues in post type: module. Maybe someone in future can exercise some typescript jujitsu to re-enable them.

* Reverting dist/ generated JS to .js extension where possible. Was identified that the .cjs extension was causing problems for some consumers. Would have like to use .d.ts rather .d.cts for CJS type defs, but there's a but in tsup at the moment that won't allow that to be customised.

* Reintroducing __dirname references, though need to add implementation as not supplied automatically by node any more. Updating benchmark tests. Adding some missing bench and tape @types libraries.

* Added a few __dirname references that should have been included, and removed a few that had inadvertently been added.

* Explicitly using cjs extension for CommonJS distributed source files. Got disabled types tests working again by adjusting tsc command (needed to include node16 module and moduleResolution switched on command line). Also needed to refer to "index", etc as "index.js", etc from test.ts files to avoid "Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16'" errors.

* Missed a .js -> .cjs in turf/turf last-checks target.

* Removing hacky cjs/esm export/import wrappers in favour of defaultImport library which takes care of finding the correct default to import from CJS packages.

* Revert "Removing hacky cjs/esm export/import wrappers in favour of defaultImport library which takes care of finding the correct default to import from CJS packages."

This reverts commit f8184c3fb124369b36fb9afa4e1aa83543417e42.

* Found a few more spots to add a js extension to satisfy newer node16 module resolution.
2024-03-12 10:41:26 +11:00
mfedderly
0baf26e187
Upgrade monorepolint and rework its config to match the new pnpm work (#2557)
* Upgrade monorepolint and rework its config to match the new pnpm work

* Remove some unused monorepolint variables

* Revert dbscan change

* Add glob explicitly
2023-12-19 16:44:57 -05:00
James Beard
4ea81e6b96
Migration to pnpm and improved exports strategy (#2555)
* Moving to pnpm as package manager. Also taking the opportunity to tidy up our cjs / esm situation using tsup (instead of tsc and rollup). Can't get monorepolint to work with new setup so disabling for the time being.

* Changing all Turf imports to use named imports. Adding a few missing named exports. Updating github workflow actions to pnpm instead of yarn.

* Updating typescript module and moduleResolution mechanisms to "node16". Not tracking nodenext just yet. Changing tsup command to generate d.ts files that arethetypeswrong approves of.

* Tweaking github workflows to explicitely install pnpm.

* Looks like node needs the chosen cache binary installed first. Trying without cache as a first step.

* Seem to be hitting the tsx bug described here: https://github.com/privatenumber/tsx/issues/421 Upgrading to latest tsx to remedy.

* Forgot to update lock file after updating tsx dep in package.json files.

* Sorting modules exported from @turf/turf alphabetically. Preparatory commit to add unexported modules.

* Converting index.mjs to typescript, and simplifying re-exported imports, and ordering alphabetically. Added in a couple of packages - convex, booleanValid and nearestNeighbourAnalysis. Rollup now only used in packages/turf so merging project root base config into there. Also now only using rollup in packages/turf to do final conversion to web module. JS and d.ts files generated the same as other modules, using tsup.

* Including tslib in @turf/turf build now that it's a TS module.

* Lot of per-package tsconfig items now on the tsup command line, so stripping back tsconfig.json to the bare minimum. Adding tsconfig.json to packages that while still only JS, are now processed by tsup.

* Same as last commit - simplifying tsconfig.json - except these are the subset of packages that had multiple entry points e.g. 3rd party code hosted locally in lib/

* Incorporating some suggestions from @favna on being more explicit with d.ts entries. https://github.com/Turfjs/turf/issues/2307#issuecomment-1858653048  Specifying overall module type as commonjs explicitly.

* Reapplying cjsInterop / splitting workaround for CJS exports that we had on build target command line earlier in this PR in to tsup config file. Also disabling treeshaking as this was generating a warning for CJS files and causing the workaround above to not work.

* Upgrading rollup and related plugins. Updating to recommended modern browserslist config in babel.config.json e.g. previous chrome 67 and edge 17 are 5 years old, ie11 is just ... ugh

* Fluffed the browserslist config - need to cover es5 as well.

* Update .github/workflows/turf.yml to use actions/checkout v4.

Co-authored-by: Jeroen Claassens <jeroen.claassens@live.nl>

---------

Co-authored-by: Jeroen Claassens <jeroen.claassens@live.nl>
2023-12-19 10:14:18 +11:00
James Beard
d83e5801ac
Convert tests to Typescript, change require to import, and add named exports to modules (#2550)
* Converting bench.js and test.js to Typescript. Adding along as a named export as well as the default.

* Converting bench.js and test.js to Typescript and ESM import. Adding angle as a named export as well as the default.

* Converting bench.js and test.js to Typescript and ESM import. Adding area as a named export as well as the default.

* Making turf last-checks a bit more flexible as we will have a mix of JS and TS test files for a while.

* Converting bench.js and test.js to Typescript and ESM import, and adding named exports as well as the default export for modules:

bbox
bboxCliip
bboxPolygon
bearing
bezierSpline
booleanClockwise
booleanConcave
booleanContains
booleanCrosses
booleanDisjoint
booleanEqual
booleanIntersect
booleanOverlap
booleanParallel
booleanPointInPolygon
booleanPointOnLine
booleanTouches
booleanValid
booleanWithin

* Converting bench.js and test.js to Typescript and ESM import for remaining Typescript modules. Also adding named exports in addition to the default export for those same modules.

* Proceeding with migrating remaining tests to Typescript. Still a few to do - waiting for PR #2543 to merge first to avoid conflicts.

* Converting bench.js and test.js to Typescript and ESM import for some more Typescript modules (postponed until recent PRs merged). Also adding named exports in addition to the default export for those same modules.

* Banishing a couple more require() calls from module code.

* Retiring custom rollup typescript plugin. Problem it was designed to address probably fixed by a previous typescript upgrade. Removing redundant es5 checking script that hasn't been used for a while as well.
2023-12-05 19:04:54 +11:00
James Beard
66f9b2d26d
Migrating remaining JS modules to Typescript (part 1) (#2543)
* Converting turf-ellipse to typescript.

* Converting turf-flip to typescript.

* Forgot to remove redundant turf-flip index.d.ts

* Converting turf-flatten to typescript.

* Converting turf-explode to typescript.

* Converting turf-envelope to typescript.

* Converting turf-dissolve to Typescript. Missed a couple of changes to turf-flip package.json in an earlier commit.

* Converting turf-rewind to Typescript.

* Converting turf-tag to Typescript.

* Converting turf-sample to Typescript. Forgot to delete d.ts from turf-tag during last commit.

* Converting turf-point-on-feature to Typescript.

* Converting turf-points-within-polygon to Typescript. One type test isn't working just yet (mixed Points and MultiPoints). Need to confirm this is actually valid use of the function.

* Converting turf-polygon-smooth to Typescript.

* Revisiting turf-points-within-polygon as it needs to be able to accept a mixture of Point and MultiPoint features.

* Converting turf-polygon-tangents to Typescript. Few oddities uncovered here. First was that an unnecessary parameter (polygon) was being passed to processPolygon. Second was enext param passed into processPolygon was simply being overwritten and not returned - converted to a local const. Noting in history in case a future developer is chasing a bug.

* Converting turf-sector to Typescript. Forgot to remove d.ts from turf-polygon-tangents in a prior commit.

* Converting turf-shortest-path to Typescript. Adding type test step into turf-sector (test existed, just weren't being run).

* Converting turf-simplify to Typescript.

* Converting turf-difference to Typescript.

* Removing rollup from freshly converted typescript modules. Lots of minor monorepolint fixes. Overloading a few function signatures so types.ts test pass. Fixing a few places where option parsing / defaults was half baked. Fixing a couple of modules with built in libs that were building locally but not when doing the final turf CDN build.

* Removing minDistance param from turf-shortest-path per this convo https://github.com/Turfjs/turf/discussions/2538#discussioncomment-7614613 Changing options handling to not change the options object in place. Removing a couple of missed d.ts files.

* Incorporating review feedback, including: subbing ?? for || in option handling in a few places, fixing overloaded function typedefs, reinstating some incorrectly removed runtime checks, adding license details for types we pulled in for locally hosted libraries.
2023-11-28 23:13:18 +11:00
James Beard
948f57e8c6
Upgrading all project dependencies (except monorepolint - troublesome) to latest versions. Some code changes required though only to utility and test scripts, and then only function name changes e.g. load.sync() is now loadJsonFileSync() in the latest version. Removing chroma-js as a turf-isobands devDependency as it doesn't seem to be used. (#2532) 2023-11-10 09:09:26 -05:00
James Beard
6cb60c951d
Update generate-readmes script to typescript, update content wording, and regenerate all readmes (#2528)
* Fix generate-docs to work with tsx (add extension, fix a few TS errors). monorepolint rule changed to reflect ts file extension. Add node to eslint env config so editors can find definitions of node variables (such as __dirname) used in scripts.

* Change project root docs target to use tsx and generate-docs.ts. Tighten up gnerates-docs.ts folder globbing - was inadvertently matching when my working parent directory was named something like ~/code/turf-docs-test/... interpreting docs-test as a package name. Reworded readme postfix content to be clearer on the different ways of installing. Updated a few links from http to https.

* Result of running yarn docs from the project root with the previously committed changes.

* Applying recently merged changes (from PR #2523) to this new module.
2023-11-03 20:22:53 +11:00
James Beard
f6e64ff826
Upgrade lerna, et al to address security vulnerabilities, modernise build environment (#2507)
* Upgrading to newest @types/node for the typescript version we currently use (3.8.3). https://www.npmjs.com/package/@types/node?activeTab=versions

* Big update to lerna to address security vulnerabilities. bootstrap command no longer required. Seems to build and test ok. May need some tweaking. Will add build caching at a later date.

* Updating documentation (the NPM library) to address security vulnerabilities. Had to wrap body of script so as be async, though otherwise unchanged.

* Updating es-check to address security vulnerabilities.

* Updating tape library to address security vulnerabilities.

* Add lerna caching (via nx). Simplistic setup so will need some tweaking. Remove redundant packages setting from lerna.json (will default to packages setting in package.json instead). Have to add --npm-path to all npm-run-all calls so that lerna doesn't accidentally end up being used as the npm binary. https://github.com/mysticatea/npm-run-all/issues/218 and https://github.com/lerna/lerna/issues/1842 have more details.

* Missed a couple of carats in package.json dependency specs.

* Also need to commit a new yarn.lock file to reflect version spec changes in previous commit.

---------

Co-authored-by: mfedderly <mdfedderly@mdfedderly.com>
2023-10-06 16:48:20 -04:00
mfedderly
dd35b52725
Release 7.0.0-alpha.2 (#2503)
* Update changelog for next prerelease

* v7.0.0-alpha.2
2023-10-02 09:52:37 -04:00
mfedderly
cf7a0c507b
Do the 7.0.0-alpha.1 release (#2493)
* update changelog

* v7.0.0-alpha.1

* More changelog
2023-09-18 19:41:14 -04:00
James Beard
4469661e09
Replace ts-node with tsx in doc and test related build scripts (#2489)
* MRL configuration changes to replace ts-node with tsx, a more robust TS runtime. Will run MRL --fix and commit per-package changes next.

* JS projects can also rely on tsx to run scripts that used to be run by node.

* Need to keep ts-node around (at the monorepo level at least) for monorepolint.

* Almost entirely MRL automatic fixes for tsx dev dependencies, bench, doc, and test:tape. Hand edited last-checks scripts in packages/turf/
2023-09-10 20:15:59 -04:00
Evgeny
625b4205df
Support TS node16, nodenext and bundler module resolutions (#2400)
* Support TS node16, nodenext and bundler module resoutions

Support TypeScript node16, nodenext and bundler module resolutions.

* Fix mrl config to require exports.types

* Fix all packages to have exports.types
2023-03-07 19:16:05 +00:00
mfedderly
0edc4c491b
Changelog + Release for 7.0.0-alpha.0 (#2364)
* (huge) changelog

* v7.0.0-alpha.0

* Update yarn.lock to handle the fact that our dependencies take dependencies on turf itself

Co-authored-by: Matt Fedderly <mfedderly@palantir.com>
2022-11-09 10:09:15 -05:00
mfedderly
f62ba326cb
Fix docs generation (#2279)
* Fix generate-readmes script to work with typescript packages

* auto generated changes from generate-readmes and new documentationjs version

* Update husky to enforce docs builds at commit time
2022-04-02 12:52:52 -04:00
mfedderly
15268af737
FeatureCollection args for @turf/difference @turf/intersect @turf/union (#2247)
* @turf/union - accept FeatureCollection for multiple inputs

* @turf/difference - accept FeatureCollection for multiple inputs

* @turf/intersect - accept FeatureCollection for multiple inputs

* @turf/hex-grid and @turf/triangle-grid - options.mask must be a Feature<Polygon>

* Fix examples
2022-01-17 16:37:14 -05:00
Tim Welch
d72985ce1a
Migrate to @types/geojson package (#2158)
* migrate to geojson types package

* strip geojson further

* migrate geojson type imports

* migrate more geojson type imports

* bump to geojson-rbush 3.2.0 and add line-overlap fix

* few more type migrations

* migrate to new internal es5 @turf/geojson-rbush

* migrate buffer to geojson types

* fix convertLength import
2021-10-24 23:07:07 -07:00
Rowan Winsemius
5375941072
Prepare for release of 6.5.0 (#2141)
* Update change log for 6.5.0 release

* bump version numbers
2021-07-10 20:12:28 +10:00
mfedderly
6a52e5b0b0
Opencollective postinstall -> npm fund (#2127)
- opencollective package has been deprecated
- postinstall task is no longer recommended
- https://blog.opencollective.com/beyond-post-install/

Co-authored-by: Matt Fedderly <mfedderly@palantir.com>
2021-06-23 21:18:12 -04:00
mfedderly
96f0c2cb06
Enable more lint rules (#2108)
* @typescript-eslint/ban-types

* @typescript-eslint/no-empty-function

* @typescript-eslint/no-inferrable-types

* @typescript-eslint/no-this-alias

* no-case-declarations

* no-cond-assign

* no-dupe-else-if

* no-empty

* no-explicit-any

* no-prototype-builtins

* no-undef

* no-unreachable

* no-useless-escape

* prefer-spread

* comment the eslintrc

* Almost had it

* clearly my js trivia is not good enough today

Co-authored-by: Matt Fedderly <mfedderly@palantir.com>
2021-06-22 18:42:21 -04:00
Tim Welch
4d84de9d06
⬆️ [@turf/intersect][@turf/difference][@turf/union] bump polygon-clipping to 0.15.3 (#2085)
* ⬆️ bump polygon-clipping to 0.15.3
2021-06-20 21:21:35 +10:00
Rowan Winsemius
ff86e6fdbd
Prepare for release of 6.4.0 (#2097)
* Prepare for release of 6.4.0
2021-06-17 23:18:19 +10:00
mfedderly
57c8877e1e
Update changelog for 6.3.0 (#2010)
* Update changelog for 6.3.0

* v6.3.0

Co-authored-by: Matt Fedderly <mfedderly@palantir.com>
2021-01-20 09:25:04 -05:00
Tuan Luong
182bf8e289
Make package.json part of the export map (#2004)
Co-authored-by: Tuan Luong <tuanluong@Tuans-MacBook-Pro.local>
2021-01-18 13:36:00 -05:00
mfedderly
c277baf2b9
Update release notes for 6.2.0 proper (#1998)
* Update release notes for 6.2.0 proper

* v6.2.0

Co-authored-by: Matt Fedderly <mfedderly@palantir.com>
2021-01-12 09:43:17 -05:00
mfedderly
5a029b206c
Only include ES5 code, remove some ES6 that had crept in (#1984)
* Move @turf/polygonize to typescript instead of its own custom rollup

* validate-es5-dependencies -> es-check

* @turf/buffer const -> var

* polygon-clipping dependency from 0.14.3 -> 0.15.2 to swap es6 code for es5 code

* @turf/turf - Change rollup config to better support tree shaking, remove buble reference

* Remove deprecated exports from @turf/helpers, they are still covered in @turf/turf:

- radians2degrees
- degrees2radians
- distanceToDegrees
- distanceToRadians
- radiansToDistance
- bearingToAngle
- convertDistance

Co-authored-by: Matt Fedderly <mfedderly@palantir.com>
2020-12-17 08:36:56 -05:00
mfedderly
dce9edfc70
Update changelog for 6.2.0-alpha.3 changes (#1970)
* Update changelog for 6.2.0-alpha.3 changes

* Update changelog

* v6.2.0-alpha.3

* v6.2.0-alpha.3

* Looks like prettier and lerna are fighting, let lerna win.

Co-authored-by: Matt Fedderly <mfedderly@palantir.com>
2020-12-10 15:56:47 -05:00
mfedderly
2e9d3d51f7
Add Prettier and ESLint to the builds (#1965)
* Configure ESlint and Prettier
- Disable all eslint rules that trigger
- Build's lint step now runs monorepoint, prettier, and eslint
- Remove all tslint references

* [auto] run prettier on everything

Co-authored-by: Matt Fedderly <mfedderly@palantir.com>
2020-12-08 19:24:15 -05:00
mfedderly
2faafab916
Bench + Test cleanup (#1968)
- No longer have bench and test call prepare explicitly
- bench.js, test.js, types.ts all use the local copy of the code, not the built copy
- Fixed quite a few bench.js files that were just broken
- Rework root package.json for build clarity
- Change prepare scripts to build so that they don't run on publish

Co-authored-by: Matt Fedderly <mfedderly@palantir.com>
Co-authored-by: Rowan Winsemius <rowanwins@yahoo.com.au>
2020-12-08 17:06:34 -05:00
diachedelic
eafb76cab8
Node ESM support (#1942)
Writes a package.json to each dist/es/ directory, which ensures that
Node loads adjacent files as ES modules.

close #1940

Co-authored-by: mfedderly <mdfedderly@mdfedderly.com>
2020-11-17 09:08:31 -05:00
Matt Fedderly
23d5cb91d7 v6.2.0-alpha.2 2020-07-13 09:48:16 -04:00
Michael Bullington
908dedbe1a
turf-union, turf-difference, turf-intersect: Swap out martinez-polygon-clipping for polygon-clipping used in v7. (#1916)
* swap out martinez-polygon-clipping for polygon-clipping

* reinstate single polygon return on turf-difference

* reinstate single polygon return for turf-intersect

* remove @ts-ignore from intersect and union

* reinstate single polygon return for turf-union

* remove leftover comment on turf-intersect type error

Co-authored-by: Nick Gottlieb <ngottlieb@gmail.com>
Co-authored-by: mfedderly <mdfedderly@mdfedderly.com>
2020-07-08 16:05:40 -04:00