Skip to content

Commit 67eb439

Browse files
committed
Revert "Replace projectRoots with projectRoot + watchRoots"
This reverts commit c5ce762.
1 parent 7ad7452 commit 67eb439

File tree

6 files changed

+16
-23
lines changed

6 files changed

+16
-23
lines changed

local-cli/bundle/buildBundle.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ async function buildBundle(
7575
: defaultProvidesModuleNodeModules;
7676

7777
const terminal = new Terminal(process.stdout);
78+
7879
const server = new Server({
7980
asyncRequireModulePath: config.getAsyncRequireModulePath(),
8081
assetExts: defaultAssetExts.concat(assetExts),
@@ -95,15 +96,14 @@ async function buildBundle(
9596
platforms: defaultPlatforms.concat(platforms),
9697
postMinifyProcess: config.postMinifyProcess,
9798
postProcessBundleSourcemap: config.postProcessBundleSourcemap,
98-
projectRoot: config.getProjectRoot(),
99+
projectRoots: config.getProjectRoots(),
99100
providesModuleNodeModules: providesModuleNodeModules,
100101
reporter: new TerminalReporter(terminal),
101102
resetCache: args.resetCache,
102103
resolveRequest: config.resolveRequest,
103104
sourceExts: sourceExts.concat(defaultSourceExts),
104105
transformModulePath: transformModulePath,
105106
watch: false,
106-
watchFolders: config.getWatchFolders(),
107107
workerPath: config.getWorkerPath && config.getWorkerPath(),
108108
});
109109

local-cli/dependencies/dependencies.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function dependencies(argv, config, args, packagerInstance) {
3434
const packageOpts = {
3535
assetRegistryPath: ASSET_REGISTRY_PATH,
3636
cacheStores: [],
37-
projectRoot: config.getProjectRoot(),
37+
projectRoots: config.getProjectRoots(),
3838
blacklistRE: config.getBlacklistRE(),
3939
dynamicDepsInPackages: config.dynamicDepsInPackages,
4040
getPolyfills: config.getPolyfills,
@@ -44,14 +44,12 @@ function dependencies(argv, config, args, packagerInstance) {
4444
transformModulePath: transformModulePath,
4545
extraNodeModules: config.extraNodeModules,
4646
verbose: config.verbose,
47-
watchFolders: config.getWatchFolders(),
4847
workerPath: config.getWorkerPath(),
4948
};
5049

51-
const relativePath = path.relative(
52-
packageOpts.projectRoot,
53-
rootModuleAbsolutePath,
54-
);
50+
const relativePath = packageOpts.projectRoots.map(root =>
51+
path.relative(root, rootModuleAbsolutePath),
52+
)[0];
5553

5654
const options = {
5755
platform: args.platform,
@@ -77,7 +75,7 @@ function dependencies(argv, config, args, packagerInstance) {
7775
// (a) JS code to not depend on anything outside this directory, or
7876
// (b) Come up with a way to declare this dependency in Buck.
7977
const isInsideProjectRoots =
80-
packageOpts.watchFolders.filter(root => modulePath.startsWith(root))
78+
packageOpts.projectRoots.filter(root => modulePath.startsWith(root))
8179
.length > 0;
8280

8381
if (isInsideProjectRoots) {

local-cli/server/middleware/getDevToolsMiddleware.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ function escapePath(pathname) {
2323
return '"' + pathname + '"';
2424
}
2525

26-
function launchDevTools({host, watchFolders}, isChromeConnected) {
26+
function launchDevTools({host, projectRoots}, isChromeConnected) {
2727
// Explicit config always wins
2828
var customDebugger = process.env.REACT_DEBUGGER;
2929
if (customDebugger) {
30-
var projects = watchFolders.map(escapePath).join(' ');
30+
var projects = projectRoots.map(escapePath).join(' ');
3131
var command = customDebugger + ' ' + projects;
3232
console.log('Starting custom debugger by executing: ' + command);
3333
exec(command, function(error, stdout, stderr) {

local-cli/server/middleware/openStackFrameInEditorMiddleware.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111

1212
const launchEditor = require('../util/launchEditor');
1313

14-
module.exports = function({watchFolders}) {
14+
module.exports = function({projectRoots}) {
1515
return function(req, res, next) {
1616
if (req.url === '/open-stack-frame') {
1717
const frame = JSON.parse(req.rawBody);
18-
launchEditor(frame.file, frame.lineNumber, watchFolders);
18+
launchEditor(frame.file, frame.lineNumber, projectRoots);
1919
res.end('OK');
2020
} else {
2121
next();

local-cli/server/runServer.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ export type Args = {|
6060
+resetCache: boolean,
6161
+sourceExts: $ReadOnlyArray<string>,
6262
+verbose: boolean,
63-
+watchFolders: $ReadOnlyArray<string>,
6463
|};
6564

6665
function runServer(
@@ -101,7 +100,7 @@ function runServer(
101100
.use(indexPageMiddleware)
102101
.use(packagerServer.processRequest.bind(packagerServer));
103102

104-
args.watchFolders.forEach(root => app.use(serveStatic(root)));
103+
args.projectRoots.forEach(root => app.use(serveStatic(root)));
105104

106105
app.use(morgan('combined')).use(errorhandler());
107106

@@ -197,7 +196,7 @@ function getPackagerServer(args, config, reporter) {
197196
polyfillModuleNames: config.getPolyfillModuleNames(),
198197
postMinifyProcess: config.postMinifyProcess,
199198
postProcessBundleSourcemap: config.postProcessBundleSourcemap,
200-
projectRoot: config.getProjectRoot(),
199+
projectRoots: args.projectRoots,
201200
providesModuleNodeModules: providesModuleNodeModules,
202201
reporter,
203202
resetCache: args.resetCache,
@@ -206,7 +205,6 @@ function getPackagerServer(args, config, reporter) {
206205
transformModulePath: transformModulePath,
207206
verbose: args.verbose,
208207
watch: !args.nonPersistent,
209-
watchFolders: config.getWatchFolders(),
210208
workerPath: config.getWorkerPath(),
211209
});
212210
}

local-cli/server/server.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,10 @@ module.exports = {
7575
default: [],
7676
},
7777
{
78-
command: '--watchFolders [list]',
79-
description:
80-
'Sepcify any additional folders to be added to the watch list',
78+
command: '--projectRoots [list]',
79+
description: 'override the root(s) to be used by the packager',
8180
parse: (val: string) => val.split(','),
82-
default: (config: ConfigT) => {
83-
return config.getProjectRoots ? config.getProjectRoots() : undefined;
84-
},
81+
default: (config: ConfigT) => config.getProjectRoots(),
8582
},
8683
{
8784
command: '--assetExts [list]',

0 commit comments

Comments
 (0)