Log suggestions (#748)

* print suggestions

* Add package-lock

* Clean suggestions directory before running

* Print single json for suggestions

* Print single suggestions json
This commit is contained in:
Gabriela Araujo Britto
2020-02-27 16:29:42 -08:00
committed by Andrew Branch
parent b8c010f0ce
commit a6ea7167bf
2 changed files with 1470 additions and 1214 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
import assert = require("assert");
import { existsSync, readFileSync } from "fs";
import { pathExists } from "fs-extra";
import { pathExists, remove } from "fs-extra";
import os = require("os");
import * as fold from "travis-fold";
import * as yargs from "yargs";
@@ -30,6 +30,7 @@ import {
import { allDependencies, getAffectedPackages } from "./get-affected-packages";
const perfDir = joinPaths(os.homedir(), ".dts", "perf");
const suggestionsDir = joinPaths(os.homedir(), ".dts", "suggestions");
if (!module.parent) {
if (yargs.argv.affected) {
@@ -189,6 +190,7 @@ async function doRunTests(
typesPath: string,
nProcesses: number,
): Promise<void> {
await remove(suggestionsDir);
const allFailures: Array<[string, string]> = [];
if (fold.isTravis()) { console.log(fold.start("tests")); }
await runWithListeningChildProcesses({
@@ -233,6 +235,18 @@ async function doRunTests(
});
if (fold.isTravis()) { console.log(fold.end("tests")); }
console.log("\n\n=== SUGGESTIONS ===\n");
const suggestionLines: string[] = [];
for (const change of changed) {
const pkgPath = change.versionDirectoryName ? change.name + change.versionDirectoryName : change.name;
const path = joinPaths(suggestionsDir, pkgPath + ".txt");
if (existsSync(path)) {
const suggestions = readFileSync(path, "utf8").split("\n");
suggestionLines.push(`"${change.subDirectoryPath}": [${suggestions.join(",")}]`);
}
}
console.log(`{${suggestionLines.join(",")}}`);
console.log("\n\n=== PERFORMANCE ===\n");
console.log("{");
for (const change of changed) {