diff --git a/local-cli/dependencies/dependencies.js b/local-cli/dependencies/dependencies.js index c604c345d..aba54ec13 100644 --- a/local-cli/dependencies/dependencies.js +++ b/local-cli/dependencies/dependencies.js @@ -44,29 +44,26 @@ 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 => { - 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; + const deps = packagerInstance + ? await packagerInstance.getOrderedDependencyPaths(options) + : await Metro.getOrderedDependencyPaths(config, options); - if (isInsideProjectRoots) { - outStream.write(modulePath + '\n'); - } - }); - return writeToFile - ? denodeify(outStream.end).bind(outStream)() - : Promise.resolve(); - }), - ); + 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) { + outStream.write(modulePath + '\n'); + } + }); + return writeToFile + ? denodeify(outStream.end).bind(outStream)() + : Promise.resolve(); } module.exports = {