Move npm depdencies from dev bundle to packages

This commit is contained in:
Avital Oliver
2013-01-17 14:02:58 -08:00
committed by David Glasser
parent 30c61be11c
commit 8998633f3c
16 changed files with 109 additions and 17 deletions

View File

@@ -106,9 +106,12 @@ var PackageInstance = function (pkg, bundle) {
useNpm: function (npmDependencies) {
var meteorNpm = require(path.join(__dirname, 'meteor_npm.js'));
if (this.npmDependencies)
throw new Error("Can only call `useNpm` once.");
this.npmDependencies = npmDependencies;
// make sure we haven't called useNpm on different sets of
// dependencies. (this may be called multiple times if this
// package is used by other packages)
if (self.pkg._npmDependencies && !_.isEqual(self.pkg._npmDependencies, npmDependencies))
throw new Error("Can only call `useNpm` once in package " + self.pkg.name + ".");
self.pkg._npmDependencies = npmDependencies;
// don't allow npm fuzzy versions so that there is complete
// consistency when deploying a meteor app

View File

@@ -19,7 +19,7 @@ var lastTmpDir;
Fiber(function () {
try {
/// RUN TESTS
//xcxc require(path.join(__dirname, 'test_bundler_options.js'));
require(path.join(__dirname, 'test_bundler_options.js'));
require(path.join(__dirname, 'test_bundler_npm.js'));
/// SUCCESS

3
packages/email/.npm/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
package.json
npm-shrinkwrap.json
node_modules

View File

@@ -0,0 +1,54 @@
{
"name": "packages",
"version": "0.0.0",
"dependencies": {
"mailcomposer": {
"version": "0.1.15",
"dependencies": {
"mimelib-noiconv": {
"version": "0.1.9"
}
}
},
"simplesmtp": {
"version": "0.1.25",
"dependencies": {
"rai": {
"version": "0.1.7"
},
"xoauth2": {
"version": "0.1.4",
"dependencies": {
"request": {
"version": "2.12.0",
"dependencies": {
"form-data": {
"version": "0.0.3",
"dependencies": {
"combined-stream": {
"version": "0.0.3",
"dependencies": {
"delayed-stream": {
"version": "0.0.5"
}
}
},
"async": {
"version": "0.1.9"
}
}
},
"mime": {
"version": "1.2.7"
}
}
}
}
}
}
},
"stream-buffers": {
"version": "0.2.3"
}
}
}

View File

@@ -3,7 +3,7 @@ Email = {};
(function () {
var Future = __meteor_bootstrap__.require('fibers/future');
var urlModule = __meteor_bootstrap__.require('url');
var MailComposer = __meteor_bootstrap__.require('mailcomposer').MailComposer;
var MailComposer = requireNpm('mailcomposer').MailComposer;
var makePool = function (mailUrlString) {
var mailUrl = urlModule.parse(mailUrlString);
@@ -19,7 +19,7 @@ Email = {};
pass: parts[1] && decodeURIComponent(parts[1])};
}
var simplesmtp = __meteor_bootstrap__.require('simplesmtp');
var simplesmtp = requireNpm('simplesmtp');
var pool = simplesmtp.createClientPool(
port, // Defaults to 25
mailUrl.hostname, // Defaults to "localhost"

View File

@@ -1,4 +1,4 @@
streamBuffers = __meteor_bootstrap__.require('stream-buffers');
streamBuffers = requireNpm('stream-buffers');
Tinytest.add("email - dev mode smoke test", function (test) {
// This only tests dev mode, so don't run the test if this is deployed.

View File

@@ -4,6 +4,7 @@ Package.describe({
Package.on_use(function (api) {
api.add_files('email.js', 'server');
api.useNpm({mailcomposer: "0.1.15", simplesmtp: "0.1.25", "stream-buffers": "0.2.3"});
});
Package.on_test(function (api) {

View File

@@ -0,0 +1,3 @@
package.json
npm-shrinkwrap.json
node_modules

View File

@@ -0,0 +1,14 @@
{
"name": "packages",
"version": "0.0.0",
"dependencies": {
"mongodb": {
"version": "1.1.11",
"dependencies": {
"bson": {
"version": "0.1.5"
}
}
}
}
}

View File

@@ -9,7 +9,7 @@
*/
var path = __meteor_bootstrap__.require('path');
var MongoDB = __meteor_bootstrap__.require('mongodb');
var MongoDB = requireNpm('mongodb');
var Fiber = __meteor_bootstrap__.require('fibers');
var Future = __meteor_bootstrap__.require(path.join('fibers', 'future'));

View File

@@ -15,6 +15,7 @@ Package.describe({
Package.on_use(function (api) {
api.use(['random', 'ejson', 'json', 'underscore', 'minimongo', 'logging', 'livedata'],
['client', 'server']);
api.useNpm({mongodb: "1.2.13"});
api.add_files('mongo_driver.js', 'server');
api.add_files('local_collection_driver.js', ['client', 'server']);

3
packages/stream/.npm/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
package.json
npm-shrinkwrap.json
node_modules

View File

@@ -0,0 +1,17 @@
{
"name": "packages",
"version": "0.0.0",
"dependencies": {
"sockjs": {
"version": "0.3.4",
"dependencies": {
"node-uuid": {
"version": "1.3.3"
},
"faye-websocket": {
"version": "0.4.0"
}
}
}
}
}

View File

@@ -7,6 +7,7 @@ Package.on_use(function (api) {
api.use(['underscore', 'logging', 'random', 'json'], ['client', 'server']);
api.use('reload', 'client');
api.use('routepolicy', 'server');
api.useNpm({sockjs: "0.3.4"});
api.add_files('sockjs-0.3.4.js', 'client');

View File

@@ -15,7 +15,7 @@ Meteor._StreamServer = function () {
self.open_sockets = [];
// set up sockjs
var sockjs = __meteor_bootstrap__.require('sockjs');
var sockjs = requireNpm('sockjs');
self.server = sockjs.createServer({
prefix: '/sockjs', log: function(){},
// this is the default, but we code it explicitly because we depend

View File

@@ -85,14 +85,10 @@ npm install stylus@0.30.1
npm install nib@0.8.2
npm install semver@1.1.0
npm install handlebars@1.0.7
npm install mongodb@1.2.13
npm install clean-css@0.8.3
npm install useragent@2.0.1
npm install request@2.12.0
npm install simplesmtp@0.1.25
npm install stream-buffers@0.2.3
npm install keypress@0.1.0
npm install sockjs@0.3.4
npm install http-proxy@0.8.5
npm install underscore@1.4.2 # 1.4.4 is a performance regression
npm install fstream@0.1.21
@@ -114,10 +110,6 @@ npm install https://github.com/meteor/UglifyJS2/tarball/aa5abd14d3
# https://github.com/visionmedia/node-progress/issues/19
npm install progress@0.0.5
# pinned at older version. 0.1.16+ uses mimelib, not mimelib-noiconv
# which make the dev bundle much bigger. We need a better solution.
npm install mailcomposer@0.1.15
# If you update the version of fibers in the dev bundle, also update the "npm
# install" command in docs/client/concepts.html and in the README in
# app/lib/bundler.js.