Fix the issue with plugin installation from npm

Summary: https://github.com/facebook/flipper/issues/1818

Reviewed By: jknoxville

Differential Revision: D25870562

fbshipit-source-id: 0d62626355b35505089990cfdb592b0ea4b84fda
This commit is contained in:
Anton Nikolaev
2021-01-11 10:49:13 -08:00
committed by Facebook GitHub Bot
parent 731e39445f
commit a6599963ec
2 changed files with 9 additions and 0 deletions

View File

@@ -147,6 +147,12 @@ describe('pluginInstaller', () => {
]);
});
test('getInstalledPlugins when no plugins installed', async () => {
await fs.remove(pluginInstallationDir);
const plugins = await getInstalledPlugins();
expect(plugins).toHaveLength(0);
});
test('moveInstalledPluginsFromLegacyDir', async () => {
await moveInstalledPluginsFromLegacyDir();
expect(

View File

@@ -215,6 +215,9 @@ type InstalledPluginVersionDirs = [string, string[]][];
async function getInstalledPluginVersionDirs(): Promise<
InstalledPluginVersionDirs
> {
if (!(await fs.pathExists(pluginInstallationDir))) {
return [];
}
return await fs
.readdir(pluginInstallationDir)
.then((dirs) => dirs.map((dir) => path.join(pluginInstallationDir, dir)))