Use yargs for non-headless Flipper args parsing

Summary:
This seems like a better approach than ad-hoc lookup in
`electron.remove.argv`. Left a note to a task to provide
a better interface to this.

I also need this in order to ensure we're starting
Flipper through the launcher which needs to happen
before we start the Electron runtime.

Reviewed By: jknoxville

Differential Revision: D13881355

fbshipit-source-id: 69c70d71035a47084f789ddb4dc969b45ba4648b
This commit is contained in:
Pascal Hartig
2019-02-05 04:46:33 -08:00
committed by Facebook Github Bot
parent 3b75fb092b
commit 74a726aaf9
4 changed files with 30 additions and 7 deletions

View File

@@ -9,7 +9,7 @@ const path = require('path');
const os = require('os');
const fs = require('fs');
module.exports = function() {
module.exports = function(argv) {
if (!process.env.ANDROID_HOME) {
process.env.ANDROID_HOME = '/opt/android_sdk';
}
@@ -27,7 +27,11 @@ module.exports = function() {
}
const configPath = path.join(flipperDir, 'config.json');
let config = {pluginPaths: [], disabledPlugins: [], lastWindowPosition: {}};
let config = {
pluginPaths: [],
disabledPlugins: [],
lastWindowPosition: {},
};
try {
config = {
@@ -39,5 +43,11 @@ module.exports = function() {
fs.writeFileSync(configPath, JSON.stringify(config));
}
// Non-persistent CLI arguments.
config = {
...config,
updaterEnabled: argv.updater,
};
return {config, configPath, flipperDir};
};