Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 143 additions & 1 deletion eng/generate-website-data.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ function formatDisplayName(value) {
.join(" ");
}

function normalizeText(value, fallback = "") {
return typeof value === "string" ? value.trim() : fallback;
}

/**
* Find the latest git-modified date for any file under a directory.
*/
Expand Down Expand Up @@ -670,6 +674,76 @@ function generatePluginsData(gitDates) {
/**
* Generate canvas extensions metadata
*/
function getExtensionAssetInfo(extensionDir, relPath, ref) {
const assetDir = path.join(extensionDir, "assets");

if (!fs.existsSync(assetDir)) {
return null;
}

const imageExtensions = new Set([
".png",
".jpg",
".jpeg",
".webp",
".gif",
]);

const preferredNames = [
"preview.png",
"preview.jpg",
"preview.jpeg",
"preview.webp",
"preview.gif",
"screenshot.png",
"screenshot.jpg",
"screenshot.jpeg",
"screenshot.webp",
"screenshot.gif",
"image.png",
"image.jpg",
"image.jpeg",
"image.webp",
"image.gif",
];

for (const candidate of preferredNames) {
const candidatePath = path.join(assetDir, candidate);
if (fs.existsSync(candidatePath)) {
const assetPath = `${relPath}/assets/${candidate}`;
return {
assetPath,
imageUrl: buildRepoImageUrl(assetPath, ref),
};
Comment thread
jamesmontemagno marked this conversation as resolved.
}
}

const files = fs
.readdirSync(assetDir)
.filter((file) => imageExtensions.has(path.extname(file).toLowerCase()))
.sort((a, b) => a.localeCompare(b));

if (files.length === 0) {
return null;
}

const assetFile = files[0];
const assetPath = `${relPath}/assets/${assetFile}`;

return {
assetPath,
imageUrl: buildRepoImageUrl(assetPath, ref),
};
}

function buildRepoImageUrl(assetPath, ref) {
const encodedAssetPath = assetPath
.split("/")
.map((segment) => encodeURIComponent(segment))
.join("/");
return `https://raw.githubusercontent.com/github/awesome-copilot/${ref}/${encodedAssetPath}`;
}

function generateExtensionsData(gitDates, commitSha) {
const extensions = [];

Expand All @@ -679,19 +753,87 @@ function generateExtensionsData(gitDates, commitSha) {

const extensionDirs = fs
.readdirSync(EXTENSIONS_DIR, { withFileTypes: true })
.filter((entry) => entry.isDirectory());
.filter((entry) => {
if (!entry.isDirectory()) return false;
const extensionEntryPoint = path.join(
EXTENSIONS_DIR,
entry.name,
"extension.mjs"
);
return fs.existsSync(extensionEntryPoint);
});

for (const dir of extensionDirs) {
const relPath = `extensions/${dir.name}`;
const assetInfo = getExtensionAssetInfo(
path.join(EXTENSIONS_DIR, dir.name),
relPath,
commitSha
);

extensions.push({
id: dir.name,
name: formatDisplayName(dir.name),
description: "Canvas extension",
path: relPath,
ref: commitSha,
lastUpdated: getDirectoryLastUpdated(gitDates, relPath),
imageUrl: assetInfo?.imageUrl || null,
assetPath: assetInfo?.assetPath || null,
installUrl: `https://github.com/github/awesome-copilot/tree/${commitSha}/${relPath.replace(
/\\/g,
"/"
)}`,
sourceUrl: null,
external: false,
});
}

const externalJsonPath = path.join(EXTENSIONS_DIR, "external.json");
if (fs.existsSync(externalJsonPath)) {
try {
const externalExtensions = JSON.parse(
fs.readFileSync(externalJsonPath, "utf-8")
);
if (Array.isArray(externalExtensions)) {
for (const ext of externalExtensions) {
const name = normalizeText(ext?.name);
const installUrl = normalizeText(ext?.installUrl);
const sourceUrl = normalizeText(ext?.sourceUrl || installUrl);
if (!name || !installUrl) {
continue;
}

const id = normalizeText(ext?.id || name.toLowerCase().replace(/\s+/g, "-"));
let imageUrl = normalizeText(ext?.imageUrl);
let assetPath = null;
const imagePath = normalizeText(ext?.imagePath);
if (!imageUrl && imagePath) {
const repoAssetPath = imagePath.replace(/\\/g, "/");
imageUrl = buildRepoImageUrl(repoAssetPath, commitSha);
assetPath = repoAssetPath;
}

extensions.push({
id,
name,
description: normalizeText(ext?.description, "External canvas extension"),
path: null,
ref: null,
lastUpdated: null,
imageUrl: imageUrl || null,
assetPath,
installUrl,
sourceUrl: sourceUrl || null,
external: true,
});
}
}
} catch (e) {
console.warn(`Failed to parse external extensions: ${e.message}`);
}
}

const sortedExtensions = extensions.sort((a, b) =>
a.name.localeCompare(b.name)
);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions extensions/backlog-swipe-triage/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Backlog Swipe Triage

Swipe-driven backlog triage canvas for reviewing open issues, applying quick decisions, and starting implementation sessions.

## Assets

- `assets/preview.png` — preferred screenshot path for the triage experience.
- `assets/swipe-canvas-triage.png` — existing reference screenshot kept for compatibility.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading