Add JS files check before executing esvalidate. Check for esvalidate existence. Change grep -P to -e for OSX compatibility.