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
@@ -28,6 +28,7 @@
|
||||
"open": "^8.3.0",
|
||||
"openssl-wrapper": "^0.3.4",
|
||||
"promisify-child-process": "^4.1.1",
|
||||
"rimraf": "^3.0.2",
|
||||
"rsocket-core": "^0.0.27",
|
||||
"rsocket-flowable": "^0.0.27",
|
||||
"rsocket-tcp-server": "^0.0.25",
|
||||
@@ -43,6 +44,7 @@
|
||||
"devDependencies": {
|
||||
"@types/memorystream": "^0.3.0",
|
||||
"@types/node": "^15.12.5",
|
||||
"@types/rimraf": "^3.0.2",
|
||||
"@types/tmp": "^0.2.2",
|
||||
"memorystream": "^0.3.1",
|
||||
"tmp": "^0.2.1"
|
||||
|
||||
@@ -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