Skip to content

Commit

Permalink
Cache getProdPackageNames optimistically.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Newman committed Nov 4, 2016
1 parent 7f35e94 commit 52697c7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tools/isobuild/meteor-npm.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
convert as convertColonsInPath
} from "../utils/colon-converter.js";

import { wrap as wrapOptimistic } from "optimism";
import {
dirtyNodeModulesDirectory,
optimisticLStat,
Expand Down Expand Up @@ -133,7 +134,7 @@ meteorNpm.updateDependencies = function (packageName,

// Returns a flattened dictionary of npm package names used in production,
// or false if there is no package.json file in the parent directory.
export function getProdPackageNames(nodeModulesDir) {
export const getProdPackageNames = wrapOptimistic(nodeModulesDir => {
const names = Object.create(null);
const dirs = Object.create(null);
const nodeModulesDirStack = [];
Expand Down Expand Up @@ -208,7 +209,7 @@ export function getProdPackageNames(nodeModulesDir) {
// Concretely, this means your app needs to have a package.json file if
// you want any npm packages to be excluded in production.
return walk(files.pathDirname(nodeModulesDir)) && names;
}
});

const lastRebuildJSONFilename = ".meteor-last-rebuild-version.json";

Expand Down

0 comments on commit 52697c7

Please sign in to comment.