mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-08-04 02:08:17 +00:00
docs: add sponsoring section to readme (#1620)
* docs: add sponsoring section to readme * build: generate readme * docs: wording * docs: wording also mention contributors * docs: wording also mention contributors
This commit is contained in:
parent
59fda809d5
commit
d7424abed8
5 changed files with 135 additions and 4 deletions
|
@ -63,6 +63,72 @@ const convert = async (inp, out, opts) => {
|
|||
await fs.promises.writeFile(output, outputContent);
|
||||
};
|
||||
|
||||
// todo: generate me using typlite.
|
||||
const maintainerMd = async () => {
|
||||
const maintainers = JSON.parse(yarn(`--silent maintainers --input=action=maintainers`, "pipe"));
|
||||
const features = JSON.parse(yarn(`--silent maintainers --input=action=features`, "pipe"));
|
||||
|
||||
const output = [];
|
||||
|
||||
output.push("<!-- This file is generated by scripts/link-docs.mjs. Do not edit manually. -->\n");
|
||||
output.push("# Tinymist Maintainers\n\n");
|
||||
output.push(
|
||||
"Tinymist [ˈtaɪni mɪst] is an integrated language service for [Typst](https://typst.app/) [taɪpst].",
|
||||
);
|
||||
|
||||
output.push(
|
||||
"\nThis page is generated from [./MAINTAINERS.typ](./MAINTAINERS.typ) and renders information of [maintainers](#maintainers) and [features.](#features)\n",
|
||||
);
|
||||
|
||||
output.push("## Maintainers\n");
|
||||
|
||||
const italicIt = (it) => `*${it}*`;
|
||||
const featureLink = (it) => {
|
||||
const feature = features.find((f) => f.name === it);
|
||||
if (feature) {
|
||||
return `[${it}](#${it.replace(/\s+/g, "-").toLowerCase()})`;
|
||||
}
|
||||
return it;
|
||||
};
|
||||
const fsPath = (it) => {
|
||||
if (!fs.existsSync(it)) {
|
||||
throw new Error(`Path ${it} does not exist!`);
|
||||
}
|
||||
return `[\`${it}\`](./${it})`;
|
||||
};
|
||||
|
||||
for (const maintainer of maintainers) {
|
||||
output.push(`- [**${maintainer["name"]}**](https://github.com/${maintainer["github-name"]})`);
|
||||
output.push(` - Email: ${maintainer.email}`);
|
||||
if (maintainer.maintains.length > 0) {
|
||||
const rendered = maintainer.maintains.map(featureLink).map(italicIt);
|
||||
if (rendered.length > 1) {
|
||||
const last = rendered.pop();
|
||||
output.push(` - Maintains: ${rendered.join(", ")}, and ${last}`);
|
||||
} else {
|
||||
output.push(` - Maintains: ${rendered.join(", ")}`);
|
||||
}
|
||||
}
|
||||
output.push("");
|
||||
}
|
||||
|
||||
output.push("## Features\n");
|
||||
for (const feature of features) {
|
||||
output.push(`### ${feature.name}`);
|
||||
output.push(`${feature.description}`);
|
||||
output.push(`- Scope: ${feature.scope.map(fsPath).join(", ")}`);
|
||||
}
|
||||
|
||||
const outPath = resolve(root, "MAINTAINERS.md");
|
||||
const outputContent = output.join("\n");
|
||||
if (dry) {
|
||||
console.log(content);
|
||||
return;
|
||||
}
|
||||
|
||||
await fs.promises.writeFile(outPath, outputContent);
|
||||
};
|
||||
|
||||
const main = async () => {
|
||||
await Promise.all([
|
||||
convert("docs/tinymist/introduction.typ", "README.md", {
|
||||
|
@ -89,6 +155,7 @@ const main = async () => {
|
|||
convert("docs/tinymist/frontend/zed.typ", "editors/zed/README.md", {
|
||||
before: "# Tinymist Zed Support for Typst\n\n",
|
||||
}),
|
||||
maintainerMd(),
|
||||
]);
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue