diff --git a/scripts/generateChangedIconsCommentMarkup.mjs b/scripts/generateChangedIconsCommentMarkup.mjs index db44a5b60..0b9536103 100644 --- a/scripts/generateChangedIconsCommentMarkup.mjs +++ b/scripts/generateChangedIconsCommentMarkup.mjs @@ -14,19 +14,17 @@ const changedFiles = changedFilesPathString .filter((file, idx, arr) => arr.indexOf(file) === idx); const getImageTagsByFiles = (files, getBaseUrl, width) => - files - .map((file) => { - const svgContent = fs.readFileSync(path.join(process.cwd(), file), 'utf-8'); - const strippedAttrsSVG = svgContent.replace(/]*>/, ''); - const minifiedSvg = minifySvg(strippedAttrsSVG); + files.map((file) => { + const svgContent = fs.readFileSync(path.join(process.cwd(), file), 'utf-8'); + const strippedAttrsSVG = svgContent.replace(/]*>/, ''); + const minifiedSvg = minifySvg(strippedAttrsSVG); - const base64 = Buffer.from(minifiedSvg).toString('base64'); - const url = getBaseUrl(file); - const widthAttr = width ? `width="${width}"` : ''; + const base64 = Buffer.from(minifiedSvg).toString('base64'); + const url = getBaseUrl(file); + const widthAttr = width ? `width="${width}"` : ''; - return `${file}`; - }) - .join(''); + return `${file}`; + }); const svgFiles = readSvgDirectory(ICONS_DIR).map((file) => `icons/${file}`); @@ -35,29 +33,32 @@ const iconsFilteredByName = (search) => svgFiles.filter((file) => file.includes( const cohesionRandomImageTags = getImageTagsByFiles( shuffle(svgFiles).slice(0, changedFiles.length), () => `${BASE_URL}/stroke-width/2`, -); +).join(''); const cohesionSquaresImageTags = getImageTagsByFiles( shuffle(iconsFilteredByName('square')).slice(0, changedFiles.length), () => `${BASE_URL}/stroke-width/2`, -); +).join(''); const changeFiles1pxStrokeImageTags = getImageTagsByFiles( changedFiles, () => `${BASE_URL}/stroke-width/1`, -); +).join(''); const changeFiles2pxStrokeImageTags = getImageTagsByFiles( changedFiles, () => `${BASE_URL}/stroke-width/2`, -); +).join(''); const changeFiles3pxStrokeImageTags = getImageTagsByFiles( changedFiles, () => `${BASE_URL}/stroke-width/3`, -); +).join(''); -const changeFilesLowDPIImageTags = getImageTagsByFiles(changedFiles, () => `${BASE_URL}/dpi/24`); +const changeFilesLowDPIImageTags = getImageTagsByFiles( + changedFiles, + () => `${BASE_URL}/dpi/24`, +).join(' '); const changeFilesXRayImageTags = getImageTagsByFiles( changedFiles, @@ -67,7 +68,7 @@ const changeFilesXRayImageTags = getImageTagsByFiles( return `${BASE_URL}/${iconName}`; }, 400, -); +).join(' '); const commentMarkup = `\ ### Added or changed icons