barthofu / tscord

🤖 A fully-featured discord bot template written in Typescript, intended to provide a framework that's easy to use, extend and modify
https://tscord.discbot.app
MIT License
252 stars 19 forks source link

[Track] Node-gyp sucks #158

Open airone01 opened 8 months ago

airone01 commented 8 months ago

node-gyp sucks

Multiple reasons to refractor the app and remove node-gyp:

  1. As the name implies, using a Node-specific modules is a bad idea for portability (for Bun and Deno)
  2. The better-sqlite3 package relies on node-gyp which makes it not usable with Bun at all.
  3. The reason we use this module at all is because nobody added native support for SQL (or at least SQLite) in the runtime, which is already the case for Bun and Deno so they have to suffer for no reason
  4. The core idea and principle of it sucks (see here and here), as it compiles C and C++ code, and I'm no low-level pro, but I believe there has to be a better solution to this
  5. Bad support for anything that is not Ubuntu, because of libs and DLLs. To be fair, Bun doesn't support Windows, but It's on its way, and fast.
  6. Can also break the light CI/CD or Docker environments
  7. The Node.JS team assumes you are using Node and V8, even though there are multiple runtimes and engines available. I would advise against using any Node-specific modules.

Possible solutions

Aside from my rant, the solutions I looked up were:

Counter-arguments to what I just said

See "Bun hype. How we learned nothing from Yarn"

Bun is just an abstraction layer on top of the tools we already have. Meaning it will always be behind the curve and can introduce additional bugs at that layer. Not ideal for such mission critical systems like installing dependencies, testing code, and building the code to be sent to production.

@barthofu do what you want with this issue mate, maybe we can make it an actual tracker (and also remove the bug tag pls 👍)

barthofu commented 8 months ago

Nice issue and totally agree on it, I'm also bothered as hell concerning node-gyp but wasn't doubting this was as bad as this.

The thoughts i've had so far:

The thing now is to to weigh the pros and cons of this change, as better-sqlite3 still brings big improvments over the basic sqlite lib.

barthofu commented 7 months ago

Keep having newcomers that are somewhat blocked at the very init step, which is not acceptable.

Solution for now:

We should apply this quickly in a v2.4 release, while shifting the current planned features/issues in the 2.5.