Skip to content

Commit 14fa6cc

Browse files
Rename tooling to projects
1 parent 219194f commit 14fa6cc

5 files changed

Lines changed: 17 additions & 15 deletions

File tree

.github/workflows/refresh-github-metadata.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
- name: Check for changes
4848
id: changes
4949
run: |
50-
if git diff --quiet -- src/data/tooling.yaml; then
50+
if git diff --quiet -- src/data/projects.yaml; then
5151
echo "has_changes=false" >> "$GITHUB_OUTPUT"
5252
else
5353
echo "has_changes=true" >> "$GITHUB_OUTPUT"
@@ -58,6 +58,6 @@ jobs:
5858
run: |
5959
git config user.name "github-actions[bot]"
6060
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
61-
git add src/data/tooling.yaml
61+
git add src/data/projects.yaml
6262
git commit -m "chore: refresh GitHub metadata"
6363
git push origin HEAD:main

scripts/sync-github-metadata.mjs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { parseDocument, isMap, isScalar, isSeq } from "yaml"
33

44
const toolingPath = process.env.TOOLING_PATH
55
? new URL(process.env.TOOLING_PATH, `file://${process.cwd()}/`)
6-
: new URL("../src/data/tooling.yaml", import.meta.url)
6+
: new URL("../src/data/projects.yaml", import.meta.url)
77
const githubToken = process.env.GITHUB_TOKEN
88
const githubApiBaseUrl =
99
process.env.GITHUB_API_BASE_URL ?? "https://api.github.com"
@@ -13,14 +13,14 @@ const document = parseDocument(source)
1313
const projectsNode = document.get("projects", true)
1414

1515
if (!isSeq(projectsNode)) {
16-
throw new Error("tooling.yaml must include a projects array.")
16+
throw new Error("projects.yaml must include a projects array.")
1717
}
1818

1919
const repositoryNames = []
2020

2121
for (const projectNode of projectsNode.items) {
2222
if (!isMap(projectNode)) {
23-
throw new Error("Each project entry in tooling.yaml must be an object.")
23+
throw new Error("Each project entry in projects.yaml must be an object.")
2424
}
2525

2626
const repositoryName = readOptionalString(projectNode.get("repository_name"))
@@ -31,7 +31,9 @@ for (const projectNode of projectsNode.items) {
3131
}
3232

3333
const uniqueRepositoryNames = Array.from(new Set(repositoryNames))
34-
const metadataByRepository = await fetchRepositoryMetadata(uniqueRepositoryNames)
34+
const metadataByRepository = await fetchRepositoryMetadata(
35+
uniqueRepositoryNames
36+
)
3537

3638
let updatedProjectCount = 0
3739

@@ -58,7 +60,7 @@ for (const projectNode of projectsNode.items) {
5860

5961
if (shouldSyncTagsFromGitHub(projectNode)) {
6062
const nextTopics = metadata.topics.toSorted((left, right) =>
61-
left.localeCompare(right),
63+
left.localeCompare(right)
6264
)
6365
const currentTags = readStringArray(projectNode.get("tags"))
6466

@@ -83,7 +85,7 @@ if (nextSource === source) {
8385
await writeFile(toolingPath, nextSource)
8486

8587
console.log(
86-
`Updated ${updatedProjectCount} project entries across ${uniqueRepositoryNames.length} repositories.`,
88+
`Updated ${updatedProjectCount} project entries across ${uniqueRepositoryNames.length} repositories.`
8789
)
8890

8991
function readOptionalString(value) {
@@ -147,7 +149,7 @@ async function fetchRepositoryMetadata(repositoryNames) {
147149
batch.map(async (repositoryName) => [
148150
repositoryName,
149151
await fetchSingleRepositoryMetadata(repositoryName),
150-
]),
152+
])
151153
)
152154

153155
for (const [repositoryName, metadata] of entries) {
@@ -175,7 +177,7 @@ async function fetchSingleRepositoryMetadata(repositoryName) {
175177
const details = await response.text()
176178

177179
throw new Error(
178-
`Failed to fetch ${repositoryName}: ${response.status} ${response.statusText}\n${details}`,
180+
`Failed to fetch ${repositoryName}: ${response.status} ${response.statusText}\n${details}`
179181
)
180182
}
181183

src/App.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import {
2929
TableHeader,
3030
TableRow,
3131
} from "@/components/ui/table"
32-
import rawToolingDatabase from "@/data/tooling.yaml?raw"
32+
import rawToolingDatabase from "@/data/projects.yaml?raw"
3333
import { loadToolingRows, type ToolRow } from "@/lib/tooling"
3434

3535
const toolingRows = loadToolingRows(rawToolingDatabase)
@@ -104,7 +104,7 @@ export function App() {
104104
</div>
105105
</div>
106106
<div className="flex items-end gap-4">
107-
<div className="min-w-0 max-w-2xl flex-1">
107+
<div className="max-w-2xl min-w-0 flex-1">
108108
<div className="relative">
109109
<div className="flex min-h-11 flex-wrap items-center gap-2 rounded-xl border border-border/70 bg-background/85 px-3 py-2 shadow-sm transition-[border-color,box-shadow] focus-within:border-primary/50 focus-within:ring-4 focus-within:ring-primary/10">
110110
<Search className="size-4 text-muted-foreground" />
@@ -276,7 +276,7 @@ export function App() {
276276
) : null}
277277
</div>
278278
</TableCell>
279-
<TableCell className="text-right tabular-nums text-muted-foreground">
279+
<TableCell className="text-right text-muted-foreground tabular-nums">
280280
{formatStarCount(tool.stars)}
281281
</TableCell>
282282
<TableCell>

src/lib/tooling.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export function loadToolingRows(source: string) {
2626
const document = parse(source) as ToolingDatabase
2727

2828
if (!Array.isArray(document.projects)) {
29-
throw new Error("tooling.yaml must include a projects array.")
29+
throw new Error("projects.yaml must include a projects array.")
3030
}
3131

3232
const entries = readObjectArray(document.projects, "projects")
@@ -69,7 +69,7 @@ function readOptionalString(value: unknown) {
6969
}
7070

7171
if (typeof value !== "string") {
72-
throw new Error("Expected a string value in tooling.yaml.")
72+
throw new Error("Expected a string value in projects.yaml.")
7373
}
7474

7575
const trimmed = value.trim()

0 commit comments

Comments
 (0)