Skip to content

Commit

Permalink
Merge branch 'catppuccin:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
orangci authored Oct 28, 2024
2 parents 5470a63 + ec6b63a commit 6a16978
Show file tree
Hide file tree
Showing 35 changed files with 515 additions and 274 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
/styles/instagram @GenShibe
/styles/invokeai @ryanccn
/styles/jisho @Lichthagel
/styles/keybr.com @TadoTheMiner
/styles/keyoxide @uncenter
/styles/lastfm @AnubisNekhet
/styles/lemmy @Gandalf-the-Blue
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/userstyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,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: ["lbl:advent-of-code", "lbl:alternativeto", "lbl:amplenote", "lbl:anilist", "lbl:arch-wiki", "lbl:boringproxy", "lbl:brave-search", "lbl:bsky", "lbl:bstats", "lbl:canvas-lms", "lbl:chatgpt", "lbl:chatreplay", "lbl:chess.com", "lbl:cinny", "lbl:codeberg", "lbl:cobalt", "lbl:crates.io", "lbl:crowdin", "lbl:deepl", "lbl:docs.rs", "lbl:duckduckgo", "lbl:ecosia", "lbl:elk", "lbl:freedesktop", "lbl:formative", "lbl:github", "lbl:gmail", "lbl:go.dev", "lbl:google", "lbl:google-drive", "lbl:google-photos", "lbl:graphite", "lbl:google-gemini", "lbl:hackage", "lbl:hacker-news", "lbl:have-i-been-pwned", "lbl:holodex", "lbl:home-manager-options-search", "lbl:homepage", "lbl:hoppscotch", "lbl:learn-x-in-y-minutes", "lbl:hyperpipe", "lbl:ichi.moe", "lbl:inoreader", "lbl:instagram", "lbl:invidious", "lbl:invokeai", "lbl:jisho", "lbl:keyoxide", "lbl:lastfm", "lbl:lemmy", "lbl:libreddit", "lbl:lichess", "lbl:lingva", "lbl:linkedin", "lbl:listenbrainz", "lbl:mastodon", "lbl:mdbook", "lbl:mdn", "lbl:modrinth", "lbl:microsoft-word", "lbl:migadu-webmail", "lbl:minesweeper", "lbl:namemc", "lbl:nitter", "lbl:nixos-search", "lbl:wiki.nixos.org", "lbl:npm", "lbl:ollama", "lbl:openmediavault", "lbl:paste.rs", "lbl:perplexity", "lbl:phanpy", "lbl:picrew", "lbl:pinterest", "lbl:planet-minecraft", "lbl:porkbun", "lbl:pronouns.page", "lbl:proton", "lbl:pypi", "lbl:quizlet", "lbl:raindrop", "lbl:reddit", "lbl:rentry.co", "lbl:searxng", "lbl:shinigami-eyes", "lbl:snapchat-web", "lbl:spotify-web", "lbl:stack-overflow", "lbl:startpage", "lbl:stylus", "lbl:substack", "lbl:syncthing", "lbl:tabnews", "lbl:tldraw", "lbl:trinket", "lbl:tuta", "lbl:twitch", "lbl:twitter", "lbl:vercel", "lbl:vikunja", "lbl:web.dev", "lbl:whatsapp-web", "lbl:wikipedia", "lbl:wikiwand", "lbl:youtube"]
options: ["lbl:advent-of-code", "lbl:alternativeto", "lbl:amplenote", "lbl:anilist", "lbl:arch-wiki", "lbl:boringproxy", "lbl:brave-search", "lbl:bsky", "lbl:bstats", "lbl:canvas-lms", "lbl:chatgpt", "lbl:chatreplay", "lbl:chess.com", "lbl:cinny", "lbl:codeberg", "lbl:cobalt", "lbl:crates.io", "lbl:crowdin", "lbl:deepl", "lbl:docs.rs", "lbl:duckduckgo", "lbl:ecosia", "lbl:elk", "lbl:freedesktop", "lbl:formative", "lbl:github", "lbl:gmail", "lbl:go.dev", "lbl:google", "lbl:google-drive", "lbl:google-photos", "lbl:graphite", "lbl:google-gemini", "lbl:hackage", "lbl:hacker-news", "lbl:have-i-been-pwned", "lbl:holodex", "lbl:home-manager-options-search", "lbl:homepage", "lbl:hoppscotch", "lbl:learn-x-in-y-minutes", "lbl:hyperpipe", "lbl:ichi.moe", "lbl:inoreader", "lbl:instagram", "lbl:invidious", "lbl:invokeai", "lbl:jisho", "lbl:keybr.com", "lbl:keyoxide", "lbl:lastfm", "lbl:lemmy", "lbl:libreddit", "lbl:lichess", "lbl:lingva", "lbl:linkedin", "lbl:listenbrainz", "lbl:mastodon", "lbl:mdbook", "lbl:mdn", "lbl:modrinth", "lbl:microsoft-word", "lbl:migadu-webmail", "lbl:minesweeper", "lbl:namemc", "lbl:nitter", "lbl:nixos-search", "lbl:wiki.nixos.org", "lbl:npm", "lbl:ollama", "lbl:openmediavault", "lbl:paste.rs", "lbl:perplexity", "lbl:phanpy", "lbl:picrew", "lbl:pinterest", "lbl:planet-minecraft", "lbl:porkbun", "lbl:pronouns.page", "lbl:proton", "lbl:pypi", "lbl:quizlet", "lbl:raindrop", "lbl:reddit", "lbl:rentry.co", "lbl:searxng", "lbl:shinigami-eyes", "lbl:snapchat-web", "lbl:spotify-web", "lbl:stack-overflow", "lbl:startpage", "lbl:stylus", "lbl:substack", "lbl:syncthing", "lbl:tabnews", "lbl:tldraw", "lbl:trinket", "lbl:tuta", "lbl:twitch", "lbl:twitter", "lbl:vercel", "lbl:vikunja", "lbl:web.dev", "lbl:whatsapp-web", "lbl:wikipedia", "lbl:wikiwand", "lbl:youtube"]
validations:
required: true
- type: textarea
Expand Down
2 changes: 2 additions & 0 deletions .github/issue-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ invokeai:
- '/lbl:invokeai(,.*)?$/gm'
jisho:
- '/lbl:jisho(,.*)?$/gm'
keybr.com:
- '/lbl:keybr.com(,.*)?$/gm'
keyoxide:
- '/lbl:keyoxide(,.*)?$/gm'
lastfm:
Expand Down
3 changes: 3 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@
- name: jisho
description: Jisho
color: '#a6da95'
- name: keybr.com
description: keybr.com
color: '#cad3f5'
- name: keyoxide
description: Keyoxide
color: '#c6a0f6'
Expand Down
1 change: 1 addition & 0 deletions .github/pr-labeler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ instagram: styles/instagram/**/*
invidious: styles/invidious/**/*
invokeai: styles/invokeai/**/*
jisho: styles/jisho/**/*
keybr.com: styles/keybr.com/**/*
keyoxide: styles/keyoxide/**/*
lastfm: styles/lastfm/**/*
lemmy: styles/lemmy/**/*
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/generate-format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
deno-version: v1.x

- name: Generate health files
run: deno task ci:generate
run: deno task generate

- name: Commit changes
uses: EndBug/add-and-commit@v9
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ jobs:
with:
deno-version: v1.x

- name: Generate import file
run: deno task ci:generate-import
- name: Generate Stylus import file
run: deno task stylus-import

- name: Upload Release Artifacts
run: gh release upload --clobber all-userstyles-export ./dist/import.json
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/maintainers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ jobs:

- name: Sync maintainers
if: ${{ github.repository == 'catppuccin/userstyles' && github.ref == 'refs/heads/main' }}
run: deno task ci:sync-maintainers
run: deno task sync-maintainers
env:
GITHUB_TOKEN: ${{ secrets.USERSTYLES_TOKEN }}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ See [CONTRIBUTING.md](docs/CONTRIBUTING.md).
- [Have I Been Pwned](styles/have-i-been-pwned)
- [homepage](styles/homepage)
- [inoreader](styles/inoreader)
- [keybr.com](styles/keybr.com)
- [Microsoft Word](styles/microsoft-word)
- [openmediavault](styles/openmediavault)
- [Porkbun](styles/porkbun)
Expand Down
21 changes: 15 additions & 6 deletions deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"@std/path": "jsr:@std/path@^1.0.6",
"@std/yaml": "jsr:@std/yaml@^1.0.5",
"ajv": "npm:[email protected]",
"catppuccin-repo/": "https://raw.githubusercontent.com/catppuccin/catppuccin/d4f2666c2b04337f0a8632713de0889d9a7d332d/",
"@catppuccin/catppuccin/": "https://raw.githubusercontent.com/catppuccin/catppuccin/d4f2666c2b04337f0a8632713de0889d9a7d332d/",
"handlebars": "npm:[email protected]",
"json-schema-to-typescript": "npm:[email protected]",
"less": "npm:[email protected]",
Expand All @@ -25,13 +25,22 @@
"usercss-meta": "npm:[email protected]"
},
"tasks": {
"ci:generate": "deno run -A ./scripts/generate/main.ts",
"ci:generate-import": "deno run -A ./scripts/import-styles/main.ts",
"ci:sync-maintainers": "deno run -A ./scripts/sync-maintainers/main.ts",
"generate": "deno run -A ./scripts/generate/main.ts",
"stylus-import": "deno run -A ./scripts/stylus-import/main.ts",
"sync-maintainers": "deno run -A ./scripts/sync-maintainers/main.ts",
"lint": "deno run -A ./scripts/lint/main.ts",
"lint:fix": "deno task lint --fix",
"update-types": "deno run -A ./scripts/update-types.ts",
"update-types": "deno run -A ./scripts/types/update-types.ts",
"format": "deno run -A npm:[email protected] --write ."
},
"nodeModulesDir": true
"nodeModulesDir": true,
"fmt": {
"include": ["scripts/**/*.ts"]
},
"lint": {
"rules": {
"tags": ["recommended"],
"include": ["verbatim-module-syntax"]
}
}
}
3 changes: 3 additions & 0 deletions docs/userstyle-creation.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ To request a website to be themed, please create a [Port Request](https://github

### Creating userstyles

> [!IMPORTANT]
> Websites should be popular or otherwise commonly known by members of the Catppuccin community; personal or niche sites may not meet the criteria. If you are unsure if a website qualifies, consider creating a [discussion](https://github.com/catppuccin/catppuccin/discussions/new?category=port-requests) before submitting an initial PR.
To create a userstyle, follow the instructions below. If you run into any difficulties or have any questions, please check our [Tips and tricks](./tips-and-tricks.md) page first.

1. Fork this repository.
Expand Down
1 change: 0 additions & 1 deletion scripts/_prettier.ts

This file was deleted.

18 changes: 18 additions & 0 deletions scripts/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import PORTS_SCHEMA from "@catppuccin/catppuccin/resources/ports.schema.json" with {
type: "json",
};
import USERSTYLES_SCHEMA from "@/userstyles.schema.json" with {
type: "json",
};

import * as path from "@std/path";

const ROOT = import.meta.dirname;
if (!ROOT) throw new Error("ROOT was not located.");

/**
* Absolute path to the repository.
*/
export const REPO_ROOT = path.join(ROOT, "..");

export { PORTS_SCHEMA, USERSTYLES_SCHEMA };
20 changes: 0 additions & 20 deletions scripts/deps.ts

This file was deleted.

63 changes: 33 additions & 30 deletions scripts/generate/labels.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { join } from "@std/path";
import type { UserstylesSchema } from "@/types/mod.ts";
import { REPO_ROOT } from "@/constants.ts";

import * as path from "@std/path";
import * as yaml from "@std/yaml";

import { REPO_ROOT } from "@/deps.ts";
import { updateFile } from "@/generate/utils.ts";
import { UserStylesSchema } from "@/types/mod.ts";
import { stringify } from "@std/yaml";
import { type ColorName, flavors } from "@catppuccin/palette";
import { writeWithPreamble } from "@/generate/utils.ts";

/**
* Macchiato color definitions as hex values.
Expand All @@ -17,12 +18,11 @@ const macchiatoHex = flavors.macchiato.colorEntries

const toIssueLabel = (slug: string | number) => `lbl:${slug}`;

export const syncIssueLabels = async (
userstyles: UserStylesSchema.Userstyles,
) => {
updateFile(
join(REPO_ROOT, ".github/issue-labeler.yml"),
stringify(
export async function syncIssueLabels(userstyles: UserstylesSchema.Userstyles) {
// .github/issue-labeler.yml
await writeWithPreamble(
path.join(REPO_ROOT, ".github/issue-labeler.yml"),
yaml.stringify(
Object.entries(userstyles)
.reduce((acc, [key]) => {
acc[key.toString()] = [`/${toIssueLabel(key)}(,.*)?$/gm`];
Expand All @@ -31,13 +31,14 @@ export const syncIssueLabels = async (
),
);

const userstyleIssueContent = Deno.readTextFileSync(join(
// .github/ISSUE_TEMPLATE/userstyle.yml
const userstyleIssueTemplate = Deno.readTextFileSync(path.join(
REPO_ROOT,
"scripts/generate/templates/userstyle-issue.yml",
));
Deno.writeTextFileSync(
join(REPO_ROOT, ".github/ISSUE_TEMPLATE/userstyle.yml"),
userstyleIssueContent.replace(
await Deno.writeTextFile(
path.join(REPO_ROOT, ".github/ISSUE_TEMPLATE/userstyle.yml"),
userstyleIssueTemplate.replace(
`"$LABELS"`,
`${
Object.entries(userstyles)
Expand All @@ -48,9 +49,9 @@ export const syncIssueLabels = async (
);

// .github/pr-labeler.yml
updateFile(
join(REPO_ROOT, ".github/pr-labeler.yml"),
stringify(
await writeWithPreamble(
path.join(REPO_ROOT, ".github/pr-labeler.yml"),
yaml.stringify(
Object.entries(userstyles)
.reduce((acc, [key]) => {
acc[`${key}`] = `styles/${key}/**/*`;
Expand All @@ -60,15 +61,17 @@ export const syncIssueLabels = async (
);

// .github/labels.yml
const syncLabelsContent = Object.entries(userstyles)
.map(([slug, style]) => {
return {
name: slug,
description: [style.name].flat().join(", "),
color: style.color ? macchiatoHex[style.color] : macchiatoHex.blue,
};
});
const syncLabels = join(REPO_ROOT, ".github/labels.yml");
// deno-lint-ignore no-explicit-any
await updateFile(syncLabels, stringify(syncLabelsContent as any));
};
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,
};
}),
),
);
}
42 changes: 11 additions & 31 deletions scripts/generate/main.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,14 @@
#!/usr/bin/env -S deno run -A
import { join } from "@std/path";
import { portsSchema, REPO_ROOT, userStylesSchema } from "@/deps.ts";
import type { PortsSchema, UserStylesSchema } from "@/types/mod.ts";
import * as path from "@std/path";
import { REPO_ROOT } from "@/constants.ts";

import { syncIssueLabels } from "@/generate/labels.ts";
import { generateMainReadme } from "@/generate/readme-repo.ts";
import { generateStyleReadmes } from "@/generate/readme-styles.ts";
import { updateFile } from "@/generate/utils.ts";
import { validateYaml } from "@/utils.ts";
import { writeWithPreamble } from "@/generate/utils.ts";
import { getPortsData, getUserstylesData } from "@/utils.ts";

const userstylesYaml = Deno.readTextFileSync(
join(REPO_ROOT, "scripts/userstyles.yml"),
);
const portsYaml = await fetch(
"https://raw.githubusercontent.com/catppuccin/catppuccin/main/resources/ports.yml",
).then((res) => res.text());

const [portsData, userstylesData] = await Promise.all([
await validateYaml<PortsSchema.PortsSchema>(
portsYaml,
portsSchema,
),
await validateYaml<UserStylesSchema.UserstylesSchema>(
userstylesYaml,
userStylesSchema,
),
]);

if (!userstylesData.userstyles) {
console.error("No userstyles found");
Deno.exit(1);
}
const userstylesData = getUserstylesData();
const portsData = await getPortsData();

/**
* Generate the main README.md, listing all ports as a table of contents
Expand Down Expand Up @@ -67,9 +45,11 @@ const maintainersCodeOwners = () => {
};
const userstylesStaffCodeOwners = () => {
const paths = ["/.github/", "/scripts/", "/template/"];
return paths.map((path) => `${path} @catppuccin/userstyles-staff`).join("\n");
return paths.map((path) => `${path} @catppuccin/userstyles-staff`).join(
"\n",
);
};
await updateFile(
join(REPO_ROOT, ".github/CODEOWNERS"),
await writeWithPreamble(
path.join(REPO_ROOT, ".github/CODEOWNERS"),
`${maintainersCodeOwners()}\n\n${userstylesStaffCodeOwners()}`,
);
38 changes: 24 additions & 14 deletions scripts/generate/readme-repo.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import { join } from "@std/path";
import type { PortsSchema, UserstylesSchema } from "@/types/mod.ts";
import { REPO_ROOT } from "@/constants.ts";

import * as path from "@std/path";
import Handlebars from "handlebars";

import { REPO_ROOT } from "@/deps.ts";
import { PortsSchema, UserStylesSchema } from "@/types/mod.ts";
import { updateFile, updateReadme } from "@/generate/utils.ts";
import { updateReadme } from "@/generate/utils.ts";

type MappedPorts = {
[k: string]: (
UserStylesSchema.Userstyle & { path: string }
UserstylesSchema.Userstyle & { path: string }
)[];
};

export const generateMainReadme = async (
userstyles: UserStylesSchema.Userstyles,
export async function generateMainReadme(
userstyles: UserstylesSchema.Userstyles,
portsData: PortsSchema.PortsSchema,
) => {
) {
if (!portsData.categories) throw ("Ports data is missing categories");

const categorized = Object.entries(userstyles)
Expand All @@ -23,7 +24,11 @@ export const generateMainReadme = async (
// only care about the first (primary) category in the categories array
acc[categories[0]] ??= [];

acc[categories[0]].push({ path: `styles/${slug}`, categories, ...port });
acc[categories[0]].push({
path: `styles/${slug}`,
categories,
...port,
});

// Sort by name, first array entry if necessary
acc[categories[0]].sort((a, b) =>
Expand Down Expand Up @@ -53,7 +58,13 @@ export const generateMainReadme = async (
emoji: meta.emoji,
name: meta.name,
ports: ports.map(
({ name, path, "current-maintainers": currentMaintainers }) => {
(
{
name,
path,
"current-maintainers": currentMaintainers,
},
) => {
return {
name: [name].flat(),
maintained: currentMaintainers.length > 0,
Expand All @@ -65,14 +76,13 @@ export const generateMainReadme = async (
}),
});

const readmePath = join(REPO_ROOT, "README.md");
await updateFile(
const readmePath = path.join(REPO_ROOT, "README.md");
await Deno.writeTextFile(
readmePath,
updateReadme({
readme: Deno.readTextFileSync(readmePath),
section: "userstyles",
newContent: portContent,
}),
false,
).catch((e) => console.error(e));
};
}
Loading

0 comments on commit 6a16978

Please sign in to comment.