-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deno vs. js library #5
Comments
I was not aware that there are 3! JS/TS-Libs (just thought Node, Deno) I think it is a good idea to combine them into a single codebase. (I think the only code-change is how the web-socket is created) So my suggestion would be to have a build script that generates the different versions (Browser, Node, Deno). |
I am relatively new to SurrealDB so I am not sure if the client and server sides should be separate? I come with a background in Firestore; there we have a client and an admin SDK. The admin SDK is more for server side usage with complete access to the DB. The client SDK is for direct front-end access secured through the user's auth and the DB rules. |
You could do that but you don't have to... My opinion is 1 Client for all. That is less to maintain... |
Fair. So the goal is to have a basic TypeScript setup which builds into
How to deal with external dependencies? Ideas:
|
nanoId can be replaced by some simple Code. The id don't have to be crypto-random pseudo-random should be fine... For ws that is the node websocket extension there is no way to remove it. For that we need a buildtool-solution. But with rollup (Not so familiar with webpack) this would be quite simple. (So don't overthink that for now) |
If this means publishing modules so that the dependencies are inlined in one file, I would advice against it.
Putting |
@Choooks22 Agree for nanoid. I don't think we need any other dependencies. With that in mind why do we need a Browser and a Deno build? I think that could be the same build. So with typescript in https://github.com/surrealdb/surrealdb.js we would have the following files (have currently other names but you get the idea):
And then we could simply add a // @deno-types='./dist/browser.d.ts'
export * from './dist/browser.js' On top of the 3 builds (deno, browser, node) we can then build platformspecific caching etc. if needed. |
Additional information:
|
(Disclaimer: I have to admit, I am not experienced with deno; but more with "classic" Node/Web projects.) Why don't we just create a Then we could have 4 of these files that are simply switched on build. edit: ok, so that's basically what's being done here: https://github.com/surrealdb/surrealdb.js/tree/main/src/websocket edit: as deno supports WebAssembly out of the box, there might actually be no need for a deno connector all together, no? |
I got a working node/deno/browser repo by essentially making the repo deno compatible, then just inserting an |
cool, I think I have just done something similar, just without the need for I have added a deno build to the js repo ie. simply replacing the websocket import with demos native WebSocket class. |
Would suggest to start on a basic test setup for all three environments to assure everything is still working as expected, what do you think? |
With the amount of issues this discussion is related to, kinda hard without a solid base yet, since solving this would be the solid base. Related issues/pr namely: |
We have 3 Targets Deno, Browser, Node and for Node 2 potential formats (cjs, esm). With nanoid removed the only depenencie is |
I created a working example in #6. Please have a look! |
Before I invest more time into it I would like to here some feedback from a surrealdb Team-Member so I don't waste time... |
Hi, I just came across the Deno, NodeJS and the JS repository. Do you think it is really necessary to maintain three separate code bases? I would suggest to create a basic TypeScript version with abstract external dependencies. What do you think?
Here is just one example how both repositories are already facing the same issues and are being maintained with redundant issues:
Deno: #4
JS: surrealdb/surrealdb.js#5
The text was updated successfully, but these errors were encountered: