Flipper does not reload plugin when source code is modified in a custom folder (#783)
Summary: Pull Request resolved: https://github.com/facebook/flipper/pull/783 https://github.com/facebook/flipper/issues/756 Reviewed By: mweststrate Differential Revision: D19788859 fbshipit-source-id: 524ea36fc72ae84b68cda7922a74bbbbfe06663f
This commit is contained in:
committed by
Facebook Github Bot
parent
c52ca255bb
commit
c62127e56a
@@ -53,19 +53,30 @@ module.exports = async (
|
|||||||
};
|
};
|
||||||
|
|
||||||
async function startWatchingPluginsUsingWatchman(plugins, onPluginChanged) {
|
async function startWatchingPluginsUsingWatchman(plugins, onPluginChanged) {
|
||||||
const rootDir = path.resolve(__dirname, '..');
|
// Initializing a watchman for each folder containing plugins
|
||||||
const watchman = new Watchman(rootDir);
|
const watchmanRootMap = {};
|
||||||
await watchman.initialize();
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
plugins.map(plugin =>
|
plugins.map(async plugin => {
|
||||||
watchman.startWatchFiles(
|
const watchmanRoot = path.resolve(plugin.rootDir, '..');
|
||||||
path.relative(rootDir, plugin.rootDir),
|
if (!watchmanRootMap[watchmanRoot]) {
|
||||||
|
watchmanRootMap[watchmanRoot] = new Watchman(watchmanRoot);
|
||||||
|
await watchmanRootMap[watchmanRoot].initialize();
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
// Start watching plugins using the initialized watchmans
|
||||||
|
await Promise.all(
|
||||||
|
plugins.map(async plugin => {
|
||||||
|
const watchmanRoot = path.resolve(plugin.rootDir, '..');
|
||||||
|
const watchman = watchmanRootMap[watchmanRoot];
|
||||||
|
await watchman.startWatchFiles(
|
||||||
|
path.relative(watchmanRoot, plugin.rootDir),
|
||||||
() => onPluginChanged(plugin),
|
() => onPluginChanged(plugin),
|
||||||
{
|
{
|
||||||
excludes: ['**/__tests__/**/*', '**/node_modules/**/*', '**/.*'],
|
excludes: ['**/__tests__/**/*', '**/node_modules/**/*', '**/.*'],
|
||||||
},
|
},
|
||||||
),
|
);
|
||||||
),
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user