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 6bbf5e9
Showing 1 changed file with 31 additions and 11 deletions.
42 changes: 31 additions & 11 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,33 +19,37 @@ 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} |`;
};

export async function GET() {

const engines = getWorkingEngines()
.filter((engine) => engine.nodeping_id != "N/A")
.map((engine) => {
Expand All @@ -54,6 +59,10 @@ 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 +72,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: "https://github.com/regexplanet/regexplanet-common",
url: "https://jsr.io/@regexplanet/common",
workflow: "publish",
})}
${make_row({
name: "Javascript Template",
source_url: "https://github.com/regexplanet/regexplanet-template",
url: "https://jsr.io/@regexplanet/template",
workflow: "publish",
})}
`;

return new Response(readme, {
Expand Down

0 comments on commit 6bbf5e9

Please sign in to comment.