Attach instead of start dev server and documentation updates
Summary: ^ Instead of 'start' use 'attach' as it seems closer to what the function actually does. Reviewed By: passy Differential Revision: D36310846 fbshipit-source-id: db90efc6ec3207b1a5a38139a3ba01d2f7d2aebd
This commit is contained in:
committed by
Facebook GitHub Bot
parent
453ec4bd83
commit
582966d139
@@ -48,7 +48,15 @@ export async function getPluginSourceFolders(): Promise<string[]> {
|
|||||||
return pFilter(pluginFolders, (p) => fs.pathExists(p));
|
return pFilter(pluginFolders, (p) => fs.pathExists(p));
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function startDevServer(
|
/**
|
||||||
|
* Attaches the necessary routing and middleware to observe
|
||||||
|
* for local changes and apply them to the running instance.
|
||||||
|
* @param app Express app.
|
||||||
|
* @param server HTTP server.
|
||||||
|
* @param socket Web Socket server.
|
||||||
|
* @param rootDir Root directory.
|
||||||
|
*/
|
||||||
|
export async function attachDevServer(
|
||||||
app: Express,
|
app: Express,
|
||||||
server: http.Server,
|
server: http.Server,
|
||||||
socket: WebSocketServer,
|
socket: WebSocketServer,
|
||||||
@@ -13,7 +13,7 @@ import path from 'path';
|
|||||||
import {startFlipperServer} from './startFlipperServer';
|
import {startFlipperServer} from './startFlipperServer';
|
||||||
import {startServer} from './startServer';
|
import {startServer} from './startServer';
|
||||||
import {startSocketServer} from './startSocketServer';
|
import {startSocketServer} from './startSocketServer';
|
||||||
import {startDevServer} from './startDevServer';
|
import {attachDevServer} from './attachDevServer';
|
||||||
|
|
||||||
import yargs from 'yargs';
|
import yargs from 'yargs';
|
||||||
import open from 'open';
|
import open from 'open';
|
||||||
@@ -100,7 +100,7 @@ async function start() {
|
|||||||
await flipperServer.connect();
|
await flipperServer.connect();
|
||||||
|
|
||||||
if (argv.bundler) {
|
if (argv.bundler) {
|
||||||
await startDevServer(app, server, socket, rootDir);
|
await attachDevServer(app, server, socket, rootDir);
|
||||||
}
|
}
|
||||||
startSocketServer(flipperServer, socket, companionEnv);
|
startSocketServer(flipperServer, socket, companionEnv);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,15 @@ import {
|
|||||||
import path from 'path';
|
import path from 'path';
|
||||||
import fs from 'fs-extra';
|
import fs from 'fs-extra';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates an instance of FlipperServer (FlipperServerImpl). This is the
|
||||||
|
* server used by clients to connect to.
|
||||||
|
* @param rootDir Application path.
|
||||||
|
* @param staticPath Static assets path.
|
||||||
|
* @param settingsString Optional settings used to override defaults.
|
||||||
|
* @param enableLauncherSettings Optional launcher settings used to override defaults.
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
export async function startFlipperServer(
|
export async function startFlipperServer(
|
||||||
rootDir: string,
|
rootDir: string,
|
||||||
staticPath: string,
|
staticPath: string,
|
||||||
@@ -81,7 +90,7 @@ export async function startFlipperServer(
|
|||||||
{
|
{
|
||||||
environmentInfo,
|
environmentInfo,
|
||||||
env: parseEnvironmentVariables(process.env),
|
env: parseEnvironmentVariables(process.env),
|
||||||
// TODO: make userame parameterizable
|
// TODO: make username parameterizable
|
||||||
gatekeepers: getGatekeepers(environmentInfo.os.unixname),
|
gatekeepers: getGatekeepers(environmentInfo.os.unixname),
|
||||||
paths: {
|
paths: {
|
||||||
appPath,
|
appPath,
|
||||||
|
|||||||
Reference in New Issue
Block a user