NPM package post install target root directory

Viewed 218

I have an NPM package that has a post install script such as

 "postinstall": "node install.js"

I'm trying to target the directory from which the npm install mypackage was run originally. Right now I'm resorting to using in install.js some relative path such as

 path.normalize(__dirname+'./../../../www');

My structure goes as follow

 node_modules/@namespace/mypackage
 www     

But it's kind of ugly and cannot guarantee that this wouldn't break in future revisions of Node/NPM. Is there a constant that targets the path from which the npm install mypackage was run? Long story short, I'm moving files into www.

1 Answers
Related