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
@@ -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,
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user