fix: fix generate-theme-doc bug

This commit is contained in:
rickstaa 2022-09-24 10:33:19 +02:00
parent 107f7ca52c
commit 0de23d3762
No known key found for this signature in database
GPG Key ID: 0BD7401D30D23E53

View File

@ -1,5 +1,5 @@
import fs from "fs";
import { themes } from "../themes/index";
import { themes } from "../themes/index.js";
const TARGET_FILE = "./themes/README.md";
const REPO_CARD_LINKS_FLAG = "<!-- REPO_CARD_LINKS -->";
@ -65,14 +65,14 @@ const createTableItem = ({ link, label, isRepoCard }) => {
};
const generateTable = ({ isRepoCard }) => {
const rows = [];
const themes = Object.keys(themes).filter(
const themesFiltered = Object.keys(themes).filter(
(name) => name !== (!isRepoCard ? "default_repocard" : "default"),
);
for (let i = 0; i < themes.length; i += 3) {
const one = themes[i];
const two = themes[i + 1];
const three = themes[i + 2];
for (let i = 0; i < themesFiltered.length; i += 3) {
const one = themesFiltered[i];
const two = themesFiltered[i + 1];
const three = themesFiltered[i + 2];
let tableItem1 = createTableItem({ link: one, label: one, isRepoCard });
let tableItem2 = createTableItem({ link: two, label: two, isRepoCard });
@ -84,7 +84,7 @@ const generateTable = ({ isRepoCard }) => {
rows.push(`| ${tableItem1} | ${tableItem2} | ${tableItem3} |`);
// if it's the last row & the row has no empty space push a new row
if (three && i + 3 === themes.length) {
if (three && i + 3 === themesFiltered.length) {
rows.push(`| [Add your theme][add-theme] | | |`);
}
}