Skip to content

Commit 8f68996

Browse files
committed
[react-packager] Add root to packager rootProjects via cli | Boopathi Rajaa
1 parent c88a1cd commit 8f68996

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

packager/packager.js

+13
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,25 @@ var parseCommandLine = require('./parseCommandLine.js');
2626
var options = parseCommandLine([{
2727
command: 'port',
2828
default: 8081,
29+
}, {
30+
command: 'root',
31+
description: 'add another root(s) to be used by the packager in this project',
2932
}]);
3033

3134
if (!options.projectRoots) {
3235
options.projectRoots = [path.resolve(__dirname, '..')];
3336
}
3437

38+
if (options.root) {
39+
if (typeof options.root === 'string') {
40+
options.projectRoots.push(path.resolve(options.root));
41+
} else {
42+
options.root.forEach(function(root) {
43+
options.projectRoots.push(path.resolve(root));
44+
});
45+
}
46+
}
47+
3548
console.log('\n' +
3649
' ===============================================================\n' +
3750
' | Running packager on port ' + options.port + '. \n' +

packager/packager.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
ulimit -n 4096
44

55
THIS_DIR=$(dirname "$0")
6-
node $THIS_DIR/packager.js
6+
node $THIS_DIR/packager.js "$@"

0 commit comments

Comments
 (0)