WordPress / WordPress/block-development-examples

Normalization sweep across example plugins (apiVersion, wp-scripts, text domains, headers, leftover debug code)

Open
#150 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
334
Forks
52
PR merge metrics
No merged PRs in 30d

Description

Problem

The 30 example plugins have drifted apart in ways learners copy-paste. Found while auditing:

  • apiVersion 2 stragglers (everything else is on 3): editable-block-1b8c51/src/blocks/basic-editable-block-1b8c51, editable-block-1b8c51/src/blocks/enhanced-editable-block-1b8c51, interactive-blocks-demos-99def1/src/counter-web-component-99def1. Inside editable-block-1b8c51 the no-build sibling block is already on v3 — inconsistent within a single plugin.
  • @wordpress/scripts spread: baseline ^27.8.0 (26 plugins), server-side-render-block-d26119 on ^26.15.0, three plugins on ^30.x. The baseline itself is ~3 majors behind.
  • Text domains: leftover create-block scaffold slugs 01-block-dynamic (block-dynamic-rendering-64756b) and 02-block-static (block-static-rendering-b16608); divergent domains in format-api-f14b86, non-block-react-wp-data-56d6f3, editor-bindings (block-dev-ex), interactivity-router-2f43f8 (bde_2f43f8__interactivity-router-beatles); and two plugins whose header and block.json textdomain disagree with each other (interactivity-router-2f43f8, my-first-interactive-block).
  • Plugin headers: five plugins missing Requires at least/Requires PHP/Text Domain/License (basic-block-translations-3df23d, editable-block-1b8c51, minimal-block-ca6eda, minimal-block-no-build-e621a6, editor-bindings); Plugin Name prefix varies (Block Development Examples - , WP Block Development Examples - , BDE - , none); some Requires values are wrong-by-underclaim — interactivity-router-2f43f8 declares WP 6.1 but uses the Interactivity API router (6.5+), interactive-blocks-demos-99def1 declares WP 5.8 / PHP 5.6.
  • Debug leftovers in shipped source (and committed build/): post-meta-modal-2502fb/src/index.js (console.log( 'sds' )), editor-bindings/src/index.js, slotfill-2fb190/src/index.js (×2), interactivity-router-2f43f8/src/view.js (×4).
  • Block namespace: create-block/my-first-interactive-block and tutorial/post-meta-testimonial vs block-development-examples/* everywhere else.
  • package.json scripts: no two plugin families agree (14 plugins minimal build/start/plugin-zip, 6 full create-block set with dead test:* entries, oddballs); editor-bindings lacks plugin-zip entirely, so it silently drops out of the release zips.
Proposed approach: small stacked PRs

One tracking issue, one focused PR per concern, stacked for sequential merge:

  • PR 1 — apiVersion 2 → 3 (3 block.json files + rebuild)
  • PR 2 — align @wordpress/scripts to latest (^30) in all 30 plugins + root, rebuild everything (the build-freshness check from #149 verifies the rebuild)
  • PR 3 — text domains: normalize to block-development-examples everywhere except tutorial-mirror plugins (my-first-interactive-block, post-meta-testimonial) which keep their tutorial-faithful domains but must be internally consistent (header == block.json). Includes the 01-…/02-… scaffold slug cleanup; the eslint allowedTextDomain rule keeps it honest.
  • PR 4 — plugin headers: complete the five truncated headers, unify the Block Development Examples - name prefix, correct wrong Requires at least/Requires PHP values (audit table in a comment below).
  • PR 5 — strip debug console.logs from src + rebuild.
  • PR 6 — block namespaces to block-development-examples/* (tutorial-mirror exception applies here too if fidelity requires it).
  • PR 7 — standardize plugin package.json scripts: minimal set build/start/plugin-zip everywhere (restores editor-bindings to the release flow), drop dead test:*/check-* scripts, align version fields.
Out of scope
  • Directory renames / hash-suffix convention (separate issue, pending an inbound-link audit).
  • _data/*.json metadata fixes (separate issue).
  • e2e (#147), CI (#148), build policy (#149).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the listed block.json files, plugin headers, package.json files, and src files, then review the proposed PR sequence and the build-freshness check from #149. Treat each concern as a separate focused change; done means the affected examples are normalized, rebuilt where required, and editor-bindings is included in release zips without changing the stated out-of-scope areas.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system, release, tooling
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.