Skip to content
This repository has been archived by the owner on Nov 6, 2021. It is now read-only.

Usage #3

Open
DmitryAstafyev opened this issue Mar 29, 2019 · 4 comments
Open

Usage #3

DmitryAstafyev opened this issue Mar 29, 2019 · 4 comments

Comments

@DmitryAstafyev
Copy link

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
Copy link
Owner

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
Copy link

SrPatinhas commented Jun 6, 2019

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:

  • Already installed when the app is created and then just manage the plugins at runtime;
  • Install packages from NPM or other registry where dependencies need to be downloaded and installed and then managed in app at runtime;
  • Install a package that only has logic, so it only needs to be downloaded and called in runtime from a folder and then managed at runtime;

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
Copy link

@kanekotic any thoughts on this?

@alvarolorentedev
Copy link
Owner

🙏 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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants