mozilla / node-convict

Featureful configuration management library for Node.js
Other
2.35k stars 146 forks source link

Drop dependency on moment.js? #317

Open terlar opened 5 years ago

terlar commented 5 years ago

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 commented 5 years ago

image

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

npm install --save-prod
terlar commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

Or add duration and timestamp like a dependencie with addFormat.

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

A-312 commented 4 years ago

Next step: