mirror of https://github.com/status-im/metro.git
[react-packager] Enable watchman fs crawl
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
This commit is contained in:
parent
d70ff04746
commit
15a0f07c5f
|
@ -24,7 +24,7 @@ var platformBlacklists = {
|
||||||
ios: [
|
ios: [
|
||||||
'node_modules/react-tools/src/browser/ui/React.js',
|
'node_modules/react-tools/src/browser/ui/React.js',
|
||||||
'node_modules/react-tools/src/browser/eventPlugins/ResponderEventPlugin.js',
|
'node_modules/react-tools/src/browser/eventPlugins/ResponderEventPlugin.js',
|
||||||
// 'node_modules/react-tools/src/vendor/core/ExecutionEnvironment.js',
|
'node_modules/react-tools/src/vendor/core/ExecutionEnvironment.js',
|
||||||
'.web.js',
|
'.web.js',
|
||||||
'.android.js',
|
'.android.js',
|
||||||
],
|
],
|
||||||
|
@ -32,7 +32,7 @@ var platformBlacklists = {
|
||||||
'node_modules/react-tools/src/browser/ui/React.js',
|
'node_modules/react-tools/src/browser/ui/React.js',
|
||||||
'node_modules/react-tools/src/browser/eventPlugins/ResponderEventPlugin.js',
|
'node_modules/react-tools/src/browser/eventPlugins/ResponderEventPlugin.js',
|
||||||
'node_modules/react-tools/src/browser/ReactTextComponent.js',
|
'node_modules/react-tools/src/browser/ReactTextComponent.js',
|
||||||
// 'node_modules/react-tools/src/vendor/core/ExecutionEnvironment.js',
|
'node_modules/react-tools/src/vendor/core/ExecutionEnvironment.js',
|
||||||
'.web.js',
|
'.web.js',
|
||||||
'.ios.js',
|
'.ios.js',
|
||||||
],
|
],
|
||||||
|
|
|
@ -2353,7 +2353,8 @@ describe('DependencyGraph', function() {
|
||||||
}
|
}
|
||||||
callbacks.push(callback);
|
callbacks.push(callback);
|
||||||
return this;
|
return this;
|
||||||
}
|
},
|
||||||
|
isWatchman: () => Promise.resolve(false),
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,11 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const nodeCrawl = require('./node');
|
const nodeCrawl = require('./node');
|
||||||
//const watchmanCrawl = require('./watchman');
|
const watchmanCrawl = require('./watchman');
|
||||||
|
|
||||||
function crawl(roots, options) {
|
function crawl(roots, options) {
|
||||||
return nodeCrawl(roots, options);
|
|
||||||
|
|
||||||
// Although, in theory, watchman should be much faster;
|
|
||||||
// there is currently a bottleneck somewhere in the
|
|
||||||
// encoding/decoding that is causing it to be slower
|
|
||||||
// than node crawling. However, this should be fixed soon.
|
|
||||||
// https://github.com/facebook/watchman/issues/113
|
|
||||||
/*
|
|
||||||
const {fileWatcher} = options;
|
const {fileWatcher} = options;
|
||||||
return fileWatcher.isWatchman().then(isWatchman => {
|
return fileWatcher.isWatchman().then(isWatchman => {
|
||||||
|
|
||||||
console.log(isWatchman);
|
|
||||||
if (!isWatchman) {
|
if (!isWatchman) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -30,7 +20,7 @@ function crawl(roots, options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return nodeCrawl(roots, options);
|
return nodeCrawl(roots, options);
|
||||||
});*/
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = crawl;
|
module.exports = crawl;
|
||||||
|
|
|
@ -36,7 +36,7 @@ function watchmanRecReadDir(roots, {ignore, fileWatcher, exts}) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const cmd = Promise.promisify(watcher.client.command.bind(watcher.client));
|
const cmd = Promise.denodeify(watcher.client.command.bind(watcher.client));
|
||||||
return cmd(['query', watchedRoot, {
|
return cmd(['query', watchedRoot, {
|
||||||
'suffix': exts,
|
'suffix': exts,
|
||||||
'expression': ['allof', ['type', 'f'], 'exists', dirExpr],
|
'expression': ['allof', ['type', 'f'], 'exists', dirExpr],
|
||||||
|
|
|
@ -12,9 +12,11 @@ const EventEmitter = require('events').EventEmitter;
|
||||||
const sane = require('sane');
|
const sane = require('sane');
|
||||||
const Promise = require('promise');
|
const Promise = require('promise');
|
||||||
const exec = require('child_process').exec;
|
const exec = require('child_process').exec;
|
||||||
|
const _ = require('underscore');
|
||||||
|
|
||||||
const MAX_WAIT_TIME = 25000;
|
const MAX_WAIT_TIME = 25000;
|
||||||
|
|
||||||
|
// TODO(amasad): can we use watchman version command instead?r
|
||||||
const detectingWatcherClass = new Promise(function(resolve) {
|
const detectingWatcherClass = new Promise(function(resolve) {
|
||||||
exec('which watchman', function(err, out) {
|
exec('which watchman', function(err, out) {
|
||||||
if (err || out.length === 0) {
|
if (err || out.length === 0) {
|
||||||
|
@ -79,9 +81,11 @@ class FileWatcher extends EventEmitter {
|
||||||
|
|
||||||
static createDummyWatcher() {
|
static createDummyWatcher() {
|
||||||
const ev = new EventEmitter();
|
const ev = new EventEmitter();
|
||||||
ev.end = function() {
|
_.extend(ev, {
|
||||||
return Promise.resolve();
|
isWatchman: () => Promise.resolve(false),
|
||||||
};
|
end: () => Promise.resolve(),
|
||||||
|
});
|
||||||
|
|
||||||
return ev;
|
return ev;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue