Skip slow npm-update step for warehouse packages, which should be write-once.

This commit is contained in:
David Glasser
2013-03-21 14:50:23 -07:00
parent 664b98ba5e
commit 3cac15d23e
2 changed files with 15 additions and 2 deletions

View File

@@ -406,7 +406,11 @@ _.extend(Bundle.prototype, {
// what the current code will do)
if (pkg.npmDependencies) {
pkg.installNpmDependencies();
// If the package isn't in the warehouse, maybe update the NPM
// dependencies. (Warehouse packages shouldn't change after they're
// installed, so we skip this slow step.)
if (!pkg.inWarehouse)
pkg.installNpmDependencies();
self.bundleNodeModules(pkg);
}
@@ -432,7 +436,11 @@ _.extend(Bundle.prototype, {
// tests. one example is stream-buffers as used in the email
// package
if (pkg.npmDependencies) {
pkg.installNpmDependencies();
// If the package isn't in the warehouse, maybe update the NPM
// dependencies. (Warehouse packages shouldn't change after they're
// installed, so we skip this slow step.)
if (!pkg.inWarehouse)
pkg.installNpmDependencies();
self.bundleNodeModules(pkg);
}

View File

@@ -48,6 +48,10 @@ var Package = function () {
// registered source file handlers
self.extensions = {};
// Are we in the warehouse? (Set to true by initFromWarehouse.) Used to skip
// npm re-scans.
self.inWarehouse = false;
// functions that can be called when the package is scanned --
// visible as `Package` when package.js is executed
self.packageFacade = {
@@ -184,6 +188,7 @@ _.extend(Package.prototype, {
self.initFromPackageDir(
name,
path.join(warehouse.getWarehouseDir(), 'packages', name, version));
self.inWarehouse = true;
},
init_from_app_dir: function (app_dir, ignore_files) {