@@ -81,8 +81,8 @@ which npm
81
81
# shrinkwrap file with it, too. We do this in a separate place from
82
82
# $DIR/server-lib/node_modules originally, because otherwise 'npm shrinkwrap'
83
83
# will get confused by the pre-existing modules.
84
- mkdir " ${DIR} /build/npm-install"
85
- cd " ${DIR} /build/npm-install"
84
+ mkdir " ${DIR} /build/npm-server- install"
85
+ cd " ${DIR} /build/npm-server- install"
86
86
node " ${CHECKOUT_DIR} /scripts/dev-bundle-server-package.js" > package.json
87
87
npm install
88
88
npm shrinkwrap
@@ -107,29 +107,18 @@ shrink_fibers () {
107
107
cd " $DIR /server-lib/node_modules/fibers/bin"
108
108
shrink_fibers
109
109
110
- # Now, install the rest of the npm modules, which are only used by the 'meteor'
111
- # tool (and not by the bundled app boot.js script).
112
- cd " ${DIR} /lib"
113
-
114
-
115
-
116
-
117
-
118
-
119
-
120
-
121
-
122
-
123
-
124
-
125
-
126
-
110
+ # Now, install the npm modules which are the dependencies of the command-line
111
+ # tool.
112
+ mkdir " ${DIR} /build/npm-tool-install"
113
+ cd " ${DIR} /build/npm-tool-install"
114
+ node " ${CHECKOUT_DIR} /scripts/dev-bundle-tool-package.js" > package.json
115
+ npm install
116
+ # Refactor node modules to top level and remove unnecessary duplicates.
117
+ npm dedupe
118
+ cp -R node_modules/* " ${DIR} /lib/node_modules/"
127
119
128
-
129
- rm -rf node_modules/browserstack-webdriver/docs
130
- rm -rf node_modules/browserstack-webdriver/lib/test
131
120
132
-
121
+ cd " ${DIR} /lib "
133
122
134
123
# TODO(ben) Switch back to NPM once this branch is merged upstream.
135
124
pushd node_modules
@@ -143,49 +132,42 @@ rm -rf node_modules/{grunt,grunt-contrib-coffee,grunt-cli,grunt-shell,grunt-atom
143
132
popd
144
133
popd
145
134
146
-
147
-
148
-
149
- rm -rf node_modules/sqlite3/deps
150
-
151
-
152
-
153
- # Clean up a big zip file it leaves behind.
154
-
155
- rm -rf node_modules/phantomjs/tmp
156
-
157
-
158
-
159
- # XXX We ought to be able to get this from the copy in js-analyze rather than in
160
- # the dev bundle.)
161
-
162
- rm -rf node_modules/esprima/test
163
-
164
- # 2.4.0 (more or less, the package.json change isn't committed) plus our PR
165
- # https://github.com/williamwicks/node-eachline/pull/4
166
- npm install https://github.com/meteor/node-eachline/tarball/ff89722ff94e6b6a08652bf5f44c8fffea8a21da
167
-
168
- # Cordova npm tool for mobile integration
169
- # XXX We install our own fork of cordova because we need a particular patch that
170
- # didn't land to cordova-android yet. As soon as it lands, we can switch back to
171
- # upstream.
172
- # https://github.com/apache/cordova-android/commit/445ddd89fb3269a772978a9860247065e5886249
173
-
174
- npm install " https://github.com/meteor/cordova-cli/tarball/0c9b3362c33502ef8f6dba514b87279b9e440543"
175
- rm -rf node_modules/cordova/node_modules/cordova-lib/node_modules/cordova-js/node_modules/browserify/node_modules/browser-pack/node_modules/JSONStream/test/fixtures
176
- rm -rf node_modules/cordova/node_modules/cordova-lib/node_modules/cordova-js/node_modules/browserify/node_modules/browserify-zlib/node_modules/pako/benchmark
177
- rm -rf node_modules/cordova/node_modules/cordova-lib/node_modules/cordova-js/node_modules/browserify/node_modules/browserify-zlib/node_modules/pako/test
178
- rm -rf node_modules/cordova/node_modules/cordova-lib/node_modules/cordova-js/node_modules/browserify/node_modules/buffer/perf
179
- rm -rf node_modules/cordova/node_modules/cordova-lib/node_modules/cordova-js/node_modules/browserify/node_modules/crypto-browserify/test
180
- rm -rf node_modules/cordova/node_modules/cordova-lib/node_modules/cordova-js/node_modules/browserify/node_modules/derequire/node_modules/esprima-fb/test
181
- rm -rf node_modules/cordova/node_modules/cordova-lib/node_modules/cordova-js/node_modules/browserify/node_modules/derequire/node_modules/esrefactor/node_modules/esprima/test
182
- rm -rf node_modules/cordova/node_modules/cordova-lib/node_modules/cordova-js/node_modules/browserify/node_modules/insert-module-globals/node_modules/lexical-scope/node_modules/astw/node_modules/esprima-fb/test
183
- rm -rf node_modules/cordova/node_modules/cordova-lib/node_modules/cordova-js/node_modules/browserify/node_modules/module-deps/node_modules/detective/node_modules/escodegen/node_modules/esprima/test
184
- rm -rf node_modules/cordova/node_modules/cordova-lib/node_modules/cordova-js/node_modules/browserify/node_modules/module-deps/node_modules/detective/node_modules/esprima-fb/test
185
- rm -rf node_modules/cordova/node_modules/cordova-lib/node_modules/cordova-js/node_modules/browserify/node_modules/syntax-error/node_modules/esprima-fb/test
186
- rm -rf node_modules/cordova/node_modules/cordova-lib/node_modules/cordova-js/node_modules/browserify/node_modules/umd/node_modules/ruglify/test
135
+ # Clean up some bulky stuff.
136
+ pushd node_modules
137
+
138
+ # Used to delete bulky subtrees. It's an error (unlike with rm -rf) if they
139
+ # don't exist, because that might mean it moved somewhere else and we should
140
+ # update the delete line.
141
+ delete () {
142
+ if [ ! -e " $1 " ]; then
143
+ echo " Missing (moved?): $1 "
144
+ exit 1
145
+ fi
146
+ rm -rf " $1 "
147
+ }
187
148
188
- cd " $DIR /server-lib/node_modules/fibers/bin"
149
+ delete browserstack-webdriver/docs
150
+ delete browserstack-webdriver/lib/test
151
+
152
+ delete sqlite3/deps
153
+
154
+ # dedupe isn't good enough to eliminate 3 copies of esprima, sigh.
155
+ find . -path ' */esprima/test' | xargs rm -rf
156
+ find . -path ' */esprima-fb/test' | xargs rm -rf
157
+
158
+ # dedupe isn't good enough to eliminate 4 copies of JSONstream, sigh.
159
+ find . -path ' */JSONStream/test/fixtures' | xargs rm -rf
160
+
161
+ # Not sure why dedupe doesn't lift these to the top.
162
+ pushd cordova/node_modules/cordova-lib/node_modules/cordova-js/node_modules/browserify/node_modules
163
+ delete browserify-zlib/node_modules/pako/benchmark
164
+ delete browserify-zlib/node_modules/pako/test
165
+ delete buffer/perf
166
+ delete crypto-browserify/test
167
+ delete umd/node_modules/ruglify/test
168
+ popd
169
+
170
+ cd " $DIR /lib/node_modules/fibers/bin"
189
171
shrink_fibers
190
172
191
173
# Download BrowserStackLocal binary.
0 commit comments