mirror of https://github.com/status-im/metro.git
[react-packager] Add root to packager rootProjects via cli | Boopathi Rajaa
This commit is contained in:
parent
6dafafeea1
commit
adbd8170ca
13
packager.js
13
packager.js
|
@ -26,12 +26,25 @@ var parseCommandLine = require('./parseCommandLine.js');
|
||||||
var options = parseCommandLine([{
|
var options = parseCommandLine([{
|
||||||
command: 'port',
|
command: 'port',
|
||||||
default: 8081,
|
default: 8081,
|
||||||
|
}, {
|
||||||
|
command: 'root',
|
||||||
|
description: 'add another root(s) to be used by the packager in this project',
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
if (!options.projectRoots) {
|
if (!options.projectRoots) {
|
||||||
options.projectRoots = [path.resolve(__dirname, '..')];
|
options.projectRoots = [path.resolve(__dirname, '..')];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
console.log('\n' +
|
console.log('\n' +
|
||||||
' ===============================================================\n' +
|
' ===============================================================\n' +
|
||||||
' | Running packager on port ' + options.port + '. \n' +
|
' | Running packager on port ' + options.port + '. \n' +
|
||||||
|
|
|
@ -3,4 +3,4 @@
|
||||||
ulimit -n 4096
|
ulimit -n 4096
|
||||||
|
|
||||||
THIS_DIR=$(dirname "$0")
|
THIS_DIR=$(dirname "$0")
|
||||||
node $THIS_DIR/packager.js
|
node $THIS_DIR/packager.js "$@"
|
||||||
|
|
Loading…
Reference in New Issue