mirror of https://github.com/status-im/metro.git
[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
ffee46819e
commit
ecfc78f47e
|
@ -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, '..')];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue