grr-cli 2.4.1

Google tools from the terminal, at maximum performance: 401 methods across 14 Google APIs in one generated command tree, zero-config, over HTTP/3
Documentation
---
import stats from '../data/stats.json';

interface Props {
  /** Suffix line under the row. Set to an empty string to drop it. */
  note?: string;
}

const { note = 'Compressed release archives, straight from the GitHub release.' } = Astro.props;

// The rendered platforms ARE stats.json's `binarySizes` keys, mapped 1:1, so a
// shipped target can never be silently dropped the way linux-aarch64 was — the
// row used to hard-code four targets and omit it. Add a target to the snapshot
// and it appears here; the count always equals the key count. Non-platform
// release assets (the generated winget manifest bundle) live in
// `nonPlatformAssets` and are deliberately not rendered: a manifest bundle is
// not a platform, and listing it here is what made this row claim six.
const PLATFORM_LABELS: Record<string, string> = {
  'linux-aarch64': 'Linux arm64',
  'linux-x86_64': 'Linux x86_64',
  'macos-aarch64': 'macOS arm64',
  'macos-x86_64': 'macOS x86_64',
  'windows-aarch64': 'Windows ARM',
  'windows-x86_64': 'Windows x86_64',
};

const sizes = (stats.binarySizes ?? {}) as Record<string, number | undefined>;

const formatMegabytes = (bytes: number | undefined) => {
  const size = Number(bytes);
  if (!Number.isFinite(size) || size <= 0) return '—';
  return `${(size / 1024 / 1024).toFixed(1)} MB`;
};

const release = String(stats.latestRelease || `v${stats.version}`).replace(/^v/, '');
const rows = Object.keys(sizes).map((key) => ({
  key,
  label: PLATFORM_LABELS[key] ?? key,
  size: formatMegabytes(sizes[key]),
}));
---

<div class="download-sizes mt-4">
  <div class="download-sizes-head mb-1 flex items-center justify-between gap-4">
    <span class="stat-label">platform archives</span>
    <span class="badge badge-secondary badge-sm">v{release}</span>
  </div>
  <dl class="download-sizes-grid grid grid-cols-2 gap-x-6 gap-y-3 m-0 sm:grid-cols-3 lg:grid-cols-5">
    {
      rows.map((row) => (
        <div class="download-sizes-cell">
          <dt class="text-xs text-(--muted)">{row.label}</dt>
          <dd class="m-0 mt-0.5 text-lg">{row.size}</dd>
        </div>
      ))
    }
  </dl>
  {note && <p class="download-sizes-note m-0 mt-3 text-xs text-(--quiet)">{note}</p>}
</div>