TypeScript-DOM-lib-generator/dangerfile.js

30 строки
910 B
JavaScript
Исходник Обычный вид История

const {message} = require("danger")
const {readFileSync, existsSync} = require("fs")
const parseDiff = require("parse-diff")
2020-12-16 18:47:38 +03:00
const diffPath = "./TypeScript/baseline-changes.diff"
if (existsSync(diffPath)) {
const diffContents = readFileSync(diffPath, "utf8")
const diffedFiles = parseDiff(diffContents)
const uninterestingFiles = [".generated.d.ts", "globalThisBlockscopedProperties.types", "mappedTypeRecursiveInference.types"]
const withoutKnownNormalFails = diffedFiles.filter(diff => {
2020-12-16 19:32:36 +03:00
return uninterestingFiles.filter(suffix => diff.to && diff.to.endsWith(suffix)).length > 0
})
const md = ["## Changed baselines from the TypeScript test suite"]
withoutKnownNormalFails.forEach(diff => {
md.push(`#### ${diff.to || diff.from}}`)
md.push("```diff")
diff.chunks.forEach(chunk => {
md.push(chunk.content)
})
md.push("```")
})
message(md.join("\n"))
}