cugos / dropchop

:fork_and_knife: browser-based spatial operations
http://dropchop.io
MIT License
252 stars 67 forks source link

Modularize turf dependencies #261

Closed wboykinm closed 8 years ago

wboykinm commented 8 years ago

Instead of requiring turf whole-cloth, just install the functions that are configured for dropchop. Currently:

"turf-along": "^3.0.12",
"turf-bezier": "^3.0.12",
"turf-buffer": "^3.0.12",
"turf-center": "^3.0.12",
"turf-centroid": "^3.0.12",
"turf-destination": "^3.0.12",
"turf-envelope": "^3.0.12",
"turf-explode": "^3.0.12",
"turf-midpoint": "^3.0.12",
"turf-simplify": "^3.0.12",
"turf-tin": "^3.0.12",
"turf-union": "^3.0.12",
"turf-within": "^3.0.12"
wboykinm commented 8 years ago

@nickpeihl I'm (understandably) getting turf is not defined here when I run dropchop locally with only the modules installed (instead of the whole package).

The parent object turf seems to be required, but (many apologies) I can't find where it's defined in the codebase to replace it. Adding it back to the vendorJS array points to a nonexistent node module, so that doesn't work. Other things that don't work include:

mapsam commented 8 years ago

@wboykinm I believe that, since we are still not fully using browserify to build dropchop, you'll have to do a similar thing that @jczaplew did with topojson:

  1. include a source file in lib that requires the necessary modules
  2. and a browserify command in gulp that builds the script for dropchop before ...
  3. loading into the js_vendor command
wboykinm commented 8 years ago

All set here.