machinekit / machinetalk-protobuf

Protobuf declarations for machinekit messages
MIT License
10 stars 11 forks source link

Changed the way nodejs packages are created (WIP) #48

Closed bobvanderlinden closed 8 years ago

bobvanderlinden commented 8 years ago

Based on discussions in #47, this will integrate npm packaging into this repository. It does so similar to https://github.com/bobvanderlinden/machinetalk-protobuf-node.

In turn this would deprecate https://github.com/bobvanderlinden/machinetalk-protobuf-node and will keep everything related to machinetalk-protobuf together (and in-sync).

Once this is integrated, we need to look at versioning Machinetalk-protobuf, as publishing on npm requires unique versions.

Do note that this is work-in-progress. Feedback is much appreciated.

machinekoder commented 8 years ago

How can I test the package locally?

bobvanderlinden commented 8 years ago

You can check js/examples/decoding_message_container.js and js/examples/encoding_message_container.js. They are just examples purely for encoding and decoding messages. There aren't any real unit tests. Though, it would be nice to have actual unit tests that compare output from a C program to output from nodejs.

bobvanderlinden commented 8 years ago

Also, if you want to use this version inside another project, you can use npm install /path/to/this/project/machinetalk-protobuf to install this instead of the version from npmjs. You could also use: npm install "https://github.com/bobvanderlinden/machinetalk-protobuf#nodejs".

machinekoder commented 8 years ago

The examples are looking for files in ../build. How can I build the protobufjs files?

bobvanderlinden commented 8 years ago

npm install in the root of the repository should install all dependencies that reside in package.json and also execute npm's prepublish script ( https://github.com/machinekit/machinetalk-protobuf/pull/48/files#diff-b9cfc7f2cdf78a7f4b91a753d10865a2R7). That in turn executes js/scripts/install.js, which should build the js files from protobuf using pbjs.

On Tue, Jan 5, 2016 at 7:47 PM Alexander Rössler notifications@github.com wrote:

The examples are looking for files in ../build. How can I build the protobufjs files?

— Reply to this email directly or view it on GitHub https://github.com/machinekit/machinetalk-protobuf/pull/48#issuecomment-169094184 .

machinekoder commented 8 years ago

Ah.. Can you please remove the old the old JavaScript related files and commands from the Makefile and update the README.javascript. This is confusing.

bobvanderlinden commented 8 years ago

Alright. I removed related lines from Makefile and added instructions to the README on how to use the repo for nodejs.

machinekoder commented 8 years ago

Good. Is there a way to use the generated protobuf.js files as API in the browser, without node? So far I found this example https://github.com/dcodeIO/protobuf.js/blob/master/examples/websocket/www/index.html It would be nice to have the Machinetalk Protobuf API also available as web dependency so we can use e.g. https://jsfiddle.net/ for online examples.