Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Offer a "minimal" version with less dependencies #333

Open
d-fischer opened this issue Oct 15, 2023 · 0 comments
Open

Offer a "minimal" version with less dependencies #333

d-fischer opened this issue Oct 15, 2023 · 0 comments

Comments

@d-fischer
Copy link
Member

d-fischer commented Oct 15, 2023

There should be a more minimal (or "base") package offered that gets rid of a few dependencies:

  • parse-json could be replaced by JSON.parse - the former improves error messages, but if you don't want that, the latter reduces the dependency impact to zero since it's included in the standard library
  • import-fresh could be replaced by just calling require - similar to above, the advantage of the former being that file changes during the runtime can be respected
  • js-yaml could be removed, making YAML support optional

This would leave us with only two dependencies, env-paths and path-type, which each have no dependencies of their own. (We can probably also get rid of path-type, but that's a separate concern.)

The end goal would probably be that there is a "base" package, and the "full" package depends on that, adding and replacing default loaders to achieve the current state of cosmiconfig (i.e., this should not contain any breaking changes).

Offering this, we will either have two repositories or a monorepo.

You should be able to use the "base" package and still add back a YAML parser, parse-json or import-fresh as you like.

It is important to note that it should be possible to ignore searchPlaces that do not have loaders attached to them due to the mentioned removal of YAML support in the "base" package. If you add a YAML parser (or the "full" package does), the searchPlaces should be in the exact state that is currently in the code.

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

No branches or pull requests

1 participant