From 17774982ca09d6b01f407e0758ff9598746027ec Mon Sep 17 00:00:00 2001 From: Joel Arvidsson Date: Fri, 22 Mar 2019 18:22:12 +0100 Subject: [PATCH] fix: pass `--projectRoot` argument to Metro (#259) --- packages/cli/src/commands/server/runServer.js | 1 + packages/cli/src/tools/loadMetroConfig.js | 19 ++++--------------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/packages/cli/src/commands/server/runServer.js b/packages/cli/src/commands/server/runServer.js index 08ae78990..8b20376c1 100644 --- a/packages/cli/src/commands/server/runServer.js +++ b/packages/cli/src/commands/server/runServer.js @@ -51,6 +51,7 @@ async function runServer(argv: Array, ctx: ContextT, args: Args) { port: args.port, resetCache: args.resetCache, watchFolders: args.watchFolders, + projectRoot: ctx.root, sourceExts: args.sourceExts, reporter, }); diff --git a/packages/cli/src/tools/loadMetroConfig.js b/packages/cli/src/tools/loadMetroConfig.js index 3d15e59d3..286b5bce1 100644 --- a/packages/cli/src/tools/loadMetroConfig.js +++ b/packages/cli/src/tools/loadMetroConfig.js @@ -73,6 +73,7 @@ export const getDefaultConfig = (ctx: ContextT) => { export type ConfigOptionsT = {| maxWorkers?: number, port?: number, + projectRoot?: string, resetCache?: boolean, watchFolders?: string[], sourceExts?: string[], @@ -85,20 +86,8 @@ export type ConfigOptionsT = {| * * This allows the CLI to always overwrite the file settings. */ -export default (async function load( - ctx: ContextT, - // $FlowFixMe - troubles with empty object being inexact - options?: ConfigOptionsT = {}, -) { +export default function load(ctx: ContextT, options?: ConfigOptionsT) { const defaultConfig = getDefaultConfig(ctx); - const config = await loadConfig( - { - cwd: ctx.root, - ...options, - }, - defaultConfig, - ); - - return config; -}); + return loadConfig({cwd: ctx.root, ...options}, defaultConfig); +}