Skip to content

Commit 1487d82

Browse files
committed
move tool deps to package.json to run npm dedupe
1 parent 289d92f commit 1487d82

4 files changed

+101
-69
lines changed

meteor

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
BUNDLE_VERSION=0.3.69 # 0.3.63 on the Windows branch
3+
BUNDLE_VERSION=0.3.70 # 0.3.63 on the Windows branch
44

55
# OS Check. Put here because here is where we download the precompiled
66
# bundles that are arch specific.

scripts/dev-bundle-server-package.js

-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ var packageJson = {
2626
devDependencies: {
2727
// 2.4.0 (more or less, the package.json change isn't committed) plus our PR
2828
// https://github.com/williamwicks/node-eachline/pull/4
29-
//
30-
// This is only used by shell.js which is usually only used in dev
31-
// mode. It's small though.
3229
eachline: "https://github.com/meteor/node-eachline/tarball/ff89722ff94e6b6a08652bf5f44c8fffea8a21da",
3330
chalk: "0.5.1"
3431
}

scripts/dev-bundle-tool-package.js

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
// This file contains a package.json for the dependencies of the command-line
2+
// tool.
3+
4+
// We put this in a JS file so that it can contain comments. It is processed
5+
// into a package.json file by generate-dev-bundle.sh.
6+
7+
var packageJson = {
8+
name: "meteor-dev-bundle-tool",
9+
// Version is not important but is needed to prevent warnings.
10+
version: "0.0.0",
11+
dependencies: {
12+
// Fibers 1.0.2 is out but introduces a bug that's been fixed on master
13+
// but unreleased: https://github.com/laverdet/node-fibers/pull/189
14+
// We will definitely need to upgrade in order to support Node 0.12 when
15+
// it's out, though.
16+
fibers: "1.0.1",
17+
// Not yet upgrading Underscore from 1.5.2 to 1.7.0 (which should be done
18+
// in the package too) because we should consider using lodash instead
19+
// (and there are backwards-incompatible changes either way).
20+
underscore: "1.5.2",
21+
"source-map-support": "0.2.8",
22+
semver: "4.1.0",
23+
24+
request: "2.47.0",
25+
fstream: "1.0.2",
26+
tar: "1.0.2",
27+
kexec: "0.2.0",
28+
"source-map": "0.1.40",
29+
"browserstack-webdriver": "2.41.1",
30+
"node-inspector": "0.7.4",
31+
chalk: "0.5.1",
32+
sqlite3: "3.0.2",
33+
netroute: "0.2.5",
34+
phantomjs: "1.9.12",
35+
"http-proxy": "1.6.0",
36+
// XXX We ought to be able to get this from the copy in js-analyze rather
37+
// than in the dev bundle.)
38+
esprima: "1.2.2",
39+
// 2.4.0 (more or less, the package.json change isn't committed) plus our PR
40+
// https://github.com/williamwicks/node-eachline/pull/4
41+
eachline: "https://github.com/meteor/node-eachline/tarball/ff89722ff94e6b6a08652bf5f44c8fffea8a21da",
42+
43+
// XXX We install our own fork of cordova because we need a particular patch that
44+
// didn't land to cordova-android yet. As soon as it lands, we can switch back to
45+
// upstream.
46+
// https://github.com/apache/cordova-android/commit/445ddd89fb3269a772978a9860247065e5886249
47+
// npm install [email protected]
48+
"cordova": "https://github.com/meteor/cordova-cli/tarball/0c9b3362c33502ef8f6dba514b87279b9e440543"
49+
}
50+
};
51+
52+
53+
process.stdout.write(JSON.stringify(packageJson, null, 2) + '\n');

scripts/generate-dev-bundle.sh

+47-65
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ which npm
8181
# shrinkwrap file with it, too. We do this in a separate place from
8282
# $DIR/server-lib/node_modules originally, because otherwise 'npm shrinkwrap'
8383
# 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"
8686
node "${CHECKOUT_DIR}/scripts/dev-bundle-server-package.js" >package.json
8787
npm install
8888
npm shrinkwrap
@@ -107,29 +107,18 @@ shrink_fibers () {
107107
cd "$DIR/server-lib/node_modules/fibers/bin"
108108
shrink_fibers
109109

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-
npm install [email protected]
114-
npm install [email protected]
115-
npm install [email protected]
116-
npm install [email protected]
117-
118-
npm install [email protected]
119-
120-
npm install [email protected]
121-
122-
npm install [email protected]
123-
124-
npm install [email protected]
125-
126-
npm install [email protected]
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/"
127119

128-
npm install [email protected]
129-
rm -rf node_modules/browserstack-webdriver/docs
130-
rm -rf node_modules/browserstack-webdriver/lib/test
131120

132-
npm install [email protected]
121+
cd "${DIR}/lib"
133122

134123
# TODO(ben) Switch back to NPM once this branch is merged upstream.
135124
pushd node_modules
@@ -143,49 +132,42 @@ rm -rf node_modules/{grunt,grunt-contrib-coffee,grunt-cli,grunt-shell,grunt-atom
143132
popd
144133
popd
145134

146-
npm install [email protected]
147-
148-
npm install [email protected]
149-
rm -rf node_modules/sqlite3/deps
150-
151-
npm install [email protected]
152-
153-
# Clean up a big zip file it leaves behind.
154-
npm install [email protected]
155-
rm -rf node_modules/phantomjs/tmp
156-
157-
npm install [email protected]
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-
npm install [email protected]
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-
#npm install [email protected]
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+
}
187148

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"
189171
shrink_fibers
190172

191173
# Download BrowserStackLocal binary.

0 commit comments

Comments
 (0)