jamsocket / y-sweet

A realtime CRDT-based document store, backed by S3.
https://docs.jamsocket.com/y-sweet
Other
524 stars 28 forks source link

y-sweet server npm wrapper cli re-downloads binary every time #269

Closed kwshi closed 1 month ago

kwshi commented 1 month ago

I have a relatively slow internet connection and noticed that even after the initial download/install (pnpm add -D y-sweet@latest) it always took 30+ seconds for pnpm exec y-sweet to launch. Some light digging leads me to think that the binary is getting re-downloaded every time the CLI is invoked, which doesn't seem like the correct/intended behavior.

Here's my train of thought:

In case this information is relevant:

kwshi commented 1 month ago

I don't know enough about how node package resolution works to troubleshoot why/how exactly this is happening. Here are only some clues-- the binaryExists function tries to first run require.resolve('y-sweet') in order to find the binary path; my hunch is that this is the step that is failing, even though it shouldn't. I don't know why though; the node_modules/y-sweet and node_modules/y-sweet/node_modules/y-sweet paths are both there-- maybe there needs to be a package.json? a main entry in the package.json? etc.

paulgb commented 1 month ago

Thanks for reporting this, @kwshi . #277 should fix it once merged.