Getting Turf back on track
See original GitHub issueThe goal for Turf v3 was to create a system in which Turf could be coordinated as a set of modules, operating independently but uniform in style, management, and properly versioned together. Unfortunately, thatβs no longer the case: the current codebase is heterogenous, hard to contribute to, and the guidelines for releases are nonexistent.
About half of the modules are in TypeScript, and about half of those modules have a tsconfig.json file. About 40% of modules name their main
export main
, and the rest call it index
. Same with providing a module
entry point, itβs about 50%. 3 modules have a .mjs
module file, the rest have .es.js
.
Basically, there are no real homogenous properties of Turf anymore. Itβs a worst-case scenario for a mono-repo: it makes Turf maintenance feel much more like βmaintaining 55 modulesβ than it does βmaintaining a mono-repoβ.
Turf modules summary
name | tsconfig | main | module | in ts |
---|---|---|---|---|
turf | turf | turf.mjs | π | |
along | π | index | π | |
angle | π | index | π | |
area | π | index | π | |
bbox | π | index | π | |
bbox-clip | π | index | π | |
bbox-polygon | π | index | π | |
bearing | π | index | π | |
bezier-spline | π | index | π | |
boolean-clockwise | π | index | π | |
boolean-concave | π | index | π | |
boolean-contains | π | index | π | |
boolean-crosses | index | π | ||
boolean-disjoint | π | index | π | |
boolean-equal | index | π | ||
boolean-intersects | π | index | π | |
boolean-overlap | index | π | ||
boolean-parallel | index | π | ||
boolean-point-in-polygon | π | index | π | |
boolean-point-on-line | π | index | π | |
boolean-touches | index | π | ||
boolean-valid | index | π | ||
boolean-within | index | π | ||
buffer | main.js | main.es.js | ||
center | index | π | ||
center-mean | index | π | ||
center-median | index | π | ||
center-of-mass | index | π | ||
centroid | index | π | ||
circle | index | π | ||
clean-coords | index | π | ||
clone | π | index | π | |
clusters | index | π | ||
clusters-dbscan | index | π | ||
clusters-kmeans | index | π | ||
collect | index | π | ||
combine | index | π | ||
concave | π | index | π | |
convex | π | index | π | |
destination | π | index | π | |
difference | index | index.mjs | ||
directional-mean | π | index | π | |
dissolve | main.js | main.es.js | ||
distance | index | π | ||
distance-weight | π | index | π | |
ellipse | main.js | main.es.js | ||
envelope | main.js | main.es.js | ||
explode | main.js | main.es.js | ||
flatten | main.js | main.es.js | ||
flip | main.js | main.es.js | ||
great-circle | main.js | main.es.js | ||
helpers | π | index | π | |
hex-grid | index | π | ||
interpolate | main.js | main.es.js | ||
intersect | π | index | π | |
invariant | π | index | π | |
isobands | main.js | main.es.js | ||
isolines | main.js | main.es.js | ||
kinks | π | index | π | |
length | π | index | π | |
line-arc | π | index | π | |
line-chunk | main.js | main.es.js | ||
line-intersect | π | index | π | |
line-offset | main.js | main.es.js | ||
line-overlap | index | π | ||
line-segment | π | index | π | |
line-slice | main.js | main.es.js | ||
line-slice-along | main.js | main.es.js | ||
line-split | main.js | main.es.js | ||
line-to-polygon | index | π | ||
mask | main.js | main.es.js | ||
meta | index | index.mjs | ||
midpoint | main.js | main.es.js | ||
moran-index | π | index | π | |
nearest-neighbor-analysis | π | index | π | |
nearest-point | π | index | π | |
nearest-point-on-line | index | π | ||
nearest-point-to-line | π | index | π | |
planepoint | main.js | main.es.js | ||
point-grid | index | π | ||
point-on-feature | main.js | main.es.js | ||
point-to-line-distance | π | index | π | |
points-within-polygon | main.js | main.es.js | ||
polygon-smooth | main.js | main.es.js | ||
polygon-tangents | main.js | main.es.js | ||
polygon-to-line | π | index | π | |
polygonize | main.js | main.es.js | ||
projection | index | π | ||
quadrat-analysis | π | index | π | |
random | π | index | π | |
rectangle-grid | index | π | ||
rewind | main.js | main.es.js | ||
rhumb-bearing | π | index | π | |
rhumb-destination | π | index | π | |
rhumb-distance | π | index | π | |
sample | main.js | main.es.js | ||
sector | main.js | main.es.js | ||
shortest-path | main.js | main.es.js | ||
simplify | main.js | main.es.js | ||
square | main.js | main.es.js | ||
square-grid | π | index | π | |
standard-deviational-ellipse | main.js | main.es.js | ||
tag | main.js | main.es.js | ||
tesselate | main.js | main.es.js | ||
tin | π | index | π | |
transform-rotate | main.js | main.es.js | ||
transform-scale | main.js | main.es.js | ||
transform-translate | main.js | main.es.js | ||
triangle-grid | index | π | ||
truncate | index | π | ||
union | index | π | ||
unkink-polygon | main.js | main.es.js | ||
voronoi | main.js | main.es.js |
Organizationally, Turf currently has a small chunk of cash, a much much smaller number of long-term maintainers, and zero institutional/company code contributors. This is pretty common for open source projects.
To propose a few ways forward:
Remove TypeScript
The TypeScript transition, while a very nice contribution, is unfinished and offers little to the project. We didnβt have many bugs caused by type mismatches before, and the resulting addition of complexity outweighs the benefit.
Would this be unpopular? Probably! But itβd be better to re-achieve stability and releasability, and make the project fit its actual contributors, than to perpetually be in a half-deployable state.
If this is the option, we could do it by basically configuring tsc to generate ES modules.
Move lerna.js back to fixed/locked mode
Per https://github.com/Turfjs/turf/pull/1247 the lerna config was switched to independent versioning. This makes collaboration harder: the intent of lerna was and is to make versioning automatic so that the project can be released always with lerna publish
. There should not be a thought process for which modules need updating and releases.
Move releases/ back into changelog
This releases directory is the same as a central changelog. Letβs move these back to the changelog.
Use standard commits
Again, a common collaboration point - this will automate changelog generation and version more accurately
Write these contribution tips into CONTRIBUTING.md
And probably create a strong process for changing them. This stuff shouldnβt become wobbly; Turf should stay in a deployable, simple state that all the maintainers have a grasp on.
(Extreme solution) just move to a singular ES6 module
This would probably be even less popular than removing TypeScript: create one turf
module (again), now that tree-shaking means that people using Rollup/Webpack/Parcel can efficiently import a subsection of a module without including all of the code. This would drastically reduce complexity and let advanced users continue to get the performance advantages of the current mini-modules, but it would leave people using old-fashioned require
etc out in the cold.
Honestly Iβm also in favor of this extreme solution: itβd be a huge decrease in complexity, and itβd do this for existing users:
- Script-tag or browserify users: yep, would be slower
- Node users: probably donβt mind the startup time or install size that much
- Webpack/Rollup users: would work great
- Future native-js module users: would easily be able to sub-import
This is intended to be a bit of a jumping-off point, none of these ways to victory are quick-fixes and weβd want to attain some consensus before embarking on them. Dividing this work up would also be useful, given that there are few maintainers, or if there is an institutional/company contributor who wants to take on some of this, itβd be more than welcome - Turf is definitely generating a lot of value out there in the world, much more than it captures.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:15
- Comments:34 (14 by maintainers)
Top GitHub Comments
Hi @tmcw
Thanks for taking the time to check in on the status of the project, this has certainly been weighing on my mind over the past couple of months.
That said I want to start by saying the following
Re Typescript Iβd be supportive of ditching the typescript-first approach
On a personal & professional note I have no desire or need to learn TypeScript, TurfJS would be my sole reason for learning it.
Re Lerna
Contributing.md Yeah agreed this is in dire need of an overhaul. Over the past 18 months there have been quite a number of changes to the various processes that have never been adequately captured.
Re All-in on ES6 So if I understand this correctly this would basically
Could you elaborate on use case 1 (βScript-tag or browserify usersβ) - is that basically folks using Turf via a CDN? Why would that be slower under this proposal?
I think I cautiously support this approach. The bulk of browser apps (at least serious ones) are being built with some sort of bundling tool so I dont think weβd be leaving many out in the cold with this decision. My one proviso is that I think it would be nice to have some sort of basic bundled version (eg a CDN version) for people to hack with and learn with that doesnβt require them to get into the whole world of bundlers, it wouldnβt be the preferred method of usage but would be there to provide a low barrier of entry.
Anyway those are my initial thoughts - will ponder further and see if there is anything else that comes to mind.
Cheers Rowan
Thankfully after a few years hiatus Turf is back on track with a team of contributors helping on many fronts π Weβve now had a series of stables releases from v6.2.0 onwards. Still a lot of work to be done but lots of good progress is being made.