mirror of
https://github.com/status-im/react-native.git
synced 2025-01-12 18:44:25 +00:00
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,29 +44,26 @@ async function dependencies(argv, configPromise, args, packagerInstance) {
|
|||||||
? fs.createWriteStream(args.output)
|
? fs.createWriteStream(args.output)
|
||||||
: process.stdout;
|
: process.stdout;
|
||||||
|
|
||||||
return Promise.resolve(
|
const deps = packagerInstance
|
||||||
(packagerInstance
|
? await packagerInstance.getOrderedDependencyPaths(options)
|
||||||
? packagerInstance.getOrderedDependencyPaths(options)
|
: await Metro.getOrderedDependencyPaths(config, options);
|
||||||
: Metro.getOrderedDependencyPaths(config, options)
|
|
||||||
).then(deps => {
|
|
||||||
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;
|
|
||||||
|
|
||||||
if (isInsideProjectRoots) {
|
deps.forEach(modulePath => {
|
||||||
outStream.write(modulePath + '\n');
|
// 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
|
||||||
return writeToFile
|
// (b) Come up with a way to declare this dependency in Buck.
|
||||||
? denodeify(outStream.end).bind(outStream)()
|
const isInsideProjectRoots =
|
||||||
: Promise.resolve();
|
config.watchFolders.filter(root => modulePath.startsWith(root)).length >
|
||||||
}),
|
0;
|
||||||
);
|
|
||||||
|
if (isInsideProjectRoots) {
|
||||||
|
outStream.write(modulePath + '\n');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return writeToFile
|
||||||
|
? denodeify(outStream.end).bind(outStream)()
|
||||||
|
: Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user