Skip to content

Commit

Permalink
Optimization: don't reprocess already processed packages
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-zaera committed Sep 14, 2017
1 parent bf0e8dc commit 8f74df7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/liferay-npm-bundler/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,20 @@ export default function(args) {
const start = new Date().getTime();

pkgs.forEach(pkg => {
console.log(`Bundling ${pkg.id}`);

const outPkgDir = `${outputDir}/node_modules/${pkg.id.replace(
'/',
'%2F',
)}`;

try {
if (fs.statSync(outPkgDir).isDirectory()) {
console.log(`Skipping ${pkg.id} (already bundled)`);
return;
}
} catch (err) {}

console.log(`Bundling ${pkg.id}`);

mkdirp(outPkgDir);

promises.push(
Expand Down

0 comments on commit 8f74df7

Please sign in to comment.