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

Drop dependency on moment.js? #317

Open
terlar opened this issue Aug 23, 2019 · 5 comments
Open

Drop dependency on moment.js? #317

terlar opened this issue Aug 23, 2019 · 5 comments

Comments

@terlar
Copy link

terlar commented Aug 23, 2019

Would it be possible to drop the dependency on moment? I want to use node-convict in a smaller project, but the fact that it depends on moment which pulls in quite a substantial amount of code I have to second guess if I can use it. Perhaps some smaller date function library could replace it?

I also noticed yargs, which seem to have a limited use, what is it used for today?

Thanks for a very useful package.

@A-312
Copy link
Contributor

A-312 commented Aug 23, 2019

image

It is only dev dependencies : https://github.com/moment/moment/blob/develop/package.json#L39

npm install --save-prod

@terlar
Copy link
Author

terlar commented Aug 23, 2019

I'm sorry if I was unclear, I meant moment itself:

$ du -hs moment
3.5M    moment
$ find moment -name '*.js' | wc -l
367
$ find moment -name '*.js' -exec cat {} \; | wc -l
56957

It is quite a substantial amount for smaller things.

@brettneese
Copy link
Contributor

brettneese commented Aug 25, 2019

I looked into this at one point. The ideal thing to do here would be to replace Moment with dayjs, which is designed to be a lighter but API compatible drop-in replacement. Unfortunately, dayjs doesn't yet support .duration() - I've been following this issue, and hoping it gets merged in soon, but progress seems slow.

@A-312
Copy link
Contributor

A-312 commented Sep 9, 2019

Or add duration and timestamp like a dependencie with addFormat.

convict.addFormat(require('convict-duration'))

@A-312
Copy link
Contributor

A-312 commented Apr 11, 2020

Next step:

  • Yargs should be optional

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

No branches or pull requests

3 participants