alvarolorentedev / electron-plugin

an electron plugin extension package
MIT License
36 stars 0 forks source link

Usage #3

Open DmitryAstafyev opened 5 years ago

DmitryAstafyev commented 5 years ago

Hi. I'm not sure, this solution can be used to build a real plugin base system. If a plugin doesn't have dependencies or have dependencies, which doesn't require any extra installation actions it will work. But, if the plugin has "complicated" dependency, which requires some extra installation actions, it will not.

You can try to create a plugin, which has as a dependency for example "node-pty". The thing is - node-pty does some extra installation actions. And npm can do it within some environment.

If you run electron application via terminal (something like "electron myapp.js" it could work, because in this case electron will use your environment.

But, if you will build an electron application and run it as a desktop application, the installation will be failed. Because your application will not use your environment anymore. For example, the variable PATH will not have your regular PATHs. As a result, during installation of node-pty will be an error, because npm/node cannot find python, which is needed to install node-pty.

So, to resolve this problem you should add PATH before call npm installation. But does it make sense? What if user of your application doesn't have on a board python? But to use and install plugin he has to install python?

Also not clear how you resolve an issue with necessary to rebuild some modules (https://electronjs.org/docs/tutorial/using-native-node-modules). Not sure, will be enough just install it plugin.

Also, this is not good idea to use programmatically npm. It doesn't looks like developers care about this way of usage. There are tons of documentation about CLI, but nothing about API.

So, definitely would be nice if you will provide more information about the usage of your solution.

alvarolorentedev commented 5 years ago

So give me a day to reflect on all the questions. Sorry I have not noticed the question before.

In my case as i commented the complex dependencies based on platform i am solving them with prebuilt packages. I answer a bit on the other issue. Nevertheless i will get back to you as soon as i get a bit of time.

SrPatinhas commented 5 years ago

I was thinking in start a repo to have a plugin system for electron, because this is a area were we don't have anything.

But If this exists, I will try to help and create a good plugin system in here.

So, we can have several types of plugins system:

Now, the last one is probably the most probably to work, as it only needs to download a file/zip (and unzip it if the case) to a folder and then be saved to a local storage or database or just have some type of system to manage the plugins that exist and the active ones.

Anything count me in to build this (I will need to use it as well 😅)

Edit: After doing some search, I found this repo electron-plugin-manager (atom) that is based in atom plugin system, and probably we can check it to see how they are doing it.

And this repo electron-plugin-manager that has some uses with npm install and so one

SrPatinhas commented 5 years ago

@kanekotic any thoughts on this?

alvarolorentedev commented 3 years ago

🙏 Sorry For the late reply, I did not get the notification so have not seen this issue 🙏

If you already have a plugin system that is public I am happy to deprecated this package and redirect to yours