Skip to content

Commit

Permalink
refactor: hoist current/past-maintainers keys up (#811)
Browse files Browse the repository at this point in the history
Co-authored-by: uncenter <[email protected]>
  • Loading branch information
sgoudham and uncenter authored Jun 2, 2024
1 parent 09a7f85 commit 6ca6c43
Show file tree
Hide file tree
Showing 7 changed files with 148 additions and 148 deletions.
18 changes: 9 additions & 9 deletions docs/userstylesyml.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ on the schema. Please refer to it for clarification.
color: <color>
readme:
app-link: <url>
current-maintainers: [*<github-username>]
current-maintainers: [*<github-username>]
```
`All Fields:`
Expand Down Expand Up @@ -75,8 +75,8 @@ on the schema. Please refer to it for clarification.
faq: # OPTIONAL
- question: <question>
answer: <answer>
current-maintainers: [*<github-username>]
past-maintainers: [*<github-username>] # OPTIONAL
current-maintainers: [*<github-username>]
past-maintainers: [*<github-username>] # OPTIONAL
```

### Adding yourself as a maintainer
Expand Down Expand Up @@ -106,8 +106,8 @@ userstyles:
color: red
readme:
app-link: "https://youtube.com"
current-maintainers: [*isabelroses, *your-username]
past-maintainers: [*elkrien]
current-maintainers: [*isabelroses, *your-username]
past-maintainers: [*elkrien]
```

If the change is accepted, you will receive an invitation to the `catppuccin` organization,
Expand All @@ -132,10 +132,10 @@ userstyles:
color: red
readme:
app-link: "https://youtube.com"
- current-maintainers: [*isabelroses, *elkrien]
- past-maintainers: []
+ current-maintainers: [*isabelroses]
+ past-maintainers: [*elkrien]
- current-maintainers: [*isabelroses, *elkrien]
- past-maintainers: []
+ current-maintainers: [*isabelroses]
+ past-maintainers: [*elkrien]
If you would not like to be listed as a past maintainer, you can remove yourself from
`collaborators` array entirely. Upon removal, you will also be removed from the
Expand Down
8 changes: 4 additions & 4 deletions scripts/generate/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,12 @@ await syncIssueLabels(userstylesData.userstyles);
await updateFile(
join(REPO_ROOT, ".github/CODEOWNERS"),
Object.entries(userstylesData.userstyles)
.filter(([_, { readme }]) => readme["current-maintainers"].length > 0)
.map(([slug, { readme }]) => {
const currentMaintainers = readme["current-maintainers"]
.filter(([_, { "current-maintainers": currentMaintainers }]) => currentMaintainers.length > 0)
.map(([slug, { "current-maintainers": currentMaintainers }]) => {
const codeOwners = currentMaintainers
.map((maintainer) => `@${maintainer.url.split("/").pop()}`)
.join(" ");
return `/styles/${slug} ${currentMaintainers}`;
return `/styles/${slug} ${codeOwners}`;
})
.join("\n"),
);
4 changes: 2 additions & 2 deletions scripts/generate/readme-repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ export const generateMainReadme = async (
return {
emoji: meta.emoji,
name: meta.name,
ports: ports.map(({ name, path, readme }) => {
ports: ports.map(({ name, path, "current-maintainers": currentMaintainers }) => {
return {
name: [name].flat(),
maintained: readme["current-maintainers"].length > 0,
maintained: currentMaintainers.length > 0,
path,
};
}),
Expand Down
6 changes: 3 additions & 3 deletions scripts/generate/readme-styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@ export const generateStyleReadmes = (
);
const stylesReadmeContent = Deno.readTextFileSync(stylesReadmePath);

Object.entries(userstyles).map(([slug, { name, readme }]) => {
Object.entries(userstyles).map(([slug, { name, readme, "current-maintainers": currentMaintainers, "past-maintainers": pastMaintainers }]) => {
console.log(`Generating README for ${slug}`);
const readmeContent = Handlebars.compile(stylesReadmeContent)({
heading: heading(name, readme["app-link"]),
slug,
usage: readme.usage,
faq: readme.faq,
collaborators: {
currentMaintainers: extractName(readme["current-maintainers"]),
pastMaintainers: extractName(readme["past-maintainers"]),
currentMaintainers: extractName(currentMaintainers),
pastMaintainers: extractName(pastMaintainers),
},
});
Deno.writeTextFile(
Expand Down
6 changes: 3 additions & 3 deletions scripts/types/userstyles.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export type CurrentMaintainers = {
[k: string]: unknown;
}[];
/**
* List of all maintainers that have maintained on this userstyle in the past.
* List of all users that have maintained this userstyle in the past.
*
* @minItems 1
*/
Expand Down Expand Up @@ -176,6 +176,8 @@ export interface Userstyle {
color: Color;
icon?: Icon;
readme: README;
"current-maintainers": CurrentMaintainers;
"past-maintainers"?: PastMaintainers;
}
/**
* Options to help in the auto-generation of the userstyle README.
Expand All @@ -184,7 +186,5 @@ export interface README {
"app-link": ApplicationLink;
usage?: Usage;
faq?: FAQ;
"current-maintainers": CurrentMaintainers;
"past-maintainers"?: PastMaintainers;
[k: string]: unknown;
}
36 changes: 18 additions & 18 deletions scripts/userstyles.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"type": "object",
"description": "The directory of the userstyle.",
"examples": ["youtube"],
"required": ["name", "categories", "readme", "color"],
"required": ["name", "categories", "readme", "color", "current-maintainers"],
"additionalProperties": false,
"properties": {
"name": {
Expand Down Expand Up @@ -79,7 +79,7 @@
"title": "README",
"description": "Options to help in the auto-generation of the userstyle README.",
"type": "object",
"required": ["app-link", "current-maintainers"],
"required": ["app-link"],
"properties": {
"app-link": {
"$id": "#userstyles/userstyle/readme/app-link",
Expand Down Expand Up @@ -130,23 +130,23 @@
},
"required": ["question", "answer"]
}
},
"current-maintainers": {
"$id": "#userstyles/userstyle/readme/current-maintainers",
"title": "Current Maintainers",
"description": "List of all active maintainers for this userstyle.",
"type": "array",
"$ref": "#/$defs/collaborators"
},
"past-maintainers": {
"$id": "#userstyles/userstyle/readme/past-maintainers",
"title": "Past Maintainers",
"type":"array",
"minItems": 1,
"description": "List of all maintainers that have maintained on this userstyle in the past.",
"$ref": "#/$defs/collaborators"
}
}
},
"current-maintainers": {
"$id": "#userstyles/userstyle/current-maintainers",
"title": "Current Maintainers",
"description": "List of all active maintainers for this userstyle.",
"type": "array",
"$ref": "#/$defs/collaborators"
},
"past-maintainers": {
"$id": "#userstyles/userstyle/past-maintainers",
"title": "Past Maintainers",
"type": "array",
"minItems": 1,
"description": "List of all users that have maintained this userstyle in the past.",
"$ref": "#/$defs/collaborators"
}
}
}
Expand Down Expand Up @@ -182,7 +182,7 @@
"required": ["url"]
}
},
"categories": {
"categories": {
"$id": "#categories",
"type": "array",
"minItems": 1,
Expand Down
Loading

0 comments on commit 6ca6c43

Please sign in to comment.