I agree with exporting the pathDepth.

About checking the node_modules, I think it's just pointless... unless the guy doesn't have any package.json outside (which would be the initial mistake) I think the node_modules would never be taken, so I don't see the point on checking on it.

What you think?