From d255c6ac4eadeb0eaabdeee8d35d552ab1189377 Mon Sep 17 00:00:00 2001 From: Jakob Guddas Date: Wed, 6 Mar 2024 21:00:26 +0100 Subject: [PATCH] fix: readded gap between x-ray preview comment icons. (#1915) * fix: readded gap between x-ray preview comment icons. * feat: keep size 400px --------- Co-authored-by: Eric Fennis --- scripts/generateChangedIconsCommentMarkup.mjs | 37 ++++++++++--------- 1 file changed, 19 insertions(+), 18 deletions(-) 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