Calling out to a glob library just to read a directory has an unecessary performance impact and complexity.
In the future, the glob will be upgraded (doing so may help fix other various issues), and the library introduces major changes to the API on later versions. Restructuring out glob prevents this area from being hit during that inevitable upgrade.
Proposed changes:
Remove the call to glob and replace it with calls to functions from the fs and path module.
I note that the structure of arrFiles changes subtly. Before, it looked like:
[ './formatters/checkstyle.js', ...]
Now, the relative path prefix no longer exists:
[ 'formatters/checkstyle.js', ... ]
This is not an issue because the paths are subsequently passed to path.resolve(__dirname, ARRAY_ENTRY), which can handle both cases.
Short description of what this resolves:
Calling out to a
glob
library just to read a directory has an unecessary performance impact and complexity.In the future, the
glob
will be upgraded (doing so may help fix other various issues), and the library introduces major changes to the API on later versions. Restructuring outglob
prevents this area from being hit during that inevitable upgrade.Proposed changes:
Remove the call to
glob
and replace it with calls to functions from thefs
andpath
module.I note that the structure of
arrFiles
changes subtly. Before, it looked like:Now, the relative path prefix no longer exists:
This is not an issue because the paths are subsequently passed to
path.resolve(__dirname, ARRAY_ENTRY)
, which can handle both cases.