juliangruber / is-native-module

Check if a node module contains native code
6 stars 1 forks source link

Question: What is the "binary" property in a "package.json" file for? #1

Open JamesMGreene opened 7 years ago

JamesMGreene commented 7 years ago

One of the properties your module checks to determine if a given "package.json" file represents a native module is "binary". However, I can find no record of such a property ever existing or being used by npm or node-gyp.

Can you please fill me in on what this property was for? Or any documentation on what consumes it? I asked a few of the NPM collaborators on package.community and even they did not recognize it offhand.

juliangruber commented 7 years ago

I found it looking at some popular native modules, and the binary property i got from fsevents: https://github.com/strongloop/fsevents/blob/master/package.json#L22. We could also check for the existence of the node-pre-gyp dependency instead, as that would also work for this module.

What do you think?

JamesMGreene commented 7 years ago

Thanks for the background. I dug into it more based on that info and found that the binary property is specifically consumed as configuration for the node-pre-gyp module, so just checking for that devDependency should be sufficient.

juliangruber commented 7 years ago

would you be interested in making a pull request for that?

JamesMGreene commented 7 years ago

Also, NPM semantics will also automagically inject an install script to execute node-gyp rebuild under certain conditions: