Closed woojoo666 closed 3 years ago
Oh, wow, that does seem rather large. Yeah, I agree, we should be able to do better for size.
If it's agreeable to folks, I can perhaps look to switch to command-line-args
: 112 KB unpacked ; https://bundlephobia.com/package/command-line-args@5.1.3 .
Sounds good to me. From what I saw in the source code, it looks like we only need it for command line argument parsing anyways. Another option I know of is Commander.js
, slightly bigger (143kb) but actively maintained and extremely popular. Alternatively, we can use the minimist
package (which was a part of the deprecated optimist
package that we removed). It's also very popular but much smaller (~32kb), although it hasn't been updated in over a year.
Here's a comparison of other popular options. Though ultimately I don't think we need to split too many hairs on this.
I've posted #230 (which builds on top of my ESM PR, #229).
I prefer to work with command-line-args
(or rather my light wrapper on top of that and command-line-usage
, command-line-basics
), both as I like its approach in being modular and in offering a declarative, schema-like approach which makes for simple readability given JS syntax-highlighting (and requires less parsing within the library). (One can also build HTML or SVG of the docs using command-line-publish
, but I didn't use that as we already have the README).
Feel free to let me know if that looks good for you.
Now that #229 uses Mocha, we can get binary file coverage, so I'd hope that we could get more binary tests added (mostly mirroring the programmatic ones) to give us assurances that the binary changes are working as expected.
@brettz9 looks great, thanks for the quick release!! And yes I definitely like how the option definitions are declared now. Looking forward to seeing this in the next version!
One of the things that appealed to me about node-static is the small size (as compared to other options like
http-server
andserve
). A bare install on my machine results in a totalnode_modules
size of ~200kb. However it looks like @brettz9 's recent changes will increase that significantly, since his fork@brettz9/node-static
has a size of ~1400kb. The vast majority of this is fromneodoc
, which adds about ~1000kb alone.Now don't get me wrong, I understand the change was to fix the security issues in the now-deprecated
(correction,minimist
optimist
) package. All of @brettz9 's changes were a massive improvement to the project. However, I wonder if we really need to increase the size of the package 7x for a CLI utility.Are there any other CLI utilities that we can use? Alternatively I guess we could just create a fork that doesn't include the CLI features, for people that just want the static server (like me).