Export Flipper trace along with bug report

Summary:
Exports Flipper trace along with bug report. I was not able to upload `.flipper` file, thus I have uploaded `.json` file. One can download the json file from the portal and then can rename it to `.flipper` inorder to open it into flipper app.

I am looking into downloading `.flipper` directly, instead of `.json`. But that change, if it happens, will be done in other diff. I think having flipper trace on the bug report will be helpful to debug the issues.

Reviewed By: danielbuechele

Differential Revision: D14266218

fbshipit-source-id: fb7cf4c9773fb355f3569ce8d08b83bd736ab1ca
This commit is contained in:
Pritesh Nandgaonkar
2019-03-01 08:19:27 -08:00
committed by Facebook Github Bot
parent 9a9c5a229b
commit b0551bb74e

View File

@@ -225,21 +225,31 @@ export async function serializeStore(store: Store): Promise<?ExportType> {
); );
} }
export const exportStoreToFile = ( export function exportStore(store: Store): Promise<string> {
exportFilePath: string,
store: Store,
): Promise<void> => {
return new Promise(async (resolve, reject) => { return new Promise(async (resolve, reject) => {
const json = await serializeStore(store); const json = await serializeStore(store);
if (!json) { if (!json) {
console.error('Make sure a device is connected'); console.error('Make sure a device is connected');
reject('No device is selected'); reject('No device is selected');
} }
fs.writeFile(exportFilePath, serialize(json), err => { const serializedString = serialize(json);
if (err) { if (serializedString.length <= 0) {
reject(err); reject('Serialize function returned empty string');
} }
resolve(); resolve(serializedString);
});
}
export const exportStoreToFile = (
exportFilePath: string,
store: Store,
): Promise<void> => {
return exportStore(store).then(storeString => {
fs.writeFile(exportFilePath, storeString, err => {
if (err) {
throw new Error(err);
}
return;
}); });
}); });
}; };