/
githubmirror
/
ydb-embedded-ui
Обзор
Документация
Войти
/
githubmirror
/
ydb-embedded-ui
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
.github/workflows/scripts/utils/bundle.js
54 строки
2 KB
Hellen
chore: update linters (#2419)
18 июн 2025, 15:53
Не верифицирован
18 июн 2025, 15:53
5dcaaa9
Код
Авторство
О чём код?
const {formatSize} = require('./format'); /** * Generates the bundle size status section * @param {object} bundleInfo - Bundle size information * @param bundleInfo.currentSize * @param bundleInfo.mainSize * @param bundleInfo.diff * @param bundleInfo.percent * @returns {string} Formatted bundle size section */ function generateBundleSizeSection({currentSize, mainSize, diff, percent}) { const bundleStatus = percent === 'N/A' ? '⚠️' : parseFloat(percent) > 0 ? '🔺' : parseFloat(percent) < 0 ? '🔽' : '✅'; const sizeChangeMessage = percent === 'N/A' ? '⚠️ Unable to calculate change.' : parseFloat(percent) > 0 ? '⚠️ Bundle size increased. Please review.' : parseFloat(percent) < 0 ? '✅ Bundle size decreased.' : '✅ Bundle size unchanged.'; return `### Bundle Size: ${bundleStatus} Current: ${formatSize(currentSize)} | Main: ${formatSize(mainSize)} Diff: ${diff > 0 ? '+' : ''}${formatSize(Math.abs(diff))} (${percent === 'N/A' ? 'N/A' : `${percent}%`}) ${sizeChangeMessage}`; } /** * Gets bundle size information from environment variables * @returns {object} Bundle size information */ function getBundleInfo() { return { currentSize: parseInt(process.env.CURRENT_SIZE || '0'), mainSize: parseInt(process.env.MAIN_SIZE || '0'), diff: parseInt(process.env.SIZE_DIFF || '0'), percent: process.env.SIZE_PERCENT || 'N/A', }; } module.exports = { generateBundleSizeSection, getBundleInfo, };