Skip to content

Replace OpenNext Cloudflare build with vinext #487

Replace OpenNext Cloudflare build with vinext

Replace OpenNext Cloudflare build with vinext #487

name: Bundle Size Analyzer
on:
pull_request:
branches: [main]
push:
branches: [main]
jobs:
analyze:
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 10
permissions:
contents: read # for checkout repository
actions: read # for fetching base branch bundle stats
pull-requests: write # for comments
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.10
- name: Cache Bun dependencies
uses: actions/cache@v4
id: bun-cache
with:
path: |
~/.bun/install/cache
node_modules
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-
- name: Install dependencies
if: steps.bun-cache.outputs.cache-hit != 'true'
run: bun install --frozen-lockfile
- name: Build Worker package
run: bun --env-file=.env.example run build
- name: Summarize vinext server output
run: |
{
echo "## vinext Worker build"
echo
echo "- build: \`bun run build\`"
echo "- deploy artifact: \`dist/server/wrangler.json\`"
echo "- largest server modules:"
find dist/server -type f -name '*.js' -printf '%s %p\n' | sort -nr | head -20 | awk '{printf " - %s bytes %s\n", $1, $2}'
echo
total_bytes=$(find dist/server -type f -name '*.js' -printf '%s\n' | awk '{s+=$1} END {print s+0}')
echo "- total server js bytes: ${total_bytes}"
} >> "$GITHUB_STEP_SUMMARY"