Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Patch bundle all dependencies #2395

Closed
wants to merge 2 commits into from

5 participants

@grncdr

These are the changes required in npm for npm/fstream-npm#1 to be usable.

@isaacs
Owner
@badunk

+1, I would like this as well for npm pack. Its nice to be able to deploy an app with all its dependencies in a sandboxed environment.

Listing the dependencies twice can cause unnecessary mistakes, especially in the case where npm install --save dep is used

@timoxley
Collaborator

@grncdr bump RE #2395 (comment)

Any update on this?

@grncdr

oh hey, I don't think I ever saw that comment. FWIW I don't actually have any interest in pushing this patch forwards as I adjusted my workflows to not need it long ago. @badunk feel free to grab those diffs and submit a new PR to read-package-json. Also, the pull request for fstream-npm referenced by this one is still open and would need to be merged for this to make any sense. (npm/fstream-npm#1)

@grncdr grncdr closed this
@rlidwka

What about this syntax?:

bundleDependencies: [
  '*',
  '!ronn',
  '!tap',
  '!npm-registry-mock',
]

Where each subsequent line overrides previous one, and "!" negates it's effect?..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 10 additions and 3 deletions.
  1. +7 −1 doc/cli/json.md
  2. +3 −2 lib/utils/read-json.js
View
8 doc/cli/json.md
@@ -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.
View
5 lib/utils/read-json.js
@@ -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
Something went wrong with that request. Please try again.