[Assets] Allow scripts to override assetRoots

Summary:
The CLI parse was accepting a string but assetRoots should be an array, so split on commas. Tested by specifying a root directory that was at least two folders up (../../stuff).
Closes https://github.com/facebook/react-native/pull/189
Github Author: James Ide <ide@jameside.com>

Test Plan:
* export to open source
* started server passing --assetRoots array
This commit is contained in:
James Ide 2015-03-26 02:11:53 -07:00
parent f9c1a9357a
commit d2206d492d
1 changed files with 8 additions and 1 deletions

View File

@ -36,6 +36,9 @@ var options = parseCommandLine([{
}, {
command: 'root',
description: 'add another root(s) to be used by the packager in this project',
}, {
command: 'assetRoots',
description: 'specify the root directories of app assets'
}]);
if (options.projectRoots) {
@ -61,7 +64,11 @@ if (options.root) {
}
}
if (!options.assetRoots) {
if (options.assetRoots) {
if (!Array.isArray(options.assetRoots)) {
options.assetRoots = options.assetRoots.split(',');
}
} else {
options.assetRoots = [path.resolve(__dirname, '..')];
}