Patch bundle all dependencies #2395

Closed
wants to merge 2 commits into
from
View
@@ -416,7 +416,13 @@ for more on the topic.
## bundledDependencies
-Array of package names that will be bundled when publishing the package.
+Package names that should be bundled from `node_modules/` when packing and/or
+publishing the package.
+
+If this is an array, then all of the package names in the array will be bundled.
+
+If this is a string, it will be used as a glob pattern and any package in
+`node_modules/` that matches the pattern will be bundled.
If this is spelled `"bundleDependencies"`, then that is also honorable.
@@ -418,8 +418,9 @@ function processObject (opts, cb) { return function (er, json) {
delete json.bundledDependencies
}
- if (json.bundleDependencies && !Array.isArray(json.bundleDependencies)) {
- var e = new Error("bundleDependencies must be an array.\n"
+ if (json.bundleDependencies && typeof json.bundleDependencies !== "string"
+ && !Array.isArray(json.bundleDependencies)) {
+ var e = new Error("bundleDependencies must be an array or string.\n"
+"See `npm help json`")
if (cb) return cb(e)
throw e