Skip to content

Commit

Permalink
[Packager] Fix the --root, --assetRoots, --port, and --platform options
Browse files Browse the repository at this point in the history
Looks like these options were handled as booleans when they should be handled as strings. Explicitly specify them as strings.

Test Plan: `packager/packager.sh --root A --root B` works. Also tested `packager/packager.sh --root A,B`.

Tested the port option too: `packager/packager.sh --port 12345' and got a response visiting http://localhost:12345/index.includeRequire.runModule.bundle?dev=true.
  • Loading branch information
ide committed May 25, 2015
1 parent 4673dca commit d17bdac
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions packager/packager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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).'
}, {
Expand All @@ -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) {
Expand Down

0 comments on commit d17bdac

Please sign in to comment.