nate-parrott / Flashlight

The missing Spotlight plugin system
http://flashlight.nateparrott.com
Other
5.39k stars 411 forks source link

Decentralized model for publishing plugins #333

Closed mmarcon closed 9 years ago

mmarcon commented 9 years ago

As the number of plugins grows, it would be nice to have a more decentralized model to publish plugins, something more similar to the npm or bower models.

I'll think of a possible approach and suggest it here.

nate-parrott commented 9 years ago

This is definitely a good idea. How would it work, though? I think it's nice that all plugins are in the same repo (making it easy to submit enhancements for other people's plugins) but I'd be willing to consider other approaches. How does npm work? Do you just submit a link to a Github repo, which is then indexed by the central repo?

mmarcon commented 9 years ago

npm is essentially a registry where the code of the modules and the related metadata contained in package.json (name, description, version, tags) are stored and versioned. When you do npm install the module is fetched from the npm registry.

bower has a more simplistic model. The registry only stores the metadata that is contained in bower.json, and packages must be publicly available at a Git endpoint. Versioning is based on semver git tags. Essentially bower is just sugar on top of git. The registry is there just for discovery of packages.

I think the bower model is definitely easier – and cheaper in terms of storage – to implement, and for the purpose of Flashlight plugins may not be a bad model. I was thinking that version 0 of this could be yet another Flashlight plugin, let's call it fpm for the sake of argument. If you type fpm install mmarcon/js.bundle then a preview of what is in https://github.com/mmarcon/js.bundle is shown in spotlight – that bit I already partially drafted, except for some prettiness and the install bit

fpm

once you hit enter, the https://github.com/mmarcon/js.bundle/archive/master.zip file is fetched and unzipped into ~/Library/FlashlightPlugins. No versioning here, whatever is in master is downloaded and installed.

version 1 would have a simple registry with the metadata of the plugins. info.json could be extended to include a semver version string. At this point fpm will start supporting the search option that queries the registry (matching different fields, e.g. name, description, tags) and returns a list of matching packages.

And these are just some confused thoughts that I collected during the day...

mmarcon commented 9 years ago

Here we go, version 0 implemented in #342

nate-parrott commented 9 years ago

accepted!