I have the following scenario:
- install dev dependencies (gulp, gulp-zip)
- install regular dependencies (http-proxy)
"dependencies": {
"http-proxy": "^1.12.0"
},
"devDependencies": {
"gulp": "^3.9.0",
"gulp-zip": "^3.0.2"
}
I have to bundle my application code, as well as the http-proxy module, into a zip file in order to upload to my server (eg. aws lambda, or my server doesn't have internet access).
I don't want to zip up all 140 directories inside of node_modules when creating my deployment package. Instead, I want to only zip up my application code, http-proxy, and http-proxy's dependencies (eventemitter3, requires-port).
Is there a programmatic way to query npm in order to return an array of folders based on an array of modules?
In this example:
getFoldersFor(['http-proxy'])
-- or something --
where it would return:
['http-proxy', 'eventemitter3', 'requires-port']
so I could then only zip up those 3 folders into my application's deployment package (zip).
bundledDependencies looks like it is only for npm publishing, so that probably won't work directly.
With npm2, this was easy, as everything was nested. With npm3, there's no documented way of doing this.
Thanks!