Closed alvarolorentedev closed 8 years ago
Actually it looks like the package.json
file is what is missing. Can you confirm that your package.json is actually inside of the pakcage that's uploaded to npm?
What is the name of the plugin?
i am working on it in my developer enviroment so is not on npm yet, could this be an issue?. The behaviour is:
Please find the code taged here
If I add a second package.json containing only name and plugins, it will actually overcome the issue. but I dont know if this is the expected bahaviour,
I see what you're saying. Yeah this line: https://github.com/EvolveLabs/electron-plugins/blob/master/index.js#L69
It will use the dir of the root module of the current process, I would have thought that would always be the same level as the app root but I haven't really tried it.
I guess what I would recommend is putting index.html
, index.js
and main.js
all in the root directory. I would also recommend renaming src
to lib
. By convention src
is reserved for native code for nodejs modules.
Also, if you know of a fix for this issue I'd be happy to accept it. The trick is finding out where the root directory of the main app is.
I suppose it should be using this api instead really:
app.getAppPath()
thanks for the answer, actually that is what i have end up doing. Probably it will be a nice to have till anyone can work on this, on the readme.md have a section similar to the one in the electron-updater to have a reference to this small threads that relates to behaviours.
My personal opinion is that it should be recursively go backwards from the current directory to the app directory. I will explain myself, imagine the next project structure:
+root
package.json
+lib
+controls
package.json
+themes
package.json
+data
package.json
I can see the power of handling at a certain directory level. You could handle quite different type of plugins without actually have to test them. Does this make sense?. But again I will defend the recursive case because if you have only one type of plugins, most probably you want to consolidate having just a package.json.
I will definetly give a deeper look on the code soon, and if i find a good solution I will do a pull request.
PS. thanks the tips, i have been working in a few diferent languages and i still need to get used to the conventions for javascript.
If the loading file (index.js) is not at the same level than the package.json, you get the next error: