esformatter
esformatter copied to clipboard
process multiple files in parallel
something similar to the way jscodeshift works (create multiple child processes and run transforms in parallel).
this should speed things up drastically when processing large codebases.
PS: this is a very good candidate for a dedicated project, maybe there is something on npm that we can reuse.
Fyi, you can use xargs -n 50 -p 8
to run the command on 8 cores using 50 files at a time.
find src -name '*.js' | xargs -n 50 -p 8 esformatter
see also: https://www.npmjs.com/package/worker-farm
@vjeux I'm probably wrong as it's not my best field but I've read "find -exec" is safer than "find + xargs". Feel free to search or just ignore me :P
@nmaxcom yeahh, if you have files with quotes or spaces, then you are going to be screwed. But if someone is able to create arbitrary named files on your file system, you are dead anyway, they can just change any js file and run arbitrary code.