Install plugins to pending directory first to enable installing new versions of existing plugins

Summary:
Install plugins to pending directory first to enable installing new versions of existing plugins. On startup Flipper moves all the plugins from pending directory into installed plugins directory.

Auto-update, after downloading a plugin package, will also extract it to "pending", so after restart update will automatically be applied.

Reviewed By: mweststrate

Differential Revision: D21929713

fbshipit-source-id: 141b106415e941156ae598cf810ab3bed8c76ced
This commit is contained in:
Anton Nikolaev
2020-06-09 04:52:39 -07:00
committed by Facebook GitHub Bot
parent eff378defa
commit eeded4e32f
6 changed files with 206 additions and 48 deletions

View File

@@ -28,6 +28,7 @@ import setup from './setup';
import isFB from './fb-stubs/isFB';
import delegateToLauncher from './launcher';
import yargs from 'yargs';
import {finishPendingPluginInstallations} from 'flipper-plugin-lib';
const VERSION: string = (global as any).__VERSION__;
@@ -110,17 +111,21 @@ setInterval(() => {
}
}, 60 * 1000);
compilePlugins(() => {
if (win) {
win.reload();
}
}, path.join(flipperDir, 'plugins')).then((dynamicPlugins) => {
ipcMain.on('get-dynamic-plugins', (event) => {
event.returnValue = dynamicPlugins;
finishPendingPluginInstallations()
.then(() =>
compilePlugins(() => {
if (win) {
win.reload();
}
}, path.join(flipperDir, 'plugins')),
)
.then((dynamicPlugins) => {
ipcMain.on('get-dynamic-plugins', (event) => {
event.returnValue = dynamicPlugins;
});
pluginsCompiled = true;
tryCreateWindow();
});
pluginsCompiled = true;
tryCreateWindow();
});
// check if we already have an instance of this app open
const gotTheLock = app.requestSingleInstanceLock();