Q: Is it possible to change the context in which npm runs scripts?
I want the following:
"scripts": { "test": "gulp mocha", "pre-install": "./deps/2.7/cpython/configure --prefix=$(pwd)/build --exec-prefix=$(pwd)/build && make -C deps/2.7/cpython && make -C deps/2.7/cpython install", "install": "node-gyp rebuild" },
Obviously, cd deps/2.7/cpython/ && ./configure will work on UNIX-like systems, but not windows.
Why: The root of the problem is that the python repo configure command dumps files to the directory in which it is called. Files, however, matter to make and make install , which look for files in the repo directory.
In this case, I cannot modify the Makefile , since the Python build process seems to be complicated.
Alternative: An alternative is perhaps to write install.js and use the node OS independent API and some child_process.exec() , which I'm probably going to do. However, not leaving npm would be very nice.
eljefedelrodeodeljefe May 17 '15 at 11:35 2015-05-17 11:35
source share