fuwaneko / node-protobuf

Google Protocol Buffers wrapper for Node.js [UNMAINTAINED]
181 stars 42 forks source link

Question: should this module include the protobuf sources to aid dependency management? #51

Closed lovell closed 8 years ago

lovell commented 8 years ago

Hello Dmitry, thank you for your continued work on the best-maintained native Node module for working with Protocol Buffers.

@perezd and I have been talking over at https://github.com/perezd/riemann-nodejs-client/issues/7 about the possibility of switching the Riemann client to use it.

To ensure the installation of it (and node-protobuf's existing dependencies) is as easy as possible, we could include the protobuf source code, either a copy of or as a a git submodule, within this module.

The benefit of removing the need to pre-install a library and development headers is that users simply npm install, plus it also means we're in control of the underlying version of protobuf at all times.

We'd need to add a .gyp file for the cross-platform compilation of protobuf. I suspect the no-longer maintained protobuf.gyp can be re-purposed and I'm happy to help with this.

Is there the appetite for such an approach?

fuwaneko commented 8 years ago

While simplifying install it will also increase build time significantly, require substantial manual updates to protobuf library and will force people to stick with version I have in this module instead of version they want (currently any protobuf version above 2.1 works just fine and possible .desc format changes do not influence node-protobuf at all). It was one of the things I disliked in @chrisdew protobuf library. It contradicts with the unix way (composability and modularity) as well.

Windows installation while might look complex includes steps anyone using native node addons on windows have to go through, like installing Visual Studio version used to compile their Node.js version. Even if I include protobuf library, this step will still be required. And I doubt anyone would want to use Node.js in production on Windows, Windows support I provide is mainly for testing and developing purposes.

The module you mention already requires protobuf to be installed before using it, so I don't see any benefits in that regard as well. You could try Protobuf.js I mention in README as it's pure js library and the only other one maintained, but it's two times slower than node-protobuf as my tests show.

If you have any other thoughts on it, let me know.

lovell commented 8 years ago

No worries Dmitry, I completely understand why you would not want to support this approach. Thank you for taking the time to explain.

webmakersteve commented 8 years ago

https://github.com/webmakersteve/node-protobuf/tree/static-lib

I made a version that includes this as a static lib. If you've had a change of heart I'd be happy to submit this as a PR. I know in our specific implementation it greatly aids us to not need to add dependencies to our build servers, and rather package them along with the source.

fuwaneko commented 8 years ago

@webmakersteve I'm glad you found library useful and made your own fork, but I won't change my mind. node-protobuf is going to remain as lightweight and decoupled as possible and require protobuf as an external dependency, sorry.