Keytar platform/arch

Summary:
There appears to be an issue with login on M1 Macs right now. To address this, this resolves the native binary based on a `(platform, arch)` tuple.

The binaries are from here: https://github.com/atom/node-keytar/releases/tag/v7.9.0

The binary size increase here is notable so as a follow-up we could remove the non-relevant binaries as part of the packing process.

Reviewed By: aigoncharov

Differential Revision: D34685236

fbshipit-source-id: d860a59517a769a59055dfca24d01baecd8d1430
This commit is contained in:
Pascal Hartig
2022-03-08 12:19:52 -08:00
committed by Facebook GitHub Bot
parent 2a3491442b
commit 35428ca039
9 changed files with 22 additions and 10 deletions

View File

@@ -37,7 +37,7 @@ import {
import constants from './fb-stubs/constants';
import {initializeElectron} from './electron/initializeElectron';
import path from 'path';
import fs from 'fs';
import fs from 'fs-extra';
enableMapSet();
@@ -64,9 +64,17 @@ async function start() {
let keytar: any = undefined;
try {
if (!isTest()) {
keytar = electronRequire(
path.join(appPath, 'native-modules', `keytar-${process.platform}.node`),
const keytarPath = path.join(
staticPath,
'native-modules',
`keytar-${process.platform}-${process.arch}.node`,
);
if (!(await fs.pathExists(keytarPath))) {
throw new Error(
`Keytar binary does not exist for platform ${process.platform}-${process.arch}`,
);
}
keytar = electronRequire(keytarPath);
}
} catch (e) {
console.error('Failed to load keytar:', e);

View File

@@ -23,7 +23,7 @@ import {
setLoggerInstance,
} from 'flipper-common';
import path from 'path';
import fs from 'fs';
import fs from 'fs-extra';
export async function startFlipperServer(
rootDir: string,
@@ -59,13 +59,17 @@ export async function startFlipperServer(
let keytar: any = undefined;
try {
if (!isTest()) {
keytar = electronRequire(
path.join(
const keytarPath = path.join(
staticPath,
'native-modules',
`keytar-${process.platform}.node`,
),
`keytar-${process.platform}-${process.arch}.node`,
);
if (!(await fs.pathExists(keytarPath))) {
throw new Error(
`Keytar binary does not exist for platform ${process.platform}-${process.arch}`,
);
}
keytar = electronRequire(keytarPath);
}
} catch (e) {
console.error('Failed to load keytar:', e);

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.