gen-readme: add field "note"; make "demo" optional
This commit is contained in:
parent
f5e0d793b6
commit
bba5b9d2d0
|
|
@ -10,6 +10,7 @@ type Item = {
|
||||||
demo: string;
|
demo: string;
|
||||||
github: string;
|
github: string;
|
||||||
name: string;
|
name: string;
|
||||||
|
note: string;
|
||||||
screenshots: string[];
|
screenshots: string[];
|
||||||
website: string;
|
website: string;
|
||||||
};
|
};
|
||||||
|
|
@ -32,13 +33,14 @@ const readData = async (...args: string[]): Promise<string> => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderItem = (
|
const renderItem = (
|
||||||
{ demo, github, name, screenshots, website }: Item,
|
{ demo, github, name, note, screenshots, website }: Item,
|
||||||
): string => {
|
): string => {
|
||||||
const screenshotMarkdown = screenshots.map((filename) =>
|
const screenshotMarkdown = screenshots.map((filename) =>
|
||||||
`[](screenshot/${filename})`
|
`[](screenshot/${filename})`
|
||||||
).join("\n");
|
).join("\n");
|
||||||
|
|
||||||
return `### ${name}\n\n` +
|
return `### ${name}\n\n` +
|
||||||
|
(note === "" ? "" : `${note}\n\n`) +
|
||||||
(website === "" ? "" : `* [Website](${website})\n`) +
|
(website === "" ? "" : `* [Website](${website})\n`) +
|
||||||
(github === ""
|
(github === ""
|
||||||
? ""
|
? ""
|
||||||
|
|
@ -47,7 +49,8 @@ const renderItem = (
|
||||||
` ` +
|
` ` +
|
||||||
` ` +
|
` ` +
|
||||||
`\n`) +
|
`\n`) +
|
||||||
`* [Demo](${demo})\n\n${screenshotMarkdown}`;
|
(demo === "" ? "" : `* [Demo](${demo})\n\n`) +
|
||||||
|
screenshotMarkdown;
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
@ -66,6 +69,7 @@ try {
|
||||||
demo: await readData(sectionDir, itemDir, "demo"),
|
demo: await readData(sectionDir, itemDir, "demo"),
|
||||||
github: await readData(sectionDir, itemDir, "github"),
|
github: await readData(sectionDir, itemDir, "github"),
|
||||||
name: await readData(sectionDir, itemDir, "name"),
|
name: await readData(sectionDir, itemDir, "name"),
|
||||||
|
note: await readData(sectionDir, itemDir, "note"),
|
||||||
screenshots: (await readData(sectionDir, itemDir, "screenshots")).split(
|
screenshots: (await readData(sectionDir, itemDir, "screenshots")).split(
|
||||||
"\n",
|
"\n",
|
||||||
),
|
),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue