size-limit
size-limit copied to clipboard
size-limit --watch
Option to re-run script on any file changes in the project
I started hacking this issue, but I have a question: when user has multiple files for checking is it needed to check the size of the only file/files that have been changed? I have a solution now, but size-limit will always check all files in watch mode. I found hard to make size-limit checking individual files when they have been changed
is it needed to check the size of the only file/files that have been changed?
It is OK to check all
@ai, is it worth using third party packages like chokidar that enhance fs.watch from standart library or it's preferable to provide zero dependency solution?
What is the difference?
We either get +1 dependency and don't reinvent workarounds that eliminate fs.watch's problems or do it by our own and don't add extra dependencies to the project.
What fs.watch problems do we have?
According to docs fs.watch doesn't support recursive watch on Linux (didn't check myself). Some events might be fired multiple times (simply being solved using debounce).
What is recursive watch?
fs.watch has option recursive, which indicates whether all subdirectories should be watched, or only the current directory
Yeap, we need recursive watch and Linux support.
What third party libraries do we have and what is the difference between them?
I've briefly examined only 2. I can take a closer look a little bit later.
chokidar and watchpack (which webpack uses under the hood).
chokidar seems to have more flexibility in terms of configuring performance of the tool: recursion depth and awaitWriteFinish when large files are being written to filesystem
watchpack in turn has less dependencies :)
I think we need more investigating.
https://github.com/inotify-tools/inotify-tools/wiki
I've implemented this. Please check https://github.com/jayhoney/size-limit/tree/feature/watch-mode
@jaydenseric great! Looks good.
Can you send pull request? it has better UI for code review.