I am developing an NPM package. Now I want to know the easiest way to get the root of the project which utilizes my custom package.
Within my package itself it is pretty easy to get the root in node.js like so:
__dirname
This points to the root of my package itself though. I would like to get the root of the project which actually performed the npm install
of my package though.
Obviously, I could simply go up from the node_modules
directory and assume that the root directory is there but this sounds really bad.
Is there a standard way to achieve this?