Skip to content

fix the Slovak localization #183

fix the Slovak localization

fix the Slovak localization #183

Workflow file for this run

name: Statoscope
on:
push:
branches: [ main ]
tags-ignore: [ '*' ]
pull_request:
branches: [ main ]
jobs:
statoscope:
if: "!startsWith(github.event.head_commit.message, 'New version') && !startsWith(github.event.head_commit.message, 'chore: update statoscope')"
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Install dependencies
run: npm ci --legacy-peer-deps
- name: Build with Statoscope
run: make build es=es2021 uglify=true fat=true statoscope=true
# On main: update reference.json
- name: Update reference stats
if: github.event_name == 'push'
run: |
mv statoscope/reference.next.json statoscope/reference.json
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add statoscope/reference.json
git diff --cached --quiet && echo "No changes" || git commit -m "chore: update statoscope reference stats" && git push
# On PR: compare against committed reference
- name: Generate size report
if: github.event_name == 'pull_request'
id: sizes
run: |
if [ ! -f statoscope/reference.json ]; then
echo "has_reference=false" >> "$GITHUB_OUTPUT"
exit 0
fi
echo "has_reference=true" >> "$GITHUB_OUTPUT"
REF=$(npx @statoscope/cli query \
--input statoscope/reference.json \
--query '$[0].compilations.pick().assets.({name, size: info.size})')
NEXT=$(npx @statoscope/cli query \
--input statoscope/reference.next.json \
--query '$[0].compilations.pick().assets.({name, size: info.size})')
node -e "
const ref = JSON.parse(process.argv[1]);
const next = JSON.parse(process.argv[2]);
const fmt = (b) => (b / 1024).toFixed(2) + ' KB';
const fmtDiff = (d) => {
if (d === 0) return '—';
const kb = (d / 1024).toFixed(2);
return (d > 0 ? '+' : '') + kb + ' KB';
};
let table = '| Asset | Reference | Current | Diff |\n|---|--:|--:|--:|\n';
let totalRef = 0, totalNext = 0;
for (const n of next) {
const r = ref.find(x => x.name === n.name);
const rSize = r ? r.size : 0;
const diff = n.size - rSize;
totalRef += rSize;
totalNext += n.size;
const icon = diff > 0 ? '🔺' : diff < 0 ? '🟢' : '';
table += '| ' + n.name + ' | ' + fmt(rSize) + ' | ' + fmt(n.size) + ' | ' + icon + ' ' + fmtDiff(diff) + ' |\n';
}
const totalDiff = totalNext - totalRef;
const icon = totalDiff > 0 ? '🔺' : totalDiff < 0 ? '🟢' : '';
table += '| **Total** | **' + fmt(totalRef) + '** | **' + fmt(totalNext) + '** | ' + icon + ' **' + fmtDiff(totalDiff) + '** |\n';
const fs = require('fs');
fs.appendFileSync(process.env.GITHUB_OUTPUT, 'table<<SIZES_EOF\n' + table + 'SIZES_EOF\n');
" "$REF" "$NEXT"
- name: Validate rules
if: github.event_name == 'pull_request' && steps.sizes.outputs.has_reference == 'true'
id: validate
run: |
set +e
OUTPUT=$(npx @statoscope/cli validate \
--input statoscope/reference.next.json \
--reference statoscope/reference.json 2>&1)
EXIT_CODE=$?
echo "$OUTPUT"
{
echo "result<<STATOSCOPE_EOF"
echo "$OUTPUT"
echo "STATOSCOPE_EOF"
} >> "$GITHUB_OUTPUT"
echo "exit_code=$EXIT_CODE" >> "$GITHUB_OUTPUT"
- name: Generate diff report
if: github.event_name == 'pull_request' && steps.sizes.outputs.has_reference == 'true'
run: |
npx @statoscope/cli generate \
--input statoscope/reference.next.json \
--reference statoscope/reference.json \
--output build/statoscope-diff.html
- name: Upload diff report
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: statoscope-diff
path: build/statoscope-diff.html
retention-days: 30
- name: Comment PR
if: github.event_name == 'pull_request' && steps.sizes.outputs.has_reference == 'true'
uses: marocchino/sticky-pull-request-comment@5770ad5eb8f42dd2c4f34da00c94c5381e49af88 # v2
with:
header: statoscope
message: |
## 📊 Bundle Size
${{ steps.sizes.outputs.table }}
<details>
<summary>Validation details</summary>
```
${{ steps.validate.outputs.result }}
```
</details>
${{ steps.validate.outputs.exit_code == '0' && '✅ All checks passed' || '⚠️ Some checks failed' }} · [Full diff report →](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) (see Artifacts)
- name: Comment PR (no reference)
if: github.event_name == 'pull_request' && steps.sizes.outputs.has_reference != 'true'
uses: marocchino/sticky-pull-request-comment@5770ad5eb8f42dd2c4f34da00c94c5381e49af88 # v2
with:
header: statoscope
message: |
## 📊 Bundle Size
No reference stats in `main` yet. Comparison will be available after first merge.