Tucker McKnight <tmcknight@instructure.com> | Mon Jan 19 2026
[WIP] add ahead/behind commit count for branches. Something is currently broken here.
316 317 318 319 320
// FILE.TS
const flatFilesData = flatFiles(reposData)
eleventyConfig.addTemplate(
'repos/file.11ty.js',
htmlPage(reposConfiguration, eleventyConfig, fileJsTemplate),316 317 318 319 320 321
// FILE.TS
const flatFilesData = flatFiles(reposData)
console.log(flatFilesData.filter(entry => entry.file.includes('njk')))
eleventyConfig.addTemplate(
'repos/file.11ty.js',
htmlPage(reposConfiguration, eleventyConfig, fileJsTemplate),116 117 118 119 120 121 122 123
}
if (branch.description) { result['description'] = branch.description }
if (branch.compareTo) { result['compareTo'] = branch.compareTo }
return result
}))
cachedRepos.push({
name: repoName,
description: reposConfig.repos[repoName].description,116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153
}
if (branch.description) { result['description'] = branch.description }
if (branch.compareTo) { result['compareTo'] = branch.compareTo }
return result
}))
branches.forEach((branch) => {
const branchDescription = branchesToAdd.find(branchToAdd => branchToAdd.name === branch.name)
const compareTo = branchDescription.compareTo || reposConfig.repos[repoName].defaultBranch
const compareToBranch = branches.find((test) => test.name = compareTo)
const compareToBranchCommits = new Set()
let currentCommit = commits.get(compareToBranch.head)
while (currentCommit !== undefined) {
compareToBranchCommits.add(currentCommit.hash)
currentCommit = commits.get(currentCommit.parent)
}
const thisBranchCommits = new Set()
currentCommit = commits.get(branch.head)
while (currentCommit !== undefined) {
thisBranchCommits.add(currentCommit.hash)
currentCommit = commits.get(currentCommit.parent)
}
// At this point, we have all commits in the compareTo branch in one set, and
// all commits from this branch in another set.
const onlyInThisBranch = thisBranchCommits.difference(compareToBranchCommits).size
const onlyInCompareToBranch = compareToBranchCommits.difference(thisBranchCommits).size
branch['ahead'] = onlyInThisBranch
branch['behind'] = onlyInCompareToBranch
branch['compareTo'] = compareTo
})
cachedRepos.push({
name: repoName,
description: reposConfig.repos[repoName].description,8 9 10 11 12
const result = await exec(command)
let files = result.stdout.split("\n").filter(item => item.length > 0 && item != ".")
// TODO: this could be better. This is adding each sub-path of a file to a set, so that
// we don't wind up with repeats, and then converting that back into an array. E.g. if
// we have two files:8 9 10 11 12 13 14 15
const result = await exec(command)
let files = result.stdout.split("\n").filter(item => item.length > 0 && item != ".")
if (branchName === 'main') {
console.log(files)
}
// TODO: this could be better. This is adding each sub-path of a file to a set, so that
// we don't wind up with repeats, and then converting that back into an array. E.g. if
// we have two files:5 6 7 8 9 10
"noImplicitAny": false,
"module": "node18",
"target": "es6",
"lib": ["es2023", "dom"],
"allowJs": true,
"outDir": "dist"
},5 6 7 8 9 10
"noImplicitAny": false,
"module": "node18",
"target": "es6",
"lib": ["esnext", "dom"],
"allowJs": true,
"outDir": "dist"
},