Skip to content

Commit

Permalink
fix(infrastructure): fixed npm run build error for empty package dire…
Browse files Browse the repository at this point in the history
…ctories (#85)
  • Loading branch information
Matt Goo authored May 31, 2018
1 parent 13fff1b commit 18666d4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');

const isDirectory = (source) => lstatSync(source).isDirectory();
const containsJsFile = (source) => readdirSync(source).some((file) => path.extname(file) === '.js');

const getChunks = (source) =>
readdirSync(source)
.map((filename) => path.join(source, filename))
.filter(isDirectory)
.filter((source) => isDirectory(source) && containsJsFile(source))
.map((directoryPath) => directoryPath.replace('packages\/', ''));

const chunks = getChunks('./packages');
Expand Down

0 comments on commit 18666d4

Please sign in to comment.