Fix crash with an empty programs/foo dir

We should never use the existence of a directory in our source tree to
make a decision, because git doesn't track directory existence, and it's
easy to end up with extraneous directories (containing gitignored files,
eg).  So we should ignore programs/foo directories in apps if they don't
contain package.js.
This commit is contained in:
David Glasser
2013-12-17 18:35:31 -08:00
parent fa25bcafb4
commit ebb729f0f6

View File

@@ -1675,6 +1675,16 @@ exports.bundle = function (appDir, outputPath, options) {
// Recover by ignoring this program
return;
}
// Programs must (for now) contain a `package.js` file. If not, then
// perhaps the directory we are seeing is left over from another git
// branch or something and we should ignore it. We don't actually parse
// the package.js file here, though (but we do restart if it is later
// added or changed).
if (watch.readAndWatchFile(
watchSet, path.join(programsDir, item, 'package.js')) === null) {
return;
}
targets[item] = true; // will be overwritten with actual target later
// Read attributes.json, if it exists