Tucker McKnight <tucker.mcknight@gmail.com> | Sun Aug 24 2025
wip: moving from separate site repo to plugin
-1
dist
node_modules
-1 0 1 2 3 4 5
#!/bin/bash
rm -R dist
mkdir dist
mkdir dist/templates
mkdir dist/partial_templates
cp templates/*.njk dist/templates
cp partial_templates/*.njk dist/partial_templates
-1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
{
"name": "eleventy-plugin",
"version": "1.0.0",
"main": "dist/main.js",
"scripts": {
"build": "./make.sh && npx tsc"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": "",
"devDependencies": {
"@types/node": "^24.0.7",
"typescript": "^5.8.3"
},
"dependencies": {
"@11ty/eleventy": "^3.1.2",
"diff": "^8.0.2",
"lodash": "^4.17.21"
}
}
-1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
</div>
</div>
</div>
<script>
const toggleUnifiedMode = (e) => {
const diffs = document.getElementById('diffs')
const afterDiffs = document.querySelectorAll('.diff-right')
if (e.checked) {
diffs.classList.add("unified")
afterDiffs.forEach((elem) => {
elem.classList.remove('border-start', 'ps-2')
})
}
else {
diffs.classList.remove("unified")
afterDiffs.forEach((elem) => {
elem.classList.add('border-start', 'ps-2')
})
}
}
const selectBranch = (e) => {
const values = e.value.split(",")
window.location = `/repos/${values[0]}/branches/${values[1]}/${values[2]}`
}
</script>
<script src="/static/main.js"></script>
</body>
</html>
-1 0 1 2 3 4 5 6 7 8 9 10 11 12 13
let cachedBranches = null
export default (repos) => {
if (cachedBranches !== null) { return cachedBranches }
cachedBranches = Object.keys(repos).flatMap((repoName) => {
return Object.keys(repos[repoName].branches).map((branchName) => {
return {
branchName,
repoName,
}
})
})
return cachedBranches
}
-1 0 1
export type BranchInfo = {
files: Array<string>,
patches: Array<any>
}
-1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
import repos from './repos.ts'
let cachedFlatFiles = null
export default (repos) => {
if (cachedFlatFiles !== null) { return cachedFlatFiles }
cachedFlatFiles = Object.keys(repos).flatMap((repoName) => {
return Object.keys(repos[repoName].branches).flatMap((branchName) => {
return repos[repoName].branches[branchName].files.map((file) => {
return {
file,
branchName,
repoName,
}
})
})
})
return cachedFlatFiles
}
-1 0 1 2
export default {
cloneUrl: (baseUrl: string, repoName: string) => {
return `${baseUrl}/repos/${repoName.toLowerCase().replaceAll(" ", "-")}/branches/`
}
}
-1 0 1 2
export default {
cloneUrl: (baseUrl: string, repoName: string) => {
return `${baseUrl}/repos/${repoName.toLowerCase().replaceAll(" ", "-")}.git`
}
}
-1 0 1 2 3 4 5
import gitHelpers from './git/helpers.ts'
import darcsHelpers from './darcs/helpers.ts'
export default {
git: gitHelpers,
darcs: darcsHelpers
}
-1 0 1 2 3 4 5
<ul>
{% for branch in branches %}
{% set description = reposConfig.repos[branch.repoName].branches[branch.branchName].description %}
{% if branch.repoName == branchInfo.repoName %}
<li><a href="/repos/{{branch.repoName | slugify}}/branches/{{branch.branchName | slugify}}">{{branch.branchName}}</a>{% if branch.branchName == branchInfo.branchName %} (current){% endif %}{% if description %} - {{ description }}{% endif %}</li>
{% endif %}
{% endfor %}
</ul>
-1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
<div class="row">
<div class="col">
<ul class="list-group">
{% set files = repos[branchInfo.repoName].branches[branchInfo.branchName].files | topLevelFilesOnly('') %}
{% for file in files %}
<li class="list-group-item">
{% if file.isDirectory %}
<i class="bi bi-folder-fill"></i>
{% else %}
<i class="bi bi-file-earmark"></i>
{% endif %}
<a href="/repos/{{branchInfo.repoName | slugify}}/branches/{{branchInfo.branchName | slugify}}/files/{{file.fullPath | slugify}}.html">{{file.name}}</a>
</li>
{% endfor %}
</ul>
</div>
</div>
-1 0 1 2
<ul>
{% for repoName, options in repos %}
<li><a href="/repos/{{repoName | slugify}}/branches/{{reposConfig.repos[repoName].defaultBranch}}">{{repoName}}</a></li>
{% endfor %}
</ul>
-1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"rewriteRelativeImportExtensions": true,
"noImplicitAny": false,
"module": "nodenext",
"target": "es2017",
"lib": ["es2023", "dom"],
"allowJs": true,
"outDir": "dist"
},
"include": ["**/*.ts"],
"exclude": [
"dist/**/*",
"ts/frontend/**/*",
],
}