davideicardi / live-plugin-manager

Plugin manager and installer for Node.JS
MIT License
225 stars 43 forks source link

Improve plugin directory structure to handle multiple different versions of a package #90

Closed yacchin1205 closed 1 month ago

yacchin1205 commented 2 months ago

To resolve Issue #3, I propose to improve the structure of the plugin_packages directory and implement a manager to manage it. (I use live-plugin-manager for etherpad-lite and it would be great to improve it! https://github.com/ether/etherpad-lite/issues/6330 )

Directory structure

Currently, the file placement would look like the following.

Therefore, I understand that if plugin-b and plugin-c each depend on a different version of plugin-a, one of the versions will be overwritten.

So, I considered creating a node_modules in the dependent source directory, like https://stackoverflow.com/questions/42147243/how-does-npm-handle-version-conflicts, and placing the dependencies packages in it.

To prevent multiple copies of the same package, symlink is used. The example of plugin-b and plugin-c is shown below.

For compatibility with current behavior, a symlink also will be created under plugin_packages for plugin-a, which is a dependency of plugin-b or plugin-c. Which version is linked depends on whether plugin-b or plugin-c is installed later.

Changes to code

The following changes were made to achieve the directory placement.

davideicardi commented 1 month ago

Thank you @yacchin1205 ! This is a great improvement! :rocket: Give me some time to review it, but I will try to do that in a couple of days.

davideicardi commented 1 month ago

Thank you again @yacchin1205 ! 👏

yacchin1205 commented 1 month ago

Thanks for your review and merge, too! 😄

davideicardi commented 1 month ago

I will publish a new release soon (just waiting for another PR rebase).