[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:
parent
f9c1a9357a
commit
d2206d492d
|
@ -36,6 +36,9 @@ var options = parseCommandLine([{
|
||||||
}, {
|
}, {
|
||||||
command: 'root',
|
command: 'root',
|
||||||
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',
|
||||||
|
description: 'specify the root directories of app assets'
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
if (options.projectRoots) {
|
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, '..')];
|
options.assetRoots = [path.resolve(__dirname, '..')];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue