infernu
infernu copied to clipboard
Automatically recurse on directories
As a newbie, I want infernu to automatically recurse on directories, so that I can easily run infernu on large codebases.
As a mitigation, I can:
$ find . -type d -name node_modules -prune -o -type d -name bower_components -prune -o -type d -name target -prune -o -type f -name "*.js" -exec infernu {} \;
But I'd prefer infernu .
to "just work", like jshint .
just works.
The right way to fix this is to support module systems such as CommonJS/AMD/Closure/Node's require, etc.
For now, a better way to run your script is to pass all the files in the correct dependency order (there are some external tools that resolve dependencies and print the files in order). If you pass the files like you did one by one, infernu will not know about exported/import variables at all (they will be missing).
So for example, you can do:
find . -type f -iname "*.js" | xargs infernu