NotePlan / plugins

The main NotePlan repository, which contains the source code for all NotePlan plugins. If a release entry has been created, it will be available for installation from within NotePlan application.
MIT License
168 stars 58 forks source link

[RFC] Using a package manager for plugins #6

Open nmn opened 3 years ago

nmn commented 3 years ago

While it's still early days for plugins in Noteplan, it might make sense to keep all the "blessed" plugins in this Github repo, but longer term, that'll start to get untenable. Specially when it comes to releases.

Using a package manager like NPM might make a lot of sense. Using registry.npm.org URLs it's fairly straightforward to search, get details and download packages that can go directly to the Plugins folder.

Here are the benefits to this approach:

  1. Third party packages can all follow a naming convention (e.g. noteplan-plugin-commandName) and publish them on NPM and they will become easily discoverable for users.
  2. NPM packages have versioning built-in and it will become easy for different plug-ins to be updated independently and for Noteplan to periodically check for updates easily by package name.
  3. Since NPM allows for an independent .npmignore file it'll become easy to ignore built files for GitHub and ignore source files for the NPM package. This way Noteplan doesn't have to download any unnecessary files.
  4. It should still be valid to use a Github URL to manually download plugins that aren't on NPM. (without all the extra feature though)

Possible downsides:

  1. Churn - NPM can be an additive feature so that the churn can be kept to a minimum.
  2. it slightly increases the barrier to entry, but it's really just an npm publish command for a plug-in author. For advanced plugins this would be a total win.
leomeloxp commented 3 years ago

it slightly increases the barrier to entry, but it's really just an npm publish command for a plug-in author. For advanced plugins this would be a total win.

This one can be solved by having a template repo that users can clone to start developing their plugins, kinda like how themes can be copied and edited now but a bit more complex. It should be easy enough to write a generator as well so all users would need to do is run npm init noteplan-plugin my-plugin to generate a my-plugin folder with all the relevant template files in it.

nmn commented 3 years ago

I've been playing around with this and I'm making gradual progress. I'm hoping to start by creating a NPM workspace called @noteplan and putting the "first-party" plugins under that. We can take it from there. I'm gonna be busy with work for a couple of weeks though so I'll have some updates after that.

jgclark commented 3 years ago

Thanks. I hope to be able to get a set of new releases out over the weekend and early next week, now that r635 is out with bug fixes.

cweagans commented 3 years ago

Do we really need npm for this? Seems like you could use the Github API directly -- tag repos with a particular topic, and then use the repo search endpoint to find repos tagged with the noteplan-plugin (or whatever) topic.

Using npm implies (to me) some need to also solve for various versions of dependencies. I hope NotePlan plugins do not need that.

dwertheimer commented 3 years ago

Agree that having only one way to get NP plugins out to the world is limiting.

Obsidian's way of dealing with this seems to work -- they have "safe" (blessed) plugins and "community" plugins: https://help.obsidian.md/Advanced+topics/Third-party+plugins Then to get listed in the community directory: https://github.com/obsidianmd/obsidian-releases

...or do it the VSCode way: https://code.visualstudio.com/api/working-with-extensions/publishing-extension

jgclark commented 3 years ago

I know the main VSCode way, as I maintain one of the extensions in the marketplace. That is a central repository, but anyone can get an account to add to it, without any possibility of trampling on (or using) other's extensions. There's no quality control, though you can rate and comment on extensions.

The BitBar / XBar / SwiftBar way is to have a central GitHub repo, and plugin authors submit PRs, which a few moderators add. This is effectively the main NP way at the moment.

Like the other VSCode way, NP already allows for other plugins to be added from any source a user decides to use. Reasonably enough there won't be a central list of these.

So, I wonder if the main thing to do in the shorter term is to add a button to the Plugins Preferences pane to 'Add Plugin ...' which would accept .gzip archives and unpack them into the user's folder, in the same way as for official plugins. This makes it a simple-enough step for non-techies to add from any source they wish.

nmn commented 2 years ago

Do we really need npm for this? Seems like you could use the Github API directly

Benefits of NPM

Downsides of NPM