I'd like to replicate webpack's ability to be run from any directory with npm scripts.
For example this works with Webpack
webpack --config /absolute/path/to/webpack.config.js
/absolute/path/to/package.json/npm run build
There does not seem to be any option in npm to specify a folder, so I think you will have to cd into the directory, run your npm command, then cd out again (note that $OLDPWD automatically holds the previous working directory - you don't have to assign it):
cd /path/to/package.json; npm run build; cd $OLDPWD
However, if an error occurs during your npm call, you will be stuck in that directory.