Electron-react-boilerplate: adding modules to project

Created on 10 May 2018  路  20Comments  路  Source: electron-react-boilerplate/electron-react-boilerplate

In section "How to add modules to project", doc says

"If the module should be included with the published package (i.e. bcrypt, openbci), it should be listed under dependencies in ./app/package.json."

The question is how/when do we know that a module has to be included with the published package?

Most helpful comment

Thanks for your hard work on this repo @amilajack it's very helpful to me 馃檹I appreciate it.

All 20 comments

@amilajack I remember having read those docs, but don't remember them talking about the modules "which should be published with the package". (i.e. my question).

Can you put a link where those docs talk about exactly what my question was about?

All dependencies are packaged with the app. The dependencies in ./package.json are bundled with webpack and dependencies that cannot be bundled with webpack should be in ./app/package.json. So all dependencies, in a way, are 'published with the app'. Its just a matter of how the application loads them. Let me know if that makes sense

@amilajack Sorry it doesn't. Let me try it once again. Here's the quote: "If the module is native to a platform (like node-postgres) or otherwise should be included with the published package (i.e. bcrypt, openbci), it should be listed under dependencies in ./app/package.json.".

So this quote suggests that since bcrypt should be included with the published package, it should go in ./app/package.json.

Now the question is what makes bcrypt so special that it has to be included with the published package?
How can I tell that a npm module has to be included with the published package?

Does the question make sense?

That is answered here. bcrypt is 'special' because it a native module. This means that it requires compilation against a certain version of node. For electron, we target the version of node that our version of electron uses. Does that make sense?

@amilajack you say bcrypt is native to platform?
Then lets take the quote again:
"If the module is native to a platform (like node-postgres) or otherwise should be included with the published package (i.e. bcrypt, openbci), it should be listed under dependencies in ./app/package.json.".

if bcrypt was native to platform why in the quote above it was not listed next to node-postgres?

Besides the github page, https://github.com/dcodeIO/bcrypt.js, says it is written in JS and not C++ to consider it as native module.

if you are unsure about the answer maybe you can reopen this so that others can answer?

Ahh I see. I think you're confusing the packages. The readme is referring to the npm package bcrypt. You are referring to bcryptjs. The documentation is referring to kelektiv/node.bcrypt.js. You are correct. bcryptjs is written in plain js. But bcrypt is written in c++
screen shot 2018-05-11 at 12 03 38 am

Does that clear things up?

@amilajack If it is native as you say it still doesn't answer my point as below:

"If the module is native to a platform (like node-postgres) or otherwise should be included with the published package (i.e. bcrypt, openbci), it should be listed under dependencies in ./app/package.json.".

if bcrypt was native to platform why in the quote above it was not listed next to node-postgres?

Ah i see what you're saying now. It should be:

If the module is native to a platform (like node-postgres) or if it is included with the published package (i.e. bcrypt, openbci), it should be listed under dependencies in ./app/package.json.

Correct?

@amilajack We don't seem to well understand each other :).

That quote is from a section which explains which module should go to which package json right?

So there must be easy rules by which I will know which npm module should be put in which package json right?

From above quote I understand node-postgres should go into ./app/package.json, because it is native as quote says.

But what about bcrypt? Why does the quote say it is included with the published package?

@amilajack I think we should reopen it if we didn't come to a conclusion

Ignore what that says. I will update it. It should say "If the module is native to a platform (like node-postgres), it should be listed under dependencies in ./app/package.json."

@amilajack just a notifier it seems that sentence is still written in the old way.

You are welcome to submit a pr

@amilajack Why should I do that? You said in previous comment you would update that, isn't it?
Okay, I feel I will l file a new issue here with same question, as it seems we didn't get to anything here.

Yea. I didn't do it yet because i have a lot of things on my plate now. But you are always welcome to submit a PR. The project is open source after all

Updated it

Thanks for your hard work on this repo @amilajack it's very helpful to me 馃檹I appreciate it.

Hey @aguynamedben. Thank for taking the time to share that. This is one of many projects that I maintain and it is very difficult to balance my open source work with my career related work and other things. I'm glad that this project and my contributions to it have been of use to you 馃槃

@amilajack Thanks for the update. Out of interest, can you just post few words why that sentence was there in the first place, if it was not needed?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

atassis picture atassis  路  20Comments

Slapbox picture Slapbox  路  25Comments

gorphensu picture gorphensu  路  43Comments

williamoliveira picture williamoliveira  路  25Comments

garetmckinley picture garetmckinley  路  26Comments