Remove fs and os usage from Mobile Builds plugin
Summary: Changelog: Expose env info and FS rm command to flipper plugins. Reviewed By: mweststrate Differential Revision: D32988478 fbshipit-source-id: 3d0233f9eb34d3478b07e39b9401c0e30ca95135
This commit is contained in:
committed by
Facebook GitHub Bot
parent
adb2573a1f
commit
c96558a524
@@ -46,6 +46,8 @@ import {
|
||||
import {commandNodeApiExec} from './commands/NodeApiExec';
|
||||
import {commandDownloadFileStartFactory} from './commands/DownloadFile';
|
||||
import {promises} from 'fs';
|
||||
// Electron 11 runs on Node 12 which does not support fs.promises.rm
|
||||
import rm from 'rimraf';
|
||||
|
||||
const {access, copyFile, mkdir, unlink} = promises;
|
||||
|
||||
@@ -230,6 +232,12 @@ export class FlipperServerImpl implements FlipperServer {
|
||||
},
|
||||
'node-api-fs-unlink': unlink,
|
||||
'node-api-fs-mkdir': mkdir,
|
||||
'node-api-fs-rm': async (path, {maxRetries} = {}) =>
|
||||
new Promise<void>((resolve, reject) =>
|
||||
rm(path, {disableGlob: true, maxBusyTries: maxRetries}, (err) =>
|
||||
err ? reject(err) : resolve(),
|
||||
),
|
||||
),
|
||||
'node-api-fs-copyFile': copyFile,
|
||||
// TODO: Do we need API to cancel an active download?
|
||||
'download-file-start': commandDownloadFileStartFactory(
|
||||
|
||||
Reference in New Issue
Block a user