Tucker McKnight <tmcknight@instructure.com> | Sat Aug 15 2026
Remove the buildSteps feature I need to rethink how this should work.
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
[css]: `${reposPath}/css`,
})
eleventyConfig.on(
"eleventy.after",
async ({ directories }) => {
for (let repoName in reposConfiguration.repos) {
const repoConfig = reposConfiguration.repos[repoName]
const slugify = eleventyConfig.getFilter("slugify")
if (typeof repoConfig.buildSteps !== 'undefined') {
// make a temp directory for things to run in
const tempDirName = `temp_${Math.floor(Math.random() * 10000).toString()}`
const tempDir = `${directories.output.replace("./", "")}${reposPath}${tempDirName}`
const tempDirRepoPath = `${tempDir}/${slugify(repoName)}`
await exec(`mkdir ${tempDir}`)
await exec(`git clone -s ${directories.output}${slugify(repoName)}.git ${tempDirRepoPath}`)
const branchesAndTags = await getBranchesAndTags(reposConfiguration, repoName, directories.output, slugify)
const branchNames = branchesAndTags.branches.map(branch => branch.name)
const tagNames = branchesAndTags.tags.map(tag => tag.name)
for (let branch of branchNames) {
// TODO why doesn't git -C checkout work? Says that repo doesn't exist
await exec(`(cd ${tempDirRepoPath} && git checkout ${branch})`)
for (let buildStep of repoConfig.buildSteps) {
// Run the command for each step in each branch
await exec(`(cd ${tempDirRepoPath} && ${buildStep.command})`)
// Copy the specified folders from the "from" to the "to" dir
await exec(`cp -r ${tempDirRepoPath}/${buildStep.copyFrom} ${directories.output}${slugify(repoName)}/branches/${slugify(branch)}/${buildStep.copyTo}`)
}
}
for (let tag of tagNames) {
await exec(`(cd ${tempDirRepoPath} && git checkout ${tag})`)
for (let buildStep of repoConfig.buildSteps) {
// Run the command for each step in each branch
await exec(`(cd ${tempDirRepoPath} && ${buildStep.command})`)
// Copy the specified folders from the "from" to the "to" dir
await exec(`cp -r ${tempDirRepoPath}/${buildStep.copyFrom} ${directories.output}${slugify(repoName)}/tags/${slugify(tag)}/${buildStep.copyTo}`)
}
}
// delete the temp dirs
await exec(`rm -r ${tempDir}`)
}
}
}
)
eleventyConfig.addFilter("getDirectoryContents", (repo: string, refName: string, refType: 'branch' | 'tag', dirPath: string) => {
const refKey = refType === 'branch' ? 'branches' : 'tags'
const fileList = reposData.find(130 131 132 133 134
[css]: `${reposPath}/css`,
})
eleventyConfig.addFilter("getDirectoryContents", (repo: string, refName: string, refType: 'branch' | 'tag', dirPath: string) => {
const refKey = refType === 'branch' ? 'branches' : 'tags'
const fileList = reposData.find(37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
},
"type": "array"
},
"buildSteps": {
"items": {
"additionalProperties": false,
"properties": {
"command": {
"type": "string"
},
"copyFrom": {
"type": "string"
},
"copyTo": {
"type": "string"
}
},
"required": [
"command",
"copyFrom",
"copyTo"
],
"type": "object"
},
"type": "array"
},
"defaultBranch": {
"default": "'main', 'master', or 'develop', determined by looking for one of those branches",
"description": "The default branch for the repository. If this field is not set, Repo Viewer will automatically try `main`, `master`, and `develop`, in that order. Set a `defaultBranch` value if your default branch is not one of those.",37 38 39 40 41
},
"type": "array"
},
"defaultBranch": {
"default": "'main', 'master', or 'develop', determined by looking for one of those branches",
"description": "The default branch for the repository. If this field is not set, Repo Viewer will automatically try `main`, `master`, and `develop`, in that order. Set a `defaultBranch` value if your default branch is not one of those.",91 92 93 94 95
"type": "array"
},
"lineCountForLargeCommit": {
"type": "number"
}
},91 92 93 94 95 96 97
"type": "array"
},
"lineCountForLargeCommit": {
"default": 100,
"description": "The number of lines for a diff to take up the full width of the bar graph on the commits page. Commits smaller than this will take up a proportional fraction of the graph. E.g. if this value is 100, a 50 line change will be half of the width of the bar graph.",
"type": "number"
}
},145 146 147 148 149 150 151 152 153 154
languageExtensions?: {
[fileExtension: string]: string
},
buildSteps?: {
command: string,
copyFrom: string,
copyTo: string,
}[],
defaultTemplate?: {
homepageButtons?: Array<{
url: string,145 146 147 148 149
languageExtensions?: {
[fileExtension: string]: string
},
defaultTemplate?: {
homepageButtons?: Array<{
url: string,28 29 30 31 32 33 34 35 36
there could also be a folder called `wiki-and-tasks` with hyphens, and
they would both be able to exist in the repository.
- [ ] better separation of base features and default template
- make sure that buildSteps can copy things into directories that weren't
created as part of the site generation.
- Maybe allow `copyTo` to have variable interpolation in it, for totally
custom directory paths
- [ ] Create shortcodes that allow 11ty blog posts to reference commits
- Seems like this could work well for embedding code (specifying line ranges?) in
blog posts.28 29 30 31 32
there could also be a folder called `wiki-and-tasks` with hyphens, and
they would both be able to exist in the repository.
- [ ] better separation of base features and default template
- [ ] Create shortcodes that allow 11ty blog posts to reference commits
- Seems like this could work well for embedding code (specifying line ranges?) in
blog posts.