1
0
mirror of https://github.com/simple-icons/simple-icons.git synced 2024-11-26 01:00:27 +02:00

Fix number of icons not updated on README when decreased (#11537)

This commit is contained in:
Álvaro Mondéjar Rubio 2024-07-26 18:19:45 +02:00 committed by GitHub
parent e7ebb48de8
commit 1fd47d646b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -32,12 +32,12 @@ try {
const overNIconsInReadme = Number.parseInt(match[1], 10); const overNIconsInReadme = Number.parseInt(match[1], 10);
const iconsData = await getIconsData(); const iconsData = await getIconsData();
const nIcons = iconsData.length; const nIcons = iconsData.length;
const newNIcons = overNIconsInReadme + updateRange; const nIconsRounded = Math.floor(nIcons / updateRange) * updateRange;
if (nIcons > newNIcons) { if (overNIconsInReadme !== nIconsRounded) {
const newContent = readmeContent.replace( const newContent = readmeContent.replace(
regexMatcher, regexMatcher,
`Over ${newNIcons} `, `Over ${nIconsRounded} `,
); );
await fs.writeFile(readmeFile, newContent); await fs.writeFile(readmeFile, newContent);
} }