chore(deps-dev): bump vitest from 3.2.4 to 4.1.1 in /packages/next #391
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| tags: | |
| - "v*" | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-and-test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: lts/* | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Build | |
| run: pnpm run build | |
| - name: Lint | |
| run: pnpm run lint | |
| - name: Typecheck | |
| run: pnpm run typecheck | |
| - name: Test | |
| run: pnpm run test | |
| e2e: | |
| name: E2E Tests | |
| uses: ./.github/workflows/e2e.yml | |
| publish: | |
| needs: [build-and-test, e2e] | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: lts/* | |
| cache: pnpm | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Build | |
| run: pnpm run build | |
| - name: Generate bundle size report | |
| id: bundle-size | |
| run: | | |
| # Helper function to format bytes | |
| format_bytes() { | |
| local bytes=$1 | |
| if [ $bytes -ge 1024 ]; then | |
| printf "%.2f KB" $(echo "scale=2; $bytes/1024" | bc) | |
| else | |
| printf "%d B" $bytes | |
| fi | |
| } | |
| # Start markdown report | |
| { | |
| echo "## Bundle Sizes" | |
| echo "" | |
| echo "| Package | Format | Size | Gzipped |" | |
| echo "|---------|--------|------|----------|" | |
| } > bundle-size-report.md | |
| # Auto-discover and report all packages | |
| for pkg_dir in packages/*/; do | |
| pkg_name=$(basename "$pkg_dir") | |
| dist_dir="${pkg_dir}dist" | |
| # Skip if no dist directory | |
| [ -d "$dist_dir" ] || continue | |
| # Get package name from package.json | |
| if [ -f "${pkg_dir}package.json" ]; then | |
| npm_name=$(jq -r '.name' "${pkg_dir}package.json") | |
| else | |
| npm_name="@replanejs/${pkg_name}" | |
| fi | |
| # Special handling for Svelte (unbundled, multiple JS files) | |
| if [ "$pkg_name" = "svelte" ]; then | |
| esm_size=$(cat "${dist_dir}"/*.js 2>/dev/null | wc -c | tr -d ' ') | |
| esm_gz=$(cat "${dist_dir}"/*.js 2>/dev/null | gzip -c | wc -c | tr -d ' ') | |
| if [ "$esm_size" -gt 0 ]; then | |
| echo "| ${npm_name} | ESM | $(format_bytes $esm_size) | $(format_bytes $esm_gz) |" >> bundle-size-report.md | |
| fi | |
| continue | |
| fi | |
| # Check for ESM bundle (index.js) | |
| if [ -f "${dist_dir}/index.js" ]; then | |
| esm_size=$(stat -c%s "${dist_dir}/index.js") | |
| esm_gz=$(gzip -c "${dist_dir}/index.js" | wc -c | tr -d ' ') | |
| echo "| ${npm_name} | ESM | $(format_bytes $esm_size) | $(format_bytes $esm_gz) |" >> bundle-size-report.md | |
| fi | |
| # Check for CJS bundle (index.cjs) | |
| if [ -f "${dist_dir}/index.cjs" ]; then | |
| cjs_size=$(stat -c%s "${dist_dir}/index.cjs") | |
| cjs_gz=$(gzip -c "${dist_dir}/index.cjs" | wc -c | tr -d ' ') | |
| echo "| ${npm_name} | CJS | $(format_bytes $cjs_size) | $(format_bytes $cjs_gz) |" >> bundle-size-report.md | |
| fi | |
| done | |
| cat bundle-size-report.md | |
| - name: Extract version from tag | |
| id: version | |
| run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
| - name: Sync package versions | |
| run: | | |
| VERSION=${{ steps.version.outputs.VERSION }} | |
| echo "Setting all packages to version $VERSION" | |
| # Update version in all package.json files | |
| for pkg in packages/*/package.json; do | |
| jq --arg v "$VERSION" '.version = $v' "$pkg" > tmp.json && mv tmp.json "$pkg" | |
| echo "$pkg: $VERSION" | |
| done | |
| # Note: pnpm automatically replaces workspace:^ with ^VERSION during publish | |
| - name: Publish all packages | |
| run: pnpm -r publish --access public --no-git-checks | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Create GitHub Release | |
| run: npx changelogithub | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Append bundle size to release | |
| run: | | |
| # Get current release body | |
| CURRENT_BODY=$(gh release view "${{ github.ref_name }}" --json body -q '.body') | |
| # Append bundle size report (with blank line separator) | |
| BUNDLE_REPORT=$(cat bundle-size-report.md) | |
| # Combine with newline separator | |
| printf -v NEW_BODY '%s\n\n%s' "$CURRENT_BODY" "$BUNDLE_REPORT" | |
| # Update release with new body | |
| gh release edit "${{ github.ref_name }}" --notes "$NEW_BODY" | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |