Removing `glob` dependency
Opened this issue · 4 comments
glob
is responsible for 26 out of 37 dependencies for this library: https://npmgraph.js.org/?q=json-schema-to-typescript. I'd love to see if we can find a way to reduce that.
A few options I can think of:
- Replace it with
fdir
(1M downloads / wk) andpicomatch
(50m downloads / wk) - I originally proposed replacing it with
tinyglobby
in #622. See that PR for the full background and additional details regarding this issue - Split this package into CLI and core. The CLI could retain the name
json-schema-to-typescript
and re-export the stuff contained in core, so that users could continue to install just the one package they need and the change could be made in a backwards-compatible fashion. This would also remove other packages likeminimist
andis-glob
from the core dependencies as well
it is worth noting that choosing your dependencies purely based on number of downloads isn't the best idea (re the closed PR)
fdir is much faster than existing glob libraries, even when combined with picomatch (to provide glob functionality). tinyglobby does not have as many downloads but is built on top of fdir, which is a well established library.
this repo would benefit from the performance improvement, and from reduction in install size
splitting the package seems like a larger effort that should be discussed/worked on at some other later point
Another option is to switch to native glob, once it's made it into an LTS or two. nodejs/node#51912
Yeah, I think we should. But I believe it's only available in Node 22, which means we'd probably be waiting until 2026
It could be worth using tinyglobby
or another solution in the meantime (tinyglobby
has continued to be adopted exponentially including by projects like vitest, tsup, nuxt, postcss-mixins, unocss, and vitepress)
That's fair. Let's go ahead and use tinyglobby
-- it seems like there's a good amount if interest in making this change.
Feel free to re-open and rebase your PR when you're ready.