Skip to content

neodoc is a massive dependency #228

Closed

Description

@woojoo666

One of the things that appealed to me about node-static is the small size (as compared to other options like http-server and serve). A bare install on my machine results in a total node_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 from neodoc, 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 minimist (correction, 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).

Activity

  1. brettz9 commented on Jul 21, 2021

    @brettz9
    Collaborator

    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 .

  2. woojoo666 commented on Jul 21, 2021

    @woojoo666
    Author

    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.

  3. brettz9 commented on Jul 23, 2021

    @brettz9
    Collaborator

    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.

  4. woojoo666 commented on Jul 24, 2021

    @woojoo666
    Author

    @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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions