refactor: general improvements (#81)

* fix: use correct shield for issues by label

* style: run `deno fmt`

* build(CODEOWNERS): remove extra `#` and `\n`

* docs: remove escaping `.` for folders

* docs: commit to using `userstyle`

Originally, we wanted to avoid using the
word userstyle in case non-developers
were confused.

However, given that the name of the
repository is catppuccin/userstyles and
there are now explanations for what a
userstyle is. I believe we should be more
consistent and commit to using the word.

* build(userstyle.yml): shorten issue template

This commit uses the abbreviated YAML list
syntax to auto-populate the labels. This will
ensure that this file remains easy to scroll
as more userstyles are added.

* chore: use raw link for schema

Using a relative link only works when the
user has locally cloned the repository. This
commit changes it back to a raw link so
that it overcomes this limitation.

* build: refine commit msg in `git-auto-commit-action"

The current commit message is quite verbose and
co-authors the original author.

In @nekowinston's words:
"there's no reason i'm co-authored when i merge
a PR in that changes a single line in the readme
:baldkek:"

This commit reduces the verbosity of the commit
message and doesn't co-author the merger.

* build(issue-labeler.yml): shorten file

Please see the commit description of
4a1326983f1e1a3bbe663f4aa16b6e19f8df8da8

* docs: highlight text as bold

We want to draw the user's attention
to specific parts of the page.

For the CONTRIBUTING.md, we want to
make sure their eyes are down towards
"New Userstyles."

For the userstyle-creation.md, we want
to make sure that the user knows READMEs
are auto-generated.

* chore: update `deno.lock`

* chore: generate health files
This commit is contained in:
Hamothy authored and GitHub committed 2023-07-22 02:15:44 +01:00
1 parent 24d53cfc61
commit 1c16ae7dd1
51 files changed
+284 -327

No files matched your search

+7 -4
View File
@@ -110,11 +110,12 @@
"https://deno.land/[email protected]/yaml/schema/mod.ts": "4472e827bab5025e92bc2eb2eeefa70ecbefc64b2799b765c69af84822efef32",
"https://deno.land/[email protected]/yaml/stringify.ts": "fffc09c65c68d3d63f8159e8cbaa3f489bc20a8e55b4fbb61a8c2e9f914d1d02",
"https://deno.land/[email protected]/yaml/type.ts": "1aabb8e0a3f4229ce0a3526256f68826d9bdf65a36c8a3890ead8011fcba7670",
"https://raw.githubusercontent.com/catppuccin/catppuccin/main/resources/generate/types.d.ts": "d0c5ac99cbb0d55d54efd56c9d7d4dcae1ef690ed3f1d5ecf7eb56c56eb0396a",
"https://raw.githubusercontent.com/catppuccin/catppuccin/main/resources/ports.schema.json": "58dce2a85f75f4afedd48e69870dc42c43b08cbb9cf683c1c25bf9f2fd354287"
"https://raw.githubusercontent.com/catppuccin/catppuccin/main/resources/ports.schema.json": "f1bfc1f4c68af258cd2f1a254d70069b7d254ab0cfe298b9b52bcd78299d8e40"
},
"npm": {
"specifiers": { "[email protected]": "[email protected]" },
"specifiers": {
"[email protected]": "[email protected]"
},
"packages": {
"[email protected]": {
"integrity": "sha512-sRu1kpcO9yLtYxBKvqfTeh9KzZEwO3STyX1HT+4CaDzC6HpTGYhIhPIzj9XuKU7KYDwnaeh5hcOwjy1QuJzBPA==",
@@ -143,7 +144,9 @@
},
"[email protected]": {
"integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
"dependencies": { "punycode": "[email protected]" }
"dependencies": {
"punycode": "[email protected]"
}
}
}
}
+4 -2
View File
@@ -4,7 +4,9 @@ import Ajv from "npm:[email protected]";
import * as path from "https://deno.land/[email protected]/path/mod.ts";
import { walkSync } from "https://deno.land/[email protected]/fs/walk.ts";
import schema from "../userstyles.schema.json" assert { type: "json" };
import portsSchema from "https://raw.githubusercontent.com/catppuccin/catppuccin/main/resources/ports.schema.json" assert { type: "json" };
import portsSchema from "https://raw.githubusercontent.com/catppuccin/catppuccin/main/resources/ports.schema.json" assert {
type: "json",
};
export type { Categories as PortCategories } from "https://raw.githubusercontent.com/catppuccin/catppuccin/main/resources/generate/types.d.ts";
export { Ajv, path, walkSync, portsSchema, schema };
export { Ajv, path, portsSchema, schema, walkSync };
+46 -38
View File
@@ -3,19 +3,19 @@ import {
Ajv,
parseYaml,
path,
PortCategories,
portsSchema,
schema,
PortCategories,
} from "./deps.ts";
import {
FAQ,
Userstyle,
CurrentMaintainers,
PastMaintainers,
Userstyles,
Usage,
ApplicationLink,
CurrentMaintainers,
FAQ,
Name,
PastMaintainers,
Usage,
Userstyle,
Userstyles,
} from "./types.d.ts";
const ROOT = new URL(".", import.meta.url).pathname;
@@ -42,7 +42,7 @@ const validate = ajv.compile<Metadata>(schema);
const validatePorts = ajv.compile<PortMetadata>(portsSchema);
const userstylesYaml = Deno.readTextFileSync(
path.join(ROOT, "../userstyles.yml")
path.join(ROOT, "../userstyles.yml"),
);
const userstylesData = parseYaml(userstylesYaml);
if (!validate(userstylesData)) {
@@ -51,7 +51,7 @@ if (!validate(userstylesData)) {
}
const portsYaml = await fetch(
"https://raw.githubusercontent.com/catppuccin/catppuccin/main/resources/ports.yml"
"https://raw.githubusercontent.com/catppuccin/catppuccin/main/resources/ports.yml",
);
const portsData = parseYaml(await portsYaml.text());
if (!validatePorts(portsData)) {
@@ -70,7 +70,7 @@ const categorized = Object.entries(userstylesData.userstyles).reduce(
});
return acc;
},
{} as Record<string, MappedPort[]>
{} as Record<string, MappedPort[]>,
);
const portListData = portsData.categories
@@ -84,17 +84,22 @@ const portListData = portsData.categories
const portContent = portListData
.map(
(data) => `<details open>
(data) =>
`<details open>
<summary>${data.meta.emoji} ${data.meta.name}</summary>
${data.ports
.map((port) => {
const name = Array.isArray(port.name) ? port.name.join(", ") : port.name;
return `- [${name}](${port.path})`;
})
.join("\n")}
${
data.ports
.map((port) => {
const name = Array.isArray(port.name)
? port.name.join(", ")
: port.name;
return `- [${name}](${port.path})`;
})
.join("\n")
}
</details>`
</details>`,
)
.join("\n");
@@ -152,10 +157,7 @@ updateFile(pullRequestLabelerPath, pullRequestLabelerContent);
const issuesLabelerPath = path.join(REPO_ROOT, ".github/issue-labeler.yml");
const issuesLabelerContent = Object.entries(userstylesData.userstyles)
.map(([key]) => {
return `${key}:
- '(${ISSUE_PREFIX + key})'`;
})
.map(([key]) => `${key}: ['(${ISSUE_PREFIX + key})']`)
.join("\n");
updateFile(issuesLabelerPath, issuesLabelerContent);
@@ -167,20 +169,22 @@ const ownersContent = Object.entries(userstylesData.userstyles)
.join(" ");
return `/styles/${key} ${currentMaintainers}`;
})
.join("\n#\n");
.join("\n");
updateFile(ownersPath, ownersContent);
const userstyleIssuePath = path.join(ROOT, "templates/userstyle-issue.yml");
const userstyleIssueContent = Deno.readTextFileSync(userstyleIssuePath);
const replacedUserstyleIssueContent = userstyleIssueContent.replace(
"$PORTS",
`${Object.entries(userstylesData.userstyles)
.map(([key]) => `- ${ISSUE_PREFIX + key}`)
.join("\n ")}`
`${
Object.entries(userstylesData.userstyles)
.map(([key]) => `'${ISSUE_PREFIX + key}'`)
.join(", ")
}`,
);
Deno.writeTextFileSync(
path.join(REPO_ROOT, ".github/ISSUE_TEMPLATE/userstyle.yml"),
replacedUserstyleIssueContent
replacedUserstyleIssueContent,
);
const heading = (name: Name, link: ApplicationLink) => {
@@ -189,13 +193,15 @@ const heading = (name: Name, link: ApplicationLink) => {
if (nameArray.length !== linkArray.length) {
throw new Error(
'The "name" and "app-link" arrays must have the same length'
'The "name" and "app-link" arrays must have the same length',
);
}
return `Catppuccin for ${nameArray
.map((name, index) => `<a href="${linkArray[index]}">${name}</a>`)
.join(", ")}`;
return `Catppuccin for ${
nameArray
.map((name, index) => `<a href="${linkArray[index]}">${name}</a>`)
.join(", ")
}`;
};
const usageContent = (usage?: Usage) => {
@@ -207,9 +213,11 @@ const faqContent = (faq?: FAQ) => {
return "";
}
return `## 🙋 FAQ
${faq
.map(({ question, answer }) => `- Q: ${question} \n\tA: ${answer}`)
.join("\n")}`;
${
faq
.map(({ question, answer }) => `- Q: ${question} \n\tA: ${answer}`)
.join("\n")
}`;
};
const collaboratorsContent = (allCollaborators: CollaboratorsData[]) => {
@@ -227,7 +235,7 @@ const collaboratorsContent = (allCollaborators: CollaboratorsData[]) => {
const updateStylesReadmeContent = (
readme: string,
key: string,
userstyle: Userstyle
userstyle: Userstyle,
) => {
return readme
.replace("$TITLE", heading(userstyle.name, userstyle.readme["app-link"]))
@@ -245,7 +253,7 @@ const updateStylesReadmeContent = (
collaborators: userstyle.readme["past-maintainers"],
heading: "## 💖 Past Maintainer(s)",
},
])
]),
);
};
@@ -257,11 +265,11 @@ for (const [key, userstyle] of Object.entries(userstylesData.userstyles)) {
readmeContent = updateStylesReadmeContent(
stylesReadmeContent,
key,
userstyle
userstyle,
);
Deno.writeTextFileSync(
path.join(REPO_ROOT, "styles", key, "README.md"),
readmeContent
readmeContent,
);
} catch (e) {
console.log(`Failed to update ${userstyle} README:`, e);
+1 -2
View File
@@ -14,8 +14,7 @@ body:
label: What userstyles are you seeing the problem on?
description: "Don't worry about the `lbl:` prefix, it allows issues to be automatically labeled!"
multiple: true
options:
$PORTS
options: [$PORTS]
validations:
required: true
- type: textarea
+2 -2
View File
@@ -9,7 +9,7 @@
</h3>
<p align="center">
<a href="https://github.com/catppuccin/userstyles/issues?q=is%3Aissue+is+label%3A$LOWERCASE-PORT"><img src="https://img.shields.io/github/issues/catppuccin/userstyles?colorA=363a4f&colorB=f5a97f&style=for-the-badge"></a>
<a href="https://github.com/catppuccin/userstyles/issues?q=is%3Aissue+is+label%3A$LOWERCASE-PORT"><img src="https://img.shields.io/github/issues/catppuccin/userstyles/$LOWERCASE-PORT?colorA=363a4f&colorB=f5a97f&style=for-the-badge"></a>
<a href="https://raw.githubusercontent.com/catppuccin/userstyles/main/styles/$LOWERCASE-PORT/catppuccin.user.css"><img src="https://img.shields.io/badge/stylus-install-cba6f7?colorA=363a4f&style=for-the-badge"></a>
</p>
@@ -52,4 +52,4 @@ $COLLABORATORS
Copyright &copy; 2021-present <a href="https://github.com/catppuccin" target="_blank">Catppuccin Org</a>
</p>
<!-- AUTOGEN:README END -->
<!-- AUTOGEN:README END -->
+4 -4
View File
@@ -74,7 +74,7 @@ export type FAQ = [
question: Question;
answer: Answer;
[k: string]: unknown;
}[]
}[],
];
/**
* A question that a user may have about the userstyle.
@@ -99,7 +99,7 @@ export type CurrentMaintainers = [
name?: DisplayName;
url: GitHubProfile;
[k: string]: unknown;
}[]
}[],
];
/**
* The display name of the collaborator to show in the userstyle README.
@@ -124,7 +124,7 @@ export type PastMaintainers = [
name?: DisplayName;
url: GitHubProfile;
[k: string]: unknown;
}[]
}[],
];
/**
* Represents all maintainers and contributors to all userstyles.
@@ -141,7 +141,7 @@ export type AllCollaborators = [
name?: DisplayName;
url: GitHubProfile;
[k: string]: unknown;
}[]
}[],
];
export interface UserstylesSchema {
+1 -1
View File
@@ -347,4 +347,4 @@ userstyles:
answer: "It is there in-case you have an OLED display. If you have one, you might want to enable this."
current-maintainers: [*isabelroses]
past-maintainers: [*elkrien]
# yaml-language-server: $schema=userstyles.schema.json
# yaml-language-server: $schema=https://raw.githubusercontent.com/catppuccin/userstyles/main/src/userstyles.schema.json