mapbox / tilelive

fast interface to tiles with pluggable backends - NOT ACTIVELY MAINTAINED
BSD 3-Clause "New" or "Revised" License
531 stars 108 forks source link

tilelive.auto doesn't work with scoped packages #187

Closed mapsam closed 7 years ago

mapsam commented 7 years ago

the tilelive-copy command uses tilelive.auto, which tries to load the plugin module automatically by concatenating strings from the protocol. Loading a scoped npm module, such as @mapbox/tilelive-omnivore doesn't work, since the attempted require looks like require('tilelive-omnivore') and this fails silently, leading to an error in the actual copy operation.

Unfortunately we can't update tilelive.auto to work with scoped packages, since we aren't sure what the name of the scope package is (i.e. can't assume it will always be @mapbox).

A solution would be to provide an added flag to the CLI called --protocol (name TBD) that allows you to pass in a string of whatever protocol you want to register - this should match the name of the module in the package.json. Example:

tilelive-copy omnivore://path/file.geojson --protocol @mapbox/tilelive-omnivore

cc @rclark @perrygeo @GretaCB

rclark commented 7 years ago

:+1: Probably it should've always been this way and .auto shouldn't have existed.

I would call it either --register or --register-module.

jingsam commented 7 years ago

Fixed in #191

mapsam commented 7 years ago

Thanks @jingsam!