infinyon / node-bindgen

Easy way to write Node.js module using Rust
Apache License 2.0
507 stars 43 forks source link

Update README (add ref to tslink) #285

Closed DmitryAstafyev closed 9 months ago

DmitryAstafyev commented 9 months ago

Hello, guys.

I have one suggestion for you and I'm doing it via PR ;)

Since I've been using node-bindgen for a long time already across a couple of projects I found missing TypeScript types a little annoying ).

That's just not comfortable from a testing and developing perspective.

You know, some small changes in data type on the native module side, and you shouldn't forget to update it on nodejs side too.

With TypeScript it is much easier. Imagine workflow:

  1. generate a native node module
  2. generate TypeScript types based on previous
  3. include into the end-project as a full-fledged npm package
  4. build (with TypeScript compiler) an end-project.

You see? If some changes happen on step 1, on the heights level (nodejs) TypeScript compiler will inform about any errors. It makes a solution more stable and helps with testing indeed.

I've developed crate tslink which generates *.d.ts, *.js and *.ts files and actually creates a full-fledged npm package.

As a bonus - code highlights on the IDE level as well.

What do you think about it? If you are finding this useful for your users, let's add some remarks about it to your documentation.

P.S. Combined usage tslink and node-bindgen is very much covered by tests, you can see it in repo of the project.

DmitryAstafyev commented 9 months ago

Hello @sehz , would be nice to see your opinion about this PR and its subject

DmitryAstafyev commented 9 months ago

you can try with example of combined usage node-bindgen and tslink, just do next:

git clone https://github.com/DmitryAstafyev/tslink.git
cd tslink/examples/node_bindgen
sh ./run_test.sh
sehz commented 9 months ago

@morenol WDYT?

DmitryAstafyev commented 9 months ago

@sehz @morenol I've extended a little an example in the suggested documentation change and added a responsibility note, which indeed should be included. @morenol waiting for your feedback ;)