#13

NodeJS SDK support

OpenGnosnayopened 7mo ago

For now the JS sdk coupled on the Bun runtime.

but most of the runtime of JS is nodejs. Bun is trying to be compatible with nodejs. So it is better to use nodejs's interface.

Activity

10
Gnosnay7mo ago

we could use napi-rs to generate the SDK

Gnosnay7mo ago

we could use napi-rs to generate the SDK

Gnosnay7mo ago

we could use napi-rs to generate the SDK

Gnosnay7mo ago

for background, the issues for previous js sdk:

  1. it coupled on the bun
  2. it requries the cli to be installed, which might be issue for non-unix like platform like windows.

so i believe it is better to include the node binary along with package.

here is how the other project did: https://github.com/apache/opendal/tree/main/bindings/nodejs

@harshdoesdev please kindly give some suggestions.

with this approach we could scale to other progamming language quickly, like python

Gnosnay7mo ago

for background, the issues for previous js sdk:

  1. it coupled on the bun
  2. it requries the cli to be installed, which might be issue for non-unix like platform like windows.

so i believe it is better to include the node binary along with package.

here is how the other project did: https://github.com/apache/opendal/tree/main/bindings/nodejs

@harshdoesdev please kindly give some suggestions.

with this approach we could scale to other progamming language quickly, like python

harshdoesdev7mo ago

I think the npm package should work just fine with node. I don't think we are using any bun-specific dependencies.

Edit: Bun is just being used as the build tool for the package. Also, the CLI should work with any programming language which is able to spawn a shuru process and communicate with it in JSON-RPC 2.0. Also, we don't plan to support non-unix like platforms like Windows.

harshdoesdev7mo ago

I think the npm package should work just fine with node. I don't think we are using any bun-specific dependencies.

Edit: Bun is just being used as the build tool for the package. Also, the CLI should work with any programming language which is able to spawn a shuru process and communicate with it in JSON-RPC 2.0. Also, we don't plan to support non-unix like platforms like Windows.

Gnosnay7mo ago

I think the npm package should work just fine with node. I don't think we are using any bun-specific dependencies.

Edit: Bun is just being used as the build tool for the package. Also, the CLI should work with any programming language which is able to spawn a shuru process and communicate with it in JSON-RPC 2.0. Also, we don't plan to support non-unix like platforms like Windows.

hi @harshdoesdev i believe the current implementation coupled on the bun you could find from: https://github.com/superhq-ai/shuru/blob/a10c0d823ff39fb7275f50844583e45dd6752f9f/packages/sdk/src/process.ts#L1

and

https://github.com/superhq-ai/shuru/blob/a10c0d823ff39fb7275f50844583e45dd6752f9f/packages/sdk/src/process.ts#L29

Gnosnay7mo ago

I think the npm package should work just fine with node. I don't think we are using any bun-specific dependencies.

Edit: Bun is just being used as the build tool for the package. Also, the CLI should work with any programming language which is able to spawn a shuru process and communicate with it in JSON-RPC 2.0. Also, we don't plan to support non-unix like platforms like Windows.

hi @harshdoesdev i believe the current implementation coupled on the bun you could find from: https://github.com/superhq-ai/shuru/blob/a10c0d823ff39fb7275f50844583e45dd6752f9f/packages/sdk/src/process.ts#L1

and

https://github.com/superhq-ai/shuru/blob/a10c0d823ff39fb7275f50844583e45dd6752f9f/packages/sdk/src/process.ts#L29

harshdoesdev7mo ago

@Gnosnay thanks for pointing this out, had missed this, but the thing is - we don't want to do napi either. let's keep it simple and create a simple wrapper which uses Node.js' child_process instead of Bun.spawn if the environment is a Node.js environment.