node-sqlite3 icon indicating copy to clipboard operation
node-sqlite3 copied to clipboard

Too many non-runtime dependencies after installation

Open fenying opened this issue 1 year ago • 3 comments

Issue Summary

First of all, thanks to the maintainers, this package is a nice job.

I just wanna point out that, after installing this package, there are 123 dependencies installed which are mostly useless because there not required for run-time.

Let me explain, prebuild-install, yes I know what it is and how it works. Indeed it provides a convenient way to installing C/C++ addons without compilation. I agree that it's helpful but only within installation. Also, node-gyp and tar are the same.

I would suggess to replace the install script in the package.json with this command:

npx -y prebuild-install@^7.1.1 -r napi || npx -y node-gyp@^8.0.0 rebuild

And then prebuild-install and node-gyp are no longer needed in the dependencies list, becuase it will only be used during installation, and will not be installed into anywhere except the NPM cache.

Finally, the tar package, I know it's used to extract the source from the .tar.gz file, but I believe that we could actually try tar command firstly, and use the extract.js as a fallback, like this:

tar -zxf xxxx.tgz -C dst_path || (npm i tar && node extract.js) # not tested, but may work.

How do you think? If I missed something, please point it out. Or if you agree, I could create a PR for this.

Relevant logs or output

$ npm i sqlite3
npm WARN deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs

added 123 packages in 28s

Version

5.1.7

Node.js Version

20.12.0

How did you install the library?

npm i sqlite3, on Linux x86_64

fenying avatar Mar 29 '24 03:03 fenying

Try switching off of this package to NodeJS 22's new built-in/native SQLite support. The feature in NodeJS is experimental, but it is being actively maintained and pretty much each new update of node is having some improvements over the last. As an experimental support, it currently exposes some of the SQLite features, so it may or may not work in your use case. But in case if it does, you can drop this dependency and have much better maintenance.

YasharF avatar Apr 26 '25 20:04 YasharF

Try switching off of this package to NodeJS 22's new built-in/native SQLite support. The feature in NodeJS is experimental, but it is being actively maintained and pretty much each new update of node is having some improvements over the last. As an experimental support, it currently exposes some of the SQLite features, so it may or may not work in your use case. But in case if it does, you can drop this dependency and have much better maintenance.

I know, I've been watching on it, but not yet for stable usage. :)

fenying avatar Apr 29 '25 06:04 fenying

I've been using the built-in support in production for over a month now, and overall, it's been working well. I did run into some hiccups during the transition, mainly because certain SQLite features weren't implemented, which required me to rewrite some of the database calls to make it work. However, once I got everything adjusted, I haven't encountered any issues with it for my use case

YasharF avatar Apr 29 '25 18:04 YasharF