mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-26 10:45:32 +08:00
Summary: @public Now that watchman perf issue was fixed we can enable watchman-based fs crawling which is faster than node. This showed an existing issue with some files missing from the blacklist which I addressed. Test Plan: ./fbrnios.sh run click around and scroll all the apps
27 lines
697 B
JavaScript
27 lines
697 B
JavaScript
'use strict';
|
|
|
|
const nodeCrawl = require('./node');
|
|
const watchmanCrawl = require('./watchman');
|
|
|
|
function crawl(roots, options) {
|
|
const {fileWatcher} = options;
|
|
return fileWatcher.isWatchman().then(isWatchman => {
|
|
if (!isWatchman) {
|
|
return false;
|
|
}
|
|
|
|
// Make sure we're dealing with a version of watchman
|
|
// that's using `watch-project`
|
|
// TODO(amasad): properly expose (and document) used sane internals.
|
|
return fileWatcher.getWatchers().then(([watcher]) => !!watcher.watchProjectInfo.root);
|
|
}).then(isWatchman => {
|
|
if (isWatchman) {
|
|
return watchmanCrawl(roots, options);
|
|
}
|
|
|
|
return nodeCrawl(roots, options);
|
|
});
|
|
}
|
|
|
|
module.exports = crawl;
|