move node types, stub node modules
Summary: This diff stubs all node modules when running in the browser, so that, albeit with a lot of errors and without plugins, the UI loads in a browser. To be continued in the rest of this diff Reviewed By: antonk52 Differential Revision: D32665705 fbshipit-source-id: 4632e241f59c5b9712a41d01a26878afb01f69b5
This commit is contained in:
committed by
Facebook GitHub Bot
parent
d0402d7268
commit
ad4a55f263
@@ -32,8 +32,6 @@ import pmap from 'p-map';
|
||||
import semver from 'semver';
|
||||
import {notNull} from './typeUtils';
|
||||
|
||||
const getTmpDir = promisify(tmp.dir) as () => Promise<string>;
|
||||
|
||||
function providePluginManagerNoDependencies(): PM {
|
||||
return new PM({ignoredDependencies: [/.*/]});
|
||||
}
|
||||
@@ -43,7 +41,7 @@ async function installPluginFromTempDir(
|
||||
): Promise<InstalledPluginDetails> {
|
||||
const pluginDetails = await getInstalledPluginDetails(sourceDir);
|
||||
const {name, version} = pluginDetails;
|
||||
const backupDir = path.join(await getTmpDir(), `${name}-${version}`);
|
||||
const backupDir = path.join(await promisify(tmp.dir)(), `${name}-${version}`);
|
||||
const destinationDir = getPluginVersionInstallationDir(name, version);
|
||||
|
||||
if (pluginDetails.specVersion == 1) {
|
||||
@@ -99,7 +97,7 @@ export async function getInstalledPlugin(
|
||||
}
|
||||
|
||||
export async function installPluginFromNpm(name: string) {
|
||||
const tmpDir = await getTmpDir();
|
||||
const tmpDir = await promisify(tmp.dir)();
|
||||
try {
|
||||
await fs.ensureDir(tmpDir);
|
||||
const plugManNoDep = providePluginManagerNoDependencies();
|
||||
@@ -118,7 +116,7 @@ export async function installPluginFromNpm(name: string) {
|
||||
export async function installPluginFromFile(
|
||||
packagePath: string,
|
||||
): Promise<InstalledPluginDetails> {
|
||||
const tmpDir = await getTmpDir();
|
||||
const tmpDir = await promisify(tmp.dir)();
|
||||
try {
|
||||
const files = await decompress(packagePath, tmpDir, {
|
||||
plugins: [decompressTargz(), decompressUnzip()],
|
||||
|
||||
Reference in New Issue
Block a user