This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
beams is a monorepo for WordPress Gutenberg block development tooling and blocks, maintained by Klein College of Media and Communication at Temple University. The repository uses pnpm workspaces, Turborepo for build orchestration, and provides a Vite plugin for modern Gutenberg block development.
This project uses pnpm (version 10.18.0). All package management commands should use pnpm, not npm or yarn.
pnpm dev- Start development mode for all packages (via Turbo)pnpm build- Build all packages (via Turbo)pnpm lint- Run linting across all packages (via Turbo)
Navigate to individual package directories to run package-specific commands:
-
vite-plugin-gutenberg-blocks:
pnpm build- Build via tsdownpnpm dev- Watch mode buildpnpm check- Type check + Biome checkpnpm check:ts- TypeScript type checking onlypnpm test- Runscheck(no separate test suite)
-
explore-bar (example Gutenberg block):
pnpm dev- Vite watch modepnpm build- Production buildpnpm check- Type check + Biome checkpnpm check:ts- TypeScript type checking onlypnpm fmt- Format with Biome
just fmt- Format code with treefmt (runs Biome, nixfmt, prettier, taplo, dos2unix)just check- Check for lint/format issues (runs REUSE compliance, dotenv-linter, nix flake check)just fix- Apply all formatter + fixer changesbiome check --write- Format/fix with Biome directly
pnpm changeset- Create a changeset for version bumpingpnpm release- Build and publish packages (runspnpm build && changeset publish)
packages/
├── vite-plugin-gutenberg-blocks/ # Core Vite plugin for Gutenberg block development
├── gutenberg-types/ # TypeScript type definitions for WordPress/Gutenberg
├── explore-bar/ # Example Gutenberg block implementation
├── tsconfig/ # Shared TypeScript configurations
└── brand-assets/ # Brand assets package
@kleinweb/vite-plugin-gutenberg-blocks
- Vite plugin that enables modern frontend tooling for WordPress Gutenberg blocks
- Handles React JSX transformation with WordPress element compatibility (
jsxImportSource: '@wordpress/element') - Generates WordPress-specific asset manifests (
index.asset.php) - Automatically copies
block.jsonand PHP templates to build output - Configures builds as IIFE bundles targeting ES2022
- Source:
packages/vite-plugin-gutenberg-blocks/src/index.ts - Main export:
createViteBlock()function that returns an array of Vite plugins
@kleinweb/gutenberg-types
- Provides TypeScript type definitions for WordPress Gutenberg APIs
- Types are sourced from upstream Gutenberg releases (cached in
.cache/directory) - Used by blocks and tools to get proper typing for WordPress globals
Gutenberg Block Development Pattern
Blocks follow this structure (see explore-bar package as reference):
src/block.json- WordPress block metadatasrc/index.ts- Entry point that registers the block with WordPresssrc/Edit.tsx- Block editor componentsrc/Save.tsx- Frontend render componentvite.config.ts- UsescreateViteBlock()plugin- Build output goes to
dist/(or configuredoutDir)
The @kleinweb/tsconfig package provides shared TypeScript configurations:
tsconfig.base.json- Base configurationtsconfig.node.json- Node.js projectstsconfig.react.json- React projectstsconfig.vite.json- Vite projectstsconfig.web.json- Web projectstsconfig.app.json- Application projectstsconfig.recommended.json- Recommended settings
Packages extend these via "extends": "@kleinweb/tsconfig/..." in their tsconfig.json.
- Turborepo orchestrates builds across the monorepo (see
turbo.json) - Build tasks have dependency ordering via
dependsOn: ["^build"] - Outputs:
dist/**for packages,public/build/**for blocks - tsdown is used for building the Vite plugin package
- Vite is used for building Gutenberg blocks
- Biome for JavaScript/TypeScript/CSS linting and formatting (configured in
biome.json)- Single quotes, semicolons as needed
- 2-space indentation
- Sorted attributes and properties enabled
- treefmt orchestrates multiple formatters (Biome, prettier, nixfmt, taplo, dos2unix)
- EditorConfig for cross-editor consistency
- License headers enforced via REUSE compliance (GPL-3.0-or-later)
The project uses Nix for reproducible development environments:
flake.nixdefines the development shelldirenvwith.envrcfor automatic environment loading- Node.js version enforced: ^22.0.0 || ^23.0.0 || ^24.0.0 (per vite-plugin-gutenberg-blocks)
- React JSX in blocks uses classic runtime with
@wordpress/elementas the import source (configured in the Vite plugin) - Block builds are IIFE format to integrate with WordPress's script loading system
- The plugin automatically externalizes WordPress dependencies (handled via
optionsandoutputOptionshooks) - Block metadata (
block.json) and PHP templates are copied to build output, not bundled - When creating new Gutenberg blocks, follow the
explore-barpackage structure