mirror of
https://github.com/anuraghazra/github-readme-stats.git
synced 2025-03-07 15:08:07 +08:00
fix: fix generate-theme-doc bug
This commit is contained in:
parent
107f7ca52c
commit
0de23d3762
@ -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] | | |`);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user