From ea9ca4637c20d91e7b68e77e4b54e2519584b4d1 Mon Sep 17 00:00:00 2001 From: James Ide Date: Tue, 26 May 2015 14:16:47 -0700 Subject: [PATCH] [Packager] Fix the --root, --assetRoots, and --platform options Summary: Looks like these options were handled as booleans when they should be handled as strings. Explicitly specify them as strings. Closes https://github.com/facebook/react-native/pull/1377 Github Author: James Ide Test Plan: `packager/packager.sh --root A --root B` works. Also tested `packager/packager.sh --root A,B`. --- packager.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/packager.js b/packager.js index eb90b04e..d630d06e 100644 --- a/packager.js +++ b/packager.js @@ -36,14 +36,18 @@ var webSocketProxy = require('./webSocketProxy.js'); var options = parseCommandLine([{ command: 'port', default: 8081, + type: 'string', }, { command: 'root', + type: 'string', description: 'add another root(s) to be used by the packager in this project', }, { command: 'assetRoots', + type: 'string', description: 'specify the root directories of app assets' }, { command: 'platform', + type: 'string', default: 'ios', description: 'Specify the platform-specific blacklist (ios, android, web).' }, { @@ -65,13 +69,13 @@ if (options.projectRoots) { } if (options.root) { - if (typeof options.root === 'string') { - options.projectRoots.push(path.resolve(options.root)); - } else { - options.root.forEach(function(root) { - options.projectRoots.push(path.resolve(root)); - }); + if (!Array.isArray(options.root)) { + options.root = options.root.split(','); } + + options.root.forEach(function(root) { + options.projectRoots.push(path.resolve(root)); + }); } if (options.assetRoots) {