I am currently working on a node project that requires eslint as a dependency. Hence, a file named eslint
and eslint.cmd
was created automatically in the root_directory/node_modules/.bin folder.
The content of the eslint file is -
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/../eslint/bin/eslint.js" "$@"
ret=$?
else
node "$basedir/../eslint/bin/eslint.js" "$@"
ret=$?
fi
exit $ret
Can someone give a line-to-line explaination to what exactly this code is doing?
I read the answer on What is the purpose of .bin folder in node_modules?
Still couldn't figure out how this code does all that is stated in the answers.
node version - 12.10.0
npm version - 6.10.3