This repository has been archived by the owner on Aug 11, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3k
/
bundle.1
138 lines (137 loc) · 2.56 KB
/
bundle.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
.\" Generated with Ronnjs/v0.1
.\" http://github.com/kapouer/ronnjs/
.
.TH "NPM\-BUNDLE" "1" "October 2010" "" ""
.
.SH "NAME"
\fBnpm-bundle\fR \-\- Bundle package dependencies
.
.SH "EXPERIMENTAL"
This is experimental functionality\. If you have thoughts about how it
should work, please post a comment at:
http://github\.com/isaacs/npm/issues/issue/74
.
.SH "SYNOPSIS"
.
.nf
npm bundle <folder> [<pkg>]
.
.fi
.
.IP "\(bu" 4
\fB<folder>\fR:
The place where bundled dependencies go\.
.
.IP "\(bu" 4
\fB<pkg>\fR:
The package whose dependencies are to be bundled\. Defaults to $PWD\.
See \fBnpm help install\fR for more on the ways to identify a package\.
.
.IP "" 0
.
.SH "DESCRIPTION"
Bundles all the dependencies of a package into a specific folder\.
.
.P
Furthermore, sets up an index\.js in the folder that will shift it onto the
require\.paths, and export the bundled modules\.
.
.P
For example, to install of your requirements into a "deps" folder,
you could do this:
.
.IP "" 4
.
.nf
npm bundle deps
.
.fi
.
.IP "" 0
.
.P
Assuming your code is in the "lib" folder, and it depended on a package
"foo", you could then do this:
.
.IP "" 4
.
.nf
require("\.\./deps") // this sets the require\.paths properly\.
var foo = require("foo")
.
.fi
.
.IP "" 0
.
.P
The bundle index will also return the modules that your package
depends on\. So, this would work as well:
.
.IP "" 4
.
.nf
require("\.\./deps")\.foo\.createFoo(\.\.\.)
.
.fi
.
.IP "" 0
.
.P
The dependencies of those packages installed will also be installed and
linked, just like an \fBnpm install\fR command\. In fact, internally \fBbuffer\fR
just sets the \fBroot\fR config and then does a normal \fBnpm install\fR to put
the modules in place\.
.
.P
To update to new versions (or if the dependencies change) then run the
bundle command again\.
.
.SH "CAVEATS"
There is no pretty to "remove" a package from a bundle at the moment\.
However, you can do this:
.
.IP "" 4
.
.nf
npm \-\-root \./deps rm foo
.
.fi
.
.IP "" 0
.
.P
Bins and man pages are not installed by bundle\.
.
.P
Packages are \fIbuilt\fR, which often means they\'re compiled in that
architecture and against that version of node\. To update them, you can
do:
.
.IP "" 4
.
.nf
npm \-\-root \./deps rebuild
.
.fi
.
.IP "" 0
.
.P
or run \fBnpm bundle deps\fR on the target machine\.
.
.P
The \fBnpm update\fR command will do \fIhorrible\fR things to a bundle folder\.
Don\'t ever point update at that root, or your bundles may no longer
satisfy your dependencies\.
.
.P
Bundle does \fInot\fR support version ranges like
.
.IP "" 4
.
.nf
npm bundle deps sax@">=0\.1\.0 <0\.2\.0"
.
.fi
.
.IP "" 0