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:
Andrey Goncharov
2021-12-10 06:34:37 -08:00
committed by Facebook GitHub Bot
parent adb2573a1f
commit c96558a524
15 changed files with 166 additions and 6 deletions

View File

@@ -14,8 +14,10 @@ import {
import {
BufferEncoding,
ExecOptions,
fsConstants,
Logger,
MkdirOptions,
RmOptions,
} from 'flipper-common';
import type {Store} from '../../reducers';
import createPaste from '../../fb-stubs/createPaste';
@@ -71,6 +73,10 @@ export function initializeFlipperLibImplementation(
paths: {
appPath: renderHost.serverConfig.paths.appPath,
homePath: renderHost.serverConfig.paths.homePath,
tempPath: renderHost.serverConfig.paths.tempPath,
},
environmentInfo: {
os: renderHost.serverConfig.environmentInfo.os,
},
remoteServerContext: {
childProcess: {
@@ -95,6 +101,8 @@ export function initializeFlipperLibImplementation(
path,
options,
)) as RemoteServerContext['fs']['mkdir'],
rm: async (path: string, options?: RmOptions) =>
renderHost.flipperServer.exec('node-api-fs-rm', path, options),
copyFile: async (src: string, dest: string, flags?: number) =>
renderHost.flipperServer.exec(
'node-api-fs-copyFile',
@@ -102,6 +110,7 @@ export function initializeFlipperLibImplementation(
dest,
flags,
),
constants: fsConstants,
},
downloadFile: downloadFileFactory(renderHost),
},