Fix async filtering (#3008)
Summary: I relied too much on the types which in this case don't help at all. Filtering on a promise will just automatically get all values to pass. Pull Request resolved: https://github.com/facebook/flipper/pull/3008 Test Plan: `yarn build --mac` works again on the GH checkout. Reviewed By: mweststrate Differential Revision: D31991576 Pulled By: passy fbshipit-source-id: f632d29ddfc09b7130b68b4b17264fd30e1969ce
This commit is contained in:
committed by
Facebook GitHub Bot
parent
366c8f2681
commit
f8117240af
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
|
||||
import fs from 'fs-extra';
|
||||
import pFilter from 'p-filter';
|
||||
import path from 'path';
|
||||
import {getWatchFolders} from 'flipper-pkg-lib';
|
||||
import {appDir, publicPluginsDir, fbPluginsDir} from './paths';
|
||||
@@ -29,7 +30,8 @@ export default async function getAppWatchFolders() {
|
||||
),
|
||||
);
|
||||
const watchFolders = ([] as string[]).concat(...getWatchFoldersResults);
|
||||
return watchFolders
|
||||
.filter((value, index, self) => self.indexOf(value) === index)
|
||||
.filter(async (f) => fs.pathExists(f));
|
||||
return pFilter(
|
||||
watchFolders.filter((value, index, self) => self.indexOf(value) === index),
|
||||
(f) => fs.pathExists(f),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user