Browse Source
Hash build scripts in turbo inputs and skip screenshots without `rsvg-convert` (#1622)
Co-authored-by: Bartek <xbartoszdobija@gmail.com>
pull/1623/head
Paweł Kuna
7 days ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
18 additions and
8 deletions
-
.build/helpers.mjs
-
turbo.json
|
|
|
@ -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.`); |
|
|
|
|
|
|
|
@ -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": { |
|
|
|
|