From c810ac71530f5c5c27443cef24a9f1ee82a28656 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Wed, 1 Apr 2020 09:16:14 +0200 Subject: [PATCH] build: sort module resolution warnings in ts-circular-deps tool (#36361) For better overview of modules that cannot be resolved in the `ts-circular-deps` tool, the warnings are now sorted. Additionally, an empty line between fixed and new circular dependencies is now printed. That should slightly help with distinguishing. PR Close #36361 --- dev-infra/ts-circular-dependencies/index.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dev-infra/ts-circular-dependencies/index.ts b/dev-infra/ts-circular-dependencies/index.ts index 50f8a903b7..002fd707a3 100644 --- a/dev-infra/ts-circular-dependencies/index.ts +++ b/dev-infra/ts-circular-dependencies/index.ts @@ -85,10 +85,12 @@ export function main( // from the View Engine compiler (i.e. factories, summaries) cannot be resolved. if (printWarnings && warningsCount !== 0) { console.info(chalk.yellow('⚠ The following imports could not be resolved:')); - analyzer.unresolvedModules.forEach(specifier => console.info(` • ${specifier}`)); + Array.from(analyzer.unresolvedModules) + .sort() + .forEach(specifier => console.info(` • ${specifier}`)); analyzer.unresolvedFiles.forEach((value, key) => { console.info(` • ${getRelativePath(baseDir, key)}`); - value.forEach(specifier => console.info(` ${specifier}`)); + value.sort().forEach(specifier => console.info(` ${specifier}`)); }); } else { console.info(chalk.yellow(`⚠ ${warningsCount} imports could not be resolved.`)); @@ -108,12 +110,13 @@ export function main( if (newCircularDeps.length !== 0) { console.error(chalk.yellow(` New circular dependencies which are not allowed:`)); newCircularDeps.forEach(c => console.error(` • ${convertReferenceChainToString(c)}`)); + console.error(); } if (fixedCircularDeps.length !== 0) { console.error( chalk.yellow(` Fixed circular dependencies that need to be removed from the golden:`)); fixedCircularDeps.forEach(c => console.error(` • ${convertReferenceChainToString(c)}`)); - console.info(); + console.error(); if (approveCommand) { console.info(chalk.yellow(` Please approve the new golden with: ${approveCommand}`)); } else {