diff --git a/local-cli/server/runServer.js b/local-cli/server/runServer.js index e2a0b10bf..e2d57d4b1 100644 --- a/local-cli/server/runServer.js +++ b/local-cli/server/runServer.js @@ -56,7 +56,7 @@ export type Args = {| +nonPersistent: boolean, +platforms: $ReadOnlyArray, +port: number, - +projectRoots: $ReadOnlyArray, + +projectRoot: string, +resetCache: boolean, +sourceExts: $ReadOnlyArray, +verbose: boolean, @@ -197,7 +197,7 @@ function getPackagerServer(args, config, reporter) { polyfillModuleNames: config.getPolyfillModuleNames(), postMinifyProcess: config.postMinifyProcess, postProcessBundleSourcemap: config.postProcessBundleSourcemap, - projectRoot: config.getProjectRoot(), + projectRoot: args.projectRoot, providesModuleNodeModules: providesModuleNodeModules, reporter, resetCache: args.resetCache, @@ -206,7 +206,7 @@ function getPackagerServer(args, config, reporter) { transformModulePath: transformModulePath, verbose: args.verbose, watch: !args.nonPersistent, - watchFolders: config.getWatchFolders(), + watchFolders: args.watchFolders, workerPath: config.getWorkerPath(), }); } diff --git a/local-cli/server/server.js b/local-cli/server/server.js index d4d977a61..f74f7f16a 100644 --- a/local-cli/server/server.js +++ b/local-cli/server/server.js @@ -10,7 +10,6 @@ 'use strict'; -const path = require('path'); const runServer = require('./runServer'); import type {RNConfig} from '../core'; @@ -20,15 +19,12 @@ import type {Args as RunServerArgs} from './runServer'; /** * Starts the React Native Packager Server. */ -function server(argv: mixed, config: RNConfig, allArgs: Object) { - const {root, ...args} = allArgs; - args.projectRoots = args.projectRoots.concat(root); - +function server(argv: mixed, config: RNConfig, args: Object) { const startedCallback = logReporter => { logReporter.update({ type: 'initialize_started', port: args.port, - projectRoots: args.projectRoots, + projectRoots: args.watchFolders, }); process.on('uncaughtException', error => { @@ -68,19 +64,19 @@ module.exports = { default: '', }, { - command: '--root [list]', - description: - 'add another root(s) to be used by the packager in this project', - parse: (val: string) => val.split(',').map(root => path.resolve(root)), - default: [], + command: '--projectRoot [string]', + description: 'Specify the main project root', + default: (config: ConfigT) => { + return config.getProjectRoot(); + }, }, { command: '--watchFolders [list]', description: - 'Sepcify any additional folders to be added to the watch list', + 'Specify any additional folders to be added to the watch list', parse: (val: string) => val.split(','), default: (config: ConfigT) => { - return config.getProjectRoots ? config.getProjectRoots() : undefined; + return config.getWatchFolders(); }, }, {