End metro server gracefully when there are some edge errors
Summary: This diff fixes a couple of edge cases that caused Metro to keep the process running when there were some specific errors (specially around the `dependencies` command and the transformer path). Reviewed By: jrwats Differential Revision: D9551834 fbshipit-source-id: 959cefcec9e2687dff89c94a871ae74c50d2dd77
This commit is contained in:
parent
f9e823fb5a
commit
f661e0fb6e
|
@ -44,19 +44,18 @@ async function dependencies(argv, configPromise, args, packagerInstance) {
|
|||
? fs.createWriteStream(args.output)
|
||||
: process.stdout;
|
||||
|
||||
return Promise.resolve(
|
||||
(packagerInstance
|
||||
? packagerInstance.getOrderedDependencyPaths(options)
|
||||
: Metro.getOrderedDependencyPaths(config, options)
|
||||
).then(deps => {
|
||||
const deps = packagerInstance
|
||||
? await packagerInstance.getOrderedDependencyPaths(options)
|
||||
: await Metro.getOrderedDependencyPaths(config, options);
|
||||
|
||||
deps.forEach(modulePath => {
|
||||
// Temporary hack to disable listing dependencies not under this directory.
|
||||
// Long term, we need either
|
||||
// (a) JS code to not depend on anything outside this directory, or
|
||||
// (b) Come up with a way to declare this dependency in Buck.
|
||||
const isInsideProjectRoots =
|
||||
config.watchFolders.filter(root => modulePath.startsWith(root))
|
||||
.length > 0;
|
||||
config.watchFolders.filter(root => modulePath.startsWith(root)).length >
|
||||
0;
|
||||
|
||||
if (isInsideProjectRoots) {
|
||||
outStream.write(modulePath + '\n');
|
||||
|
@ -65,8 +64,6 @@ async function dependencies(argv, configPromise, args, packagerInstance) {
|
|||
return writeToFile
|
||||
? denodeify(outStream.end).bind(outStream)()
|
||||
: Promise.resolve();
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
|
|
Loading…
Reference in New Issue