From a49ebdf8e13cc30794a5629c5b637e13ed5699d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Kuna?= <1282324+codecalm@users.noreply.github.com> Date: Sun, 4 Oct 2026 14:57:23 +0200 Subject: [PATCH] Hash build scripts in turbo inputs and skip screenshots without `rsvg-convert` (#1622) Co-authored-by: Bartek --- .build/helpers.mjs | 24 +++++++++++++++++------- turbo.json | 2 +- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.build/helpers.mjs b/.build/helpers.mjs index 87cd77019..531cd4889 100644 --- a/.build/helpers.mjs +++ b/.build/helpers.mjs @@ -396,11 +396,25 @@ export const asyncForEach = async (array, callback) => { } }; +export const isRsvgConvertAvailable = () => { + try { + cp.execSync('command -v rsvg-convert', { stdio: 'ignore' }); + return true; + } catch { + return false; + } +}; + export const createScreenshot = (filePath, retina = true) => { - cp.execSync(`rsvg-convert -x 2 -y 2 ${filePath} > ${filePath.replace('.svg', '.png')}`); + if (!isRsvgConvertAvailable()) { + console.log(`\nWarning: rsvg-convert not found. Skipping screenshot of ${filePath}.`); + return; + } + + cp.execSync(`rsvg-convert -x 2 -y 2 ${filePath} -o ${filePath.replace('.svg', '.png')}`); if (retina) { - cp.execSync(`rsvg-convert -x 4 -y 4 ${filePath} > ${filePath.replace('.svg', '@2x.png')}`); + cp.execSync(`rsvg-convert -x 4 -y 4 ${filePath} -o ${filePath.replace('.svg', '@2x.png')}`); } }; @@ -605,11 +619,7 @@ export const getCompileOptions = () => { }; export const convertIconsToImages = async (dir, extension, size = 240) => { - const rsvgConvertAvailable = await new Promise((resolve) => { - exec('command -v rsvg-convert', (error) => { - resolve(!error); - }); - }); + const rsvgConvertAvailable = isRsvgConvertAvailable(); if (!rsvgConvertAvailable) { console.log(`\nWarning: rsvg-convert not found. Skipping ${extension} conversion.`); diff --git a/turbo.json b/turbo.json index cdafab7f4..85d39542c 100644 --- a/turbo.json +++ b/turbo.json @@ -5,7 +5,7 @@ "build": { "outputs": ["dist/**", "src/icons/**", "icons/**", "icons.json", "tabler-nodes-*.json", "categories/**", "docs/**"], "dependsOn": ["^build"], - "inputs": ["../../icons/**"] + "inputs": ["$TURBO_DEFAULT$", "../../icons/**", "../../aliases.json", "../../.build/**", "!../../.build/**/*.test.mjs", "../../LICENSE"] }, "lint": {}, "dev": {