mirror of https://github.com/status-im/metro.git
[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 <ide@jameside.com> Test Plan: `packager/packager.sh --root A --root B` works. Also tested `packager/packager.sh --root A,B`.
This commit is contained in:
parent
a6a8432100
commit
ea9ca4637c
16
packager.js
16
packager.js
|
@ -36,14 +36,18 @@ var webSocketProxy = require('./webSocketProxy.js');
|
||||||
var options = parseCommandLine([{
|
var options = parseCommandLine([{
|
||||||
command: 'port',
|
command: 'port',
|
||||||
default: 8081,
|
default: 8081,
|
||||||
|
type: 'string',
|
||||||
}, {
|
}, {
|
||||||
command: 'root',
|
command: 'root',
|
||||||
|
type: 'string',
|
||||||
description: 'add another root(s) to be used by the packager in this project',
|
description: 'add another root(s) to be used by the packager in this project',
|
||||||
}, {
|
}, {
|
||||||
command: 'assetRoots',
|
command: 'assetRoots',
|
||||||
|
type: 'string',
|
||||||
description: 'specify the root directories of app assets'
|
description: 'specify the root directories of app assets'
|
||||||
}, {
|
}, {
|
||||||
command: 'platform',
|
command: 'platform',
|
||||||
|
type: 'string',
|
||||||
default: 'ios',
|
default: 'ios',
|
||||||
description: 'Specify the platform-specific blacklist (ios, android, web).'
|
description: 'Specify the platform-specific blacklist (ios, android, web).'
|
||||||
}, {
|
}, {
|
||||||
|
@ -65,13 +69,13 @@ if (options.projectRoots) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.root) {
|
if (options.root) {
|
||||||
if (typeof options.root === 'string') {
|
if (!Array.isArray(options.root)) {
|
||||||
options.projectRoots.push(path.resolve(options.root));
|
options.root = options.root.split(',');
|
||||||
} else {
|
|
||||||
options.root.forEach(function(root) {
|
|
||||||
options.projectRoots.push(path.resolve(root));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
options.root.forEach(function(root) {
|
||||||
|
options.projectRoots.push(path.resolve(root));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.assetRoots) {
|
if (options.assetRoots) {
|
||||||
|
|
Loading…
Reference in New Issue