refactor(treewide)!: simplify userstyles.yml & remove style previews (#1691)
Co-authored-by: uncenter <[email protected]>
This commit is contained in:
1 parent
b8e16c7524
commit
37fd16969a
265 files changed
+543
-1635
No files matched your search
+35
-14
@@ -16,7 +16,11 @@ const macchiatoHex = flavors.macchiato.colorEntries
|
||||
return acc;
|
||||
}, {} as Record<ColorName, string>);
|
||||
|
||||
const toIssueLabel = (slug: string | number) => `lbl:${slug}`;
|
||||
const toIssueLabel = (key: string) => `lbl:${key}`;
|
||||
|
||||
const toIssueLabelRegex = (key: string) => `/${toIssueLabel(key)}(,.*)?$/gm`;
|
||||
|
||||
const toPrLabel = (key: string) => `styles/${key}/**/*`;
|
||||
|
||||
export async function syncIssueLabels(userstyles: UserstylesSchema.Userstyles) {
|
||||
// .github/issue-labeler.yml
|
||||
@@ -24,8 +28,11 @@ export async function syncIssueLabels(userstyles: UserstylesSchema.Userstyles) {
|
||||
path.join(REPO_ROOT, ".github/issue-labeler.yml"),
|
||||
yaml.stringify(
|
||||
Object.entries(userstyles)
|
||||
.reduce((acc, [key]) => {
|
||||
acc[key.toString()] = [`/${toIssueLabel(key)}(,.*)?$/gm`];
|
||||
.reduce((acc, [key, { supports }]) => {
|
||||
acc[key.toString()] = [toIssueLabelRegex(key)];
|
||||
Object.keys(supports ?? {}).forEach((key) => {
|
||||
acc[key.toString()] = [toIssueLabelRegex(key)];
|
||||
});
|
||||
return acc;
|
||||
}, {} as Record<string, string[]>),
|
||||
),
|
||||
@@ -42,7 +49,12 @@ export async function syncIssueLabels(userstyles: UserstylesSchema.Userstyles) {
|
||||
`"$LABELS"`,
|
||||
`${
|
||||
Object.entries(userstyles)
|
||||
.map(([key]) => `"${toIssueLabel(key)}"`)
|
||||
.flatMap(([slug, { supports }]) =>
|
||||
[slug, ...Object.keys(supports ?? {})].map((key) =>
|
||||
`"${toIssueLabel(key)}"`
|
||||
)
|
||||
)
|
||||
.sort()
|
||||
.join(", ")
|
||||
}`,
|
||||
),
|
||||
@@ -53,8 +65,11 @@ export async function syncIssueLabels(userstyles: UserstylesSchema.Userstyles) {
|
||||
path.join(REPO_ROOT, ".github/pr-labeler.yml"),
|
||||
yaml.stringify(
|
||||
Object.entries(userstyles)
|
||||
.reduce((acc, [key]) => {
|
||||
acc[`${key}`] = `styles/${key}/**/*`;
|
||||
.reduce((acc, [key, { supports }]) => {
|
||||
acc[key] = toPrLabel(key);
|
||||
Object.keys(supports ?? {}).forEach((supportedKey) => {
|
||||
acc[supportedKey] = toPrLabel(key);
|
||||
});
|
||||
return acc;
|
||||
}, {} as Record<string, string>),
|
||||
),
|
||||
@@ -64,14 +79,20 @@ export async function syncIssueLabels(userstyles: UserstylesSchema.Userstyles) {
|
||||
await writeWithPreamble(
|
||||
path.join(REPO_ROOT, ".github/labels.yml"),
|
||||
yaml.stringify(
|
||||
Object.entries(userstyles)
|
||||
.map(([slug, style]) => {
|
||||
return {
|
||||
name: slug,
|
||||
description: [style.name].flat().join(", "),
|
||||
color: style.color ? macchiatoHex[style.color] : macchiatoHex.blue,
|
||||
};
|
||||
}),
|
||||
Object.entries(userstyles).flatMap(([key, style]) => [
|
||||
{
|
||||
name: key,
|
||||
description: style.name,
|
||||
color: style.color ? macchiatoHex[style.color] : macchiatoHex.blue,
|
||||
},
|
||||
...Object.entries(style.supports ?? {}).map((
|
||||
[supportedKey, { name }],
|
||||
) => ({
|
||||
name: supportedKey,
|
||||
description: name,
|
||||
color: style.color ? macchiatoHex[style.color] : macchiatoHex.blue,
|
||||
})),
|
||||
]),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -19,21 +19,30 @@ export async function generateMainReadme(
|
||||
if (!categoriesData) throw ("Categories data is missing categories");
|
||||
|
||||
const categorized = Object.entries(userstyles)
|
||||
.reduce((acc, [slug, { categories, ...port }]) => {
|
||||
.reduce((acc, [slug, { categories, supports, ...userstyle }]) => {
|
||||
// initialize category array if it doesn't exist
|
||||
// only care about the first (primary) category in the categories array
|
||||
acc[categories[0]] ??= [];
|
||||
|
||||
acc[categories[0]].push({
|
||||
const baseUserstyle = {
|
||||
path: `styles/${slug}`,
|
||||
categories,
|
||||
...port,
|
||||
});
|
||||
...userstyle,
|
||||
};
|
||||
|
||||
// Sort by name, first array entry if necessary
|
||||
acc[categories[0]].sort((a, b) =>
|
||||
[a.name].flat()[0].localeCompare([b.name].flat()[0])
|
||||
acc[categories[0]].push(
|
||||
baseUserstyle,
|
||||
// supported websites themed by the userstyle are added as their own entries for the README
|
||||
...(Object.values(supports ?? {}).map(({ name, link }) => ({
|
||||
...baseUserstyle,
|
||||
name,
|
||||
link,
|
||||
}))),
|
||||
);
|
||||
|
||||
// sort by name
|
||||
acc[categories[0]].sort((a, b) => a.name.localeCompare(b.name));
|
||||
|
||||
return acc;
|
||||
}, {} as MappedPorts);
|
||||
|
||||
@@ -48,11 +57,12 @@ export async function generateMainReadme(
|
||||
<summary>{{emoji}} {{name}}</summary>
|
||||
|
||||
{{#each ports}}
|
||||
- {{#unless maintained}}❤️🩹 {{/unless}}[{{#each name}}{{ this }}{{#unless @last}}, {{/unless}}{{/each}}]({{ path }})
|
||||
- {{#unless maintained}}❤️🩹 {{/unless}}[{{ name }}]({{ path }})
|
||||
{{/each}}
|
||||
|
||||
</details>
|
||||
{{/each}}`)({
|
||||
{{/each}}
|
||||
`)({
|
||||
category: portListData.map(({ meta, ports }) => {
|
||||
return {
|
||||
emoji: meta.emoji,
|
||||
@@ -66,7 +76,7 @@ export async function generateMainReadme(
|
||||
},
|
||||
) => {
|
||||
return {
|
||||
name: [name].flat(),
|
||||
name,
|
||||
maintained: currentMaintainers.length > 0,
|
||||
path,
|
||||
};
|
||||
|
||||
@@ -3,6 +3,7 @@ import { REPO_ROOT } from "@/constants.ts";
|
||||
|
||||
import * as path from "@std/path";
|
||||
import Handlebars from "handlebars";
|
||||
import { formatListOfItems } from "@/utils.ts";
|
||||
|
||||
// we can have some nice things :)
|
||||
Handlebars.registerHelper(
|
||||
@@ -16,19 +17,15 @@ Handlebars.registerHelper(
|
||||
|
||||
const heading = (
|
||||
name: UserstylesSchema.Name,
|
||||
link: UserstylesSchema.ApplicationLink,
|
||||
link: UserstylesSchema.Link,
|
||||
supports: UserstylesSchema.Supports | undefined,
|
||||
) => {
|
||||
const [nameArray, linkArray] = [[name].flat(), [link].flat()];
|
||||
|
||||
if (nameArray.length !== linkArray.length) {
|
||||
throw new Error(
|
||||
'The "name" and "app-link" arrays must have the same length',
|
||||
);
|
||||
}
|
||||
|
||||
return nameArray.map((title, i) => {
|
||||
return { title, url: linkArray[i] };
|
||||
});
|
||||
return [{ title: name, url: link }].concat(
|
||||
Object.values(supports ?? {}).map(({ name, link }) => ({
|
||||
title: name,
|
||||
url: link,
|
||||
})),
|
||||
);
|
||||
};
|
||||
|
||||
function getNameWithGitHubUrl(
|
||||
@@ -60,7 +57,9 @@ export function generateStyleReadmes(userstyles: UserstylesSchema.Userstyles) {
|
||||
slug,
|
||||
{
|
||||
name,
|
||||
readme,
|
||||
link,
|
||||
note,
|
||||
supports,
|
||||
"current-maintainers": currentMaintainers,
|
||||
"past-maintainers": pastMaintainers,
|
||||
},
|
||||
@@ -68,10 +67,14 @@ export function generateStyleReadmes(userstyles: UserstylesSchema.Userstyles) {
|
||||
) => {
|
||||
console.log(`Generating README for styles/${slug}...`);
|
||||
const readmeContent = Handlebars.compile(stylesReadmeContent)({
|
||||
heading: heading(name, readme["app-link"]),
|
||||
heading: heading(name, link, supports),
|
||||
supportedWebsites: formatListOfItems(
|
||||
Object.values(supports ?? {}).map(({ name, link }) =>
|
||||
`[${name}](${link})`
|
||||
),
|
||||
),
|
||||
slug,
|
||||
note: readme.note,
|
||||
faq: readme.faq,
|
||||
note,
|
||||
collaborators: {
|
||||
currentMaintainers: getNameWithGitHubUrl(currentMaintainers),
|
||||
pastMaintainers: getNameWithGitHubUrl(pastMaintainers),
|
||||
|
||||
@@ -13,12 +13,14 @@
|
||||
<a href="https://raw.githubusercontent.com/catppuccin/userstyles/main/styles/{{ slug }}/catppuccin.user.less"><img src="https://img.shields.io/badge/stylus-install-cba6f7?colorA=363a4f&style=for-the-badge"></a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<img src="preview.webp"/>
|
||||
</p>
|
||||
|
||||
## Usage
|
||||
|
||||
{{#if supportedWebsites}}
|
||||
> [!IMPORTANT]
|
||||
> This userstyle also applies to {{ supportedWebsites }}.
|
||||
|
||||
{{/if~}}
|
||||
|
||||
See [the userstyle usage instructions](../../docs/USAGE.md).
|
||||
|
||||
{{#if note}}
|
||||
@@ -26,14 +28,6 @@ See [the userstyle usage instructions](../../docs/USAGE.md).
|
||||
> {{{ note }}}
|
||||
{{/if}}
|
||||
|
||||
{{#if faq}}
|
||||
## 🙋 FAQ
|
||||
{{#each faq}}
|
||||
- Q: {{{ question }}}\
|
||||
A: {{{ answer }}}
|
||||
{{/each}}
|
||||
{{/if}}
|
||||
|
||||
{{#if collaborators.currentMaintainers.length}}
|
||||
## 💝 Current {{pluralize collaborators.currentMaintainers 'Maintainer'}}
|
||||
{{#each collaborators.currentMaintainers}}
|
||||
@@ -61,4 +55,4 @@ This userstyle currently lacks maintainers, and may not work correctly. Please f
|
||||
Copyright © 2021-present <a href="https://github.com/catppuccin" target="_blank">Catppuccin Org</a>
|
||||
</p>
|
||||
|
||||
<!-- AUTOGEN:README END -->
|
||||
<!-- AUTOGEN:README END -->
|
||||
@@ -8,7 +8,6 @@ import { log } from "@/logger.ts";
|
||||
|
||||
const requiredFiles = [
|
||||
"catppuccin.user.less",
|
||||
"preview.webp",
|
||||
];
|
||||
|
||||
export async function checkForMissingFiles() {
|
||||
|
||||
@@ -153,8 +153,9 @@ export async function verifyMetadata(
|
||||
|
||||
function generateAssertions(userstyle: string, userstyles: Userstyles) {
|
||||
const prefix = "https://github.com/catppuccin/userstyles";
|
||||
const userstyleData = userstyles[userstyle];
|
||||
|
||||
if (!userstyles[userstyle]) {
|
||||
if (!userstyleData) {
|
||||
log.error(
|
||||
`Metadata section for \`${color.bold(userstyle)}\` userstyle is missing`,
|
||||
{
|
||||
@@ -166,16 +167,18 @@ function generateAssertions(userstyle: string, userstyles: Userstyles) {
|
||||
|
||||
return {
|
||||
name: `${
|
||||
Array.isArray(userstyles[userstyle].name)
|
||||
? (userstyles[userstyle].name as string[]).join("/")
|
||||
: userstyles[userstyle].name
|
||||
[
|
||||
userstyleData.name,
|
||||
...Object.values(userstyleData.supports ?? {}).map(({ name }) => name),
|
||||
].join("/")
|
||||
} Catppuccin`,
|
||||
namespace: `github.com/catppuccin/userstyles/styles/${userstyle}`,
|
||||
homepageURL: `${prefix}/tree/main/styles/${userstyle}`,
|
||||
description: `Soothing pastel theme for ${
|
||||
Array.isArray(userstyles[userstyle].name)
|
||||
? formatListOfItems(userstyles[userstyle].name as string[])
|
||||
: userstyles[userstyle].name
|
||||
formatListOfItems([
|
||||
userstyleData.name,
|
||||
...Object.values(userstyleData.supports ?? {}).map(({ name }) => name),
|
||||
])
|
||||
}`,
|
||||
author: "Catppuccin",
|
||||
updateURL: `${prefix}/raw/main/styles/${userstyle}/catppuccin.user.less`,
|
||||
|
||||
Vendored
+26
-35
@@ -1,9 +1,13 @@
|
||||
// deno-fmt-ignore-file
|
||||
|
||||
/**
|
||||
* The name of the userstyle(s).
|
||||
* The name of the userstyle.
|
||||
*/
|
||||
export type Name = [string, string, ...string[]] | string;
|
||||
export type Name = string;
|
||||
/**
|
||||
* The url of the website that is being themed.
|
||||
*/
|
||||
export type Link = string;
|
||||
/**
|
||||
* The categories that fit the userstyle the most, the first category is the primary category which the userstyle will be listed under on the README.
|
||||
*
|
||||
@@ -71,36 +75,13 @@ export type Color =
|
||||
*/
|
||||
export type Icon = string;
|
||||
/**
|
||||
* The hyperlink of the app that is being themed.
|
||||
*/
|
||||
export type ApplicationLink = [string, string, ...string[]] | string;
|
||||
/**
|
||||
* An additional note for the Usage section of the userstyle README.
|
||||
* An additional note that users should read.
|
||||
*/
|
||||
export type Note = string;
|
||||
/**
|
||||
* The FAQ section of the userstyle README.
|
||||
*
|
||||
* @minItems 1
|
||||
* The name of the website.
|
||||
*/
|
||||
export type FAQ = [
|
||||
{
|
||||
question: Question;
|
||||
answer: Answer;
|
||||
},
|
||||
...{
|
||||
question: Question;
|
||||
answer: Answer;
|
||||
}[]
|
||||
];
|
||||
/**
|
||||
* A question that a user may have about the userstyle.
|
||||
*/
|
||||
export type Question = string;
|
||||
/**
|
||||
* An answer to the question about the userstyle.
|
||||
*/
|
||||
export type Answer = string;
|
||||
export type WebsiteName = string;
|
||||
/**
|
||||
* List of all active maintainers for this userstyle.
|
||||
*/
|
||||
@@ -123,7 +104,7 @@ export interface UserstylesSchema {
|
||||
collaborators?: AllCollaborators;
|
||||
}
|
||||
/**
|
||||
* All userstyles in the Catppuccin org.
|
||||
* All userstyles in the Catppuccin organisation.
|
||||
*/
|
||||
export interface Userstyles {
|
||||
[k: string]: Userstyle;
|
||||
@@ -136,18 +117,28 @@ export interface Userstyles {
|
||||
*/
|
||||
export interface Userstyle {
|
||||
name: Name;
|
||||
link: Link;
|
||||
categories: Categories;
|
||||
color: Color;
|
||||
icon?: Icon;
|
||||
readme: README;
|
||||
note?: Note;
|
||||
supports?: Supports;
|
||||
"current-maintainers": CurrentMaintainers;
|
||||
"past-maintainers"?: PastMaintainers;
|
||||
}
|
||||
/**
|
||||
* Options to help in the auto-generation of the userstyle README.
|
||||
* All websites that the userstyle also supports.
|
||||
*/
|
||||
export interface README {
|
||||
"app-link": ApplicationLink;
|
||||
note?: Note;
|
||||
faq?: FAQ;
|
||||
export interface Supports {
|
||||
[k: string]: Website;
|
||||
}
|
||||
/**
|
||||
* The unique identifier of the supported website, usually the name of the website lowercased.
|
||||
*
|
||||
* This interface was referenced by `Supports`'s JSON-Schema definition
|
||||
* via the `patternProperty` "[A-Za-z0-9_\-]".
|
||||
*/
|
||||
export interface Website {
|
||||
name: WebsiteName;
|
||||
link: Link;
|
||||
}
|
||||
+86
-105
@@ -7,7 +7,7 @@
|
||||
"$id": "#userstyles",
|
||||
"title": "Userstyles",
|
||||
"type": "object",
|
||||
"description": "All userstyles in the Catppuccin org.",
|
||||
"description": "All userstyles in the Catppuccin organisation.",
|
||||
"patternProperties": {
|
||||
"[A-Za-z0-9_\\-]": {
|
||||
"$id": "#userstyles/userstyle",
|
||||
@@ -18,121 +18,58 @@
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"name": {
|
||||
"$id": "#userstyles/userstyle/name",
|
||||
"title": "Name",
|
||||
"description": "The name of the userstyle(s).",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"minItems": 2,
|
||||
"examples": [["AniList", "AniChart"]]
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"examples": ["YouTube"]
|
||||
}
|
||||
]
|
||||
"description": "The name of the userstyle.",
|
||||
"$ref": "#/$defs/name"
|
||||
},
|
||||
"link": {
|
||||
"$ref": "#/$defs/link"
|
||||
},
|
||||
"categories": {
|
||||
"$id": "#userstyles/userstyle/categories",
|
||||
"title": "Categories",
|
||||
"description": "The categories that fit the userstyle the most, the first category is the primary category which the userstyle will be listed under on the README.",
|
||||
"$ref": "#/$defs/categories"
|
||||
},
|
||||
"color": {
|
||||
"$id": "#userstyles/userstyle/color",
|
||||
"title": "Color",
|
||||
"description": "The fill color for the icon on the Catppuccin website, which should match the color used by Simple Icons. If the icon does not exist in Simple Icons, choose the most suitable color from the branding.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"rosewater",
|
||||
"flamingo",
|
||||
"pink",
|
||||
"mauve",
|
||||
"red",
|
||||
"maroon",
|
||||
"peach",
|
||||
"yellow",
|
||||
"green",
|
||||
"teal",
|
||||
"sky",
|
||||
"sapphire",
|
||||
"blue",
|
||||
"lavender",
|
||||
"text"
|
||||
],
|
||||
"examples": ["pink"]
|
||||
"$ref": "#/$defs/color"
|
||||
},
|
||||
"icon": {
|
||||
"$id": "#userstyles/userstyle/icon",
|
||||
"title": "Icon",
|
||||
"description": "The icon to use on the website. This should be the same name as the SVG file on https://simpleicons.org/. If a `.svg` suffix is present, it's taken from the local website repository resources.",
|
||||
"type": "string",
|
||||
"examples": ["twitch", "twitch.svg"]
|
||||
"$ref": "#/$defs/icon"
|
||||
},
|
||||
"readme": {
|
||||
"$id": "#userstyles/userstyle/readme",
|
||||
"title": "README",
|
||||
"description": "Options to help in the auto-generation of the userstyle README.",
|
||||
"note": {
|
||||
"$id": "#userstyles/userstyle/note",
|
||||
"title": "Note",
|
||||
"description": "An additional note that users should read.",
|
||||
"type": "string"
|
||||
},
|
||||
"supports": {
|
||||
"$id": "#userstyles/userstyle/supports",
|
||||
"title": "Supports",
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"app-link": {
|
||||
"$id": "#userstyles/userstyle/readme/app-link",
|
||||
"title": "Application Link",
|
||||
"description": "The hyperlink of the app that is being themed.",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
},
|
||||
"minItems": 2,
|
||||
"examples": [
|
||||
["https://anilist.co", "https://anichart.net"]
|
||||
]
|
||||
"description": "All websites that the userstyle also supports.",
|
||||
"patternProperties": {
|
||||
"[A-Za-z0-9_\\-]": {
|
||||
"$id": "#userstyles/userstyle/supports/website",
|
||||
"title": "Website",
|
||||
"type": "object",
|
||||
"description": "The unique identifier of the supported website, usually the name of the website lowercased.",
|
||||
"examples": ["anichart"],
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"name": {
|
||||
"$id": "#userstyles/userstyle/supports/website/name",
|
||||
"title": "Website Name",
|
||||
"description": "The name of the website.",
|
||||
"examples": ["AniChart"],
|
||||
"$ref": "#/$defs/name"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"examples": ["https://github.com"]
|
||||
"link": {
|
||||
"$ref": "#/$defs/link"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"name",
|
||||
"link"
|
||||
]
|
||||
},
|
||||
"note": {
|
||||
"$id": "#userstyles/userstyle/readme/note",
|
||||
"title": "Note",
|
||||
"description": "An additional note for the Usage section of the userstyle README.",
|
||||
"type": "string"
|
||||
},
|
||||
"faq": {
|
||||
"$id": "#userstyles/userstyle/readme/faq",
|
||||
"title": "FAQ",
|
||||
"description": "The FAQ section of the userstyle README.",
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"question": {
|
||||
"type": "string",
|
||||
"title": "Question",
|
||||
"description": "A question that a user may have about the userstyle."
|
||||
},
|
||||
"answer": {
|
||||
"type": "string",
|
||||
"title": "Answer",
|
||||
"description": "An answer to the question about the userstyle."
|
||||
}
|
||||
},
|
||||
"required": ["question", "answer"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"required": ["app-link"]
|
||||
}
|
||||
},
|
||||
"current-maintainers": {
|
||||
"$id": "#userstyles/userstyle/current-maintainers",
|
||||
@@ -153,7 +90,7 @@
|
||||
"required": [
|
||||
"name",
|
||||
"categories",
|
||||
"readme",
|
||||
"link",
|
||||
"color",
|
||||
"current-maintainers"
|
||||
]
|
||||
@@ -170,6 +107,49 @@
|
||||
}
|
||||
},
|
||||
"$defs": {
|
||||
"name": {
|
||||
"$id": "#name",
|
||||
"title": "Name",
|
||||
"type": "string",
|
||||
"examples": ["YouTube"]
|
||||
},
|
||||
"link": {
|
||||
"$id": "#link",
|
||||
"title": "Link",
|
||||
"description": "The url of the website that is being themed.",
|
||||
"type": "string"
|
||||
},
|
||||
"color": {
|
||||
"$id": "#color",
|
||||
"title": "Color",
|
||||
"description": "The fill color for the icon on the Catppuccin website, which should match the color used by Simple Icons. If the icon does not exist in Simple Icons, choose the most suitable color from the branding.",
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"rosewater",
|
||||
"flamingo",
|
||||
"pink",
|
||||
"mauve",
|
||||
"red",
|
||||
"maroon",
|
||||
"peach",
|
||||
"yellow",
|
||||
"green",
|
||||
"teal",
|
||||
"sky",
|
||||
"sapphire",
|
||||
"blue",
|
||||
"lavender",
|
||||
"text"
|
||||
],
|
||||
"examples": ["pink"]
|
||||
},
|
||||
"icon": {
|
||||
"$id": "#icon",
|
||||
"title": "Icon",
|
||||
"description": "The icon to use on the website. This should be the same name as the SVG file on https://simpleicons.org/. If a `.svg` suffix is present, it's taken from the local website repository resources.",
|
||||
"type": "string",
|
||||
"examples": ["twitch", "twitch.svg"]
|
||||
},
|
||||
"collaborators": {
|
||||
"$id": "#collaborators",
|
||||
"description": "The GitHub username of the collaborator.",
|
||||
@@ -181,7 +161,8 @@
|
||||
"categories": {
|
||||
"$id": "#categories",
|
||||
"type": "array",
|
||||
"description": "The categories that fit the port the most, the first category is the primary category which the port will be listed under on the README.",
|
||||
"title": "Categories",
|
||||
"description": "The categories that fit the userstyle the most, the first category is the primary category which the userstyle will be listed under on the README.",
|
||||
"minItems": 1,
|
||||
"maxItems": 3,
|
||||
"items": {
|
||||
|
||||
+153
-270
File diff suppressed because it is too large.
Load diff
@@ -130,6 +130,8 @@ export async function getCategoriesData(): Promise<
|
||||
* formatListOfItems(['x', 'y', 'z']); // 'x, y, and z'
|
||||
*/
|
||||
export function formatListOfItems(items: unknown[]): string {
|
||||
// If there are no items, return an empty string.
|
||||
if (items.length === 0) return "";
|
||||
// If there are two items, connect them with an "and".
|
||||
if (items.length === 2) return items.join(" and ");
|
||||
// Otherwise, there is either just one item or more than two items.
|
||||
|
||||
Reference in new issue
Block a user