@samitouri / QOS-React / commits / 646781b0b4

Tweak the bundle validation script

Exit on error, and minor nits.

Dan Abramov committed Nov 4, 2017 at 13:00 UTC 646781b0b4f95d90cf08b7799bbd196e16136f06
1 file changed +5 -9
scripts/rollup/validate/index.js
+5 -9
@@ -39,18 +39,14 @@ function lint({format, filePatterns}) {
39
40 function checkFilesExist(bundle) {
41 const {format, filePatterns} = bundle;
42 - filePatterns.map(pattern => {
43 - console.log(`Check if files exist in ${pattern}`);
42 + filePatterns.forEach(pattern => {
43 + console.log(`Checking if files exist in ${pattern}...`);
44 const files = glob.sync(pattern);
45 if (files.length === 0) {
46 - console.error(
47 - chalk.red(
48 - `No files found in glob pattern ${pattern} in ${format} bundle.`
49 - )
50 - );
51 - process.exit();
46 + console.error(chalk.red(`Found no ${format} bundles in ${pattern}`));
47 + process.exit(1);
48 } else {
53 - console.log(chalk.green(`${files.length} files found.`));
49 + console.log(chalk.green(`Found ${files.length} bundles.`));
50 console.log();
51 }
52 });