Tucker McKnight <tucker.mcknight@gmail.com> | Sun Aug 31 2025
BROKEN HERE, add patches template. Breaks getLocation somehow?
3 4 5 6 7
import repos from './src/repos.ts'
import branches from './src/branches.ts'
import flatFiles from './src/flatFiles.ts'
import {getLocation} from './src/helpers.ts'
import repoOperations from './src/vcses/operations.ts'
3 4 5 6 7 8
import repos from './src/repos.ts'
import branches from './src/branches.ts'
import flatFiles from './src/flatFiles.ts'
import paginatedPatches from './src/paginatedPatches.ts'
import {getLocation} from './src/helpers.ts'
import repoOperations from './src/vcses/operations.ts'
15 16 17 18 19 20 21
const reposData = await repos(reposConfiguration)
const reposPath = reposConfiguration.path || "/repos"
eleventyConfig.addGlobalData("reposPath", reposPath)
eleventyConfig.addFilter("getFileName", (filePath) => {
const pathParts = filePath.split("/")
return pathParts[pathParts.length - 1]15 16 17 18 19 20 21 22 23 24 25 26 27
const reposData = await repos(reposConfiguration)
const reposPath = reposConfiguration.path || "/repos"
eleventyConfig.addGlobalData("repos", reposData)
eleventyConfig.addGlobalData("reposConfig", reposConfiguration)
eleventyConfig.addGlobalData("reposPath", reposPath)
const branchesData = branches(reposData)
eleventyConfig.addGlobalData("branches", branchesData)
eleventyConfig.addFilter("getFileName", (filePath) => {
const pathParts = filePath.split("/")
return pathParts[pathParts.length - 1]170 171 172 173 174
})
eleventyConfig.addAsyncFilter("getReadMe", async (repoName, branchName) => {
const location = getLocation(reposConfiguration, branchName, repoName)
const config = reposConfiguration.repos[repoName]
let command = ''170 171 172 173 174 175 176 177
})
eleventyConfig.addAsyncFilter("getReadMe", async (repoName, branchName) => {
console.log("getreadme")
console.log(branchName)
console.log(repoName)
const location = getLocation(reposConfiguration, branchName, repoName)
const config = reposConfiguration.repos[repoName]
let command = ''204 205 206 207 208 209
// BRANCHES.NJK
const branchesTemplate = fsImport.readFileSync(`${__dirname}/templates/branches.njk`).toString()
const branchesData = branches(reposData)
eleventyConfig.addTemplate(
'repos/branches.njk',
topLayoutPartial + branchesTemplate + bottomLayoutPartial,204 205 206 207 208
// BRANCHES.NJK
const branchesTemplate = fsImport.readFileSync(`${__dirname}/templates/branches.njk`).toString()
eleventyConfig.addTemplate(
'repos/branches.njk',
topLayoutPartial + branchesTemplate + bottomLayoutPartial,294 295 296 297 298
size: 1,
alias: "branch",
},
permalink: (data) => {
const repoName = data.branch.repoName
const branchName = data.branch.branchName294 295 296 297 298 299
size: 1,
alias: "branch",
},
branches: branchesData,
permalink: (data) => {
const repoName = data.branch.repoName
const branchName = data.branch.branchName
-1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
let cachedFlatPatches = null
export default async (repos) => {
if (cachedFlatPatches !== null) { return cachedFlatPatches }
cachedFlatPatches = Object.keys(repos).flatMap((repoName) => {
return Object.keys(repos[repoName].branches).flatMap((branchName) => {
return repos[repoName].branches[branchName].patches.map((patch) => {
return {
patch,
branchName,
repoName,
}
})
})
})
return cachedFlatPatches
}136 137 138 139 140
}
const getLocation = (reposConfig: any, branchName: string, repoName: string): string => {
const config = reposConfig.repos[repoName]
if (config._type === "darcs") {
return config.branches[branchName].location136 137 138 139 140 141
}
const getLocation = (reposConfig: any, branchName: string, repoName: string): string => {
console.log(repoName)
const config = reposConfig.repos[repoName]
if (config._type === "darcs") {
return config.branches[branchName].location