Skip to content

Commit

Permalink
Tweaks to profile generator
Browse files Browse the repository at this point in the history
  • Loading branch information
fileformat committed Oct 31, 2024
1 parent e983517 commit 40c185e
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions src/app/internal/readme.txt/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ import { getWorkingEngines } from "@/engines";

type Project = {
name: string;
nodeping_id: string;
nodeping_id?: string;
workflow: string;
source_url: string;
url: string;
url?: string;
test_url?: string;
};

Expand All @@ -18,26 +19,25 @@ const non_engine_projects: Project[] = [
nodeping_id: "e6od3bui-a5wl-49ff-8698-0cbtjc52rqw1",
source_url: "https://github.com/regexplanet/regexplanet-next",
url: "https://www.regexplanet.com/",
workflow: "gcr-deploy",
},
{
name: "Regex Zone",
nodeping_id: "e6od3bui-a5wl-49ff-8698-0cbtjc52rqw1",
source_url: "https://github.com/regexplanet/regex-zone",
url: "https://www.regex.zone/",
workflow: "gcr-deploy",
},
];

const make_row = (project: Project) => {
const name = `[${project.name}](${project.url})`;
let deploy = `[![deploy](${project.source_url}/actions/workflows/gcr-deploy.yaml/badge.svg)](${project.source_url}/actions/workflows/gcr-deploy.yaml)`;
if (project.test_url && project.test_url.indexOf("appspot.com") != -1) {
deploy = `[![build](${project.source_url}/actions/workflows/appengine-deploy.yaml/badge.svg)](${project.source_url}/actions/workflows/appengine-deploy.yaml)`;
}
const name = project.url ? `[${project.name}](${project.url})` : project.name;
const deploy = project.workflow ? `[![${project.workflow}](${project.source_url}/actions/workflows/${project.workflow}.yaml/badge.svg)](${project.source_url}/actions/workflows/${project.workflow}.yaml)` : 'n/a';
const repo = project.source_url.split("/").slice(-1)[0];
const issues = `![GitHub Issues](https://img.shields.io/github/issues/regexplanet/${repo})`;
const prs = `![GitHub Issues or Pull Requests](https://img.shields.io/github/issues-pr/regexplanet/${repo})`;
const status = `![NodePing status](https://img.shields.io/nodeping/status/${project.nodeping_id})`;
const uptime = `![NodePing uptime](https://img.shields.io/nodeping/uptime/${project.nodeping_id})`;
const status = project.nodeping_id ? `![NodePing status](https://img.shields.io/nodeping/status/${project.nodeping_id})` : 'n/a';
const uptime = project.nodeping_id ? `![NodePing uptime](https://img.shields.io/nodeping/uptime/${project.nodeping_id})` : 'n/a';
const source = `[source](${project.source_url})`;

return `| ${name} | ${deploy} | ${issues} | ${prs} | ${status} | ${uptime} | ${source} |`;
Expand All @@ -54,6 +54,7 @@ export async function GET() {
source_url: engine.source_url || "",
test_url: engine.test_url,
url: `https://www.regexplanet.com/advanced/${engine.handle}/index.html`,
workflow: engine.test_url && engine.test_url.indexOf("appspot.com") != -1 ? "appengine-deploy" : "gcr-deploy",
});
});

Expand All @@ -63,7 +64,18 @@ export async function GET() {
|---------|-------|--------|-----|--------|--------|--------|
${non_engine_projects.map(make_row).join("\n")}
${engines.join("\n")}
| Common library | n/a | n/a | n/a | [source](https://github.com/regexplanet/regexplanet-common) |
${make_row({
name: "Common library",
source_url: "regexplanet/regexplanet-common",
url: "https://jsr.io/@regexplanet/common",
workflow: "publish",
})}
${make_row({
name: "Javascript Template",
source_url: "regexplanet/regexplanet-template",
url: "https://jsr.io/@regexplanet/template",
workflow: "publish",
})}
`;

return new Response(readme, {
Expand Down

0 comments on commit 40c185e

Please sign in to comment.