Skip to content

fix(templates): guard the release zip; correct stale architecture docs - #18

Merged
akshat009 merged 1 commit into
mainfrom
fix/dist-zip-guard-and-architecture-docs
Aug 31, 2026
Merged

fix(templates): guard the release zip; correct stale architecture docs#18
akshat009 merged 1 commit into
mainfrom
fix/dist-zip-guard-and-architecture-docs

Conversation

@akshat009

Copy link
Copy Markdown
Owner

What

Three areas, all landing in every scaffolded plugin (plus the CLI's own README).

1. The release zip can no longer be built broken

templates/package.json:

  • plugin-zip chains composer prepare-dist"composer prepare-dist && wp-scripts plugin-zip". Previously npm run plugin-zip with no vendor/ on disk produced a zip with no autoloader, exit 0, no warning.
  • assets/src/ removed from files[] — verified nothing in generated runtime PHP reads it (Block_Registrarassets/build/blocks, Woo integration → assets/build/blocks-integration.js, Interactivityassets/js/view.js; every assets/src mention is a doc comment).
  • templates/readme.txt gains a == Development == section pointing to the repo for unminified source — gated on has_webpack_build, links {{AUTHOR_URI}} when set, else a fill-in placeholder. Keeps the wp.org "human-readable code" requirement satisfied now that source isn't shipped.

2. Stale architecture docs

Both templates/README.md and the CLI's own README.md described a Plugin::create() / Core\Container / Contracts\Service_Provider / Contracts\Conditional / <prefix>_providers filter system the generator has never produced. The real design is a singleton Plugin::instance()->boot() running a flat list of ( new X() )->init_hooks() calls.

  • templates/README.md: the section is replaced with a plain, module-aware ## Project structure list (conditional assets/src/ and templates/ lines) — a generated plugin's README shouldn't carry an architecture essay.
  • README.md (CLI): ## Architecture (generated plugin) rewritten to match the code; intro line and module-table wording corrected; Releasing sections updated for the chained plugin-zip.

3. Supporting

  • index.js: new has_author_uri template flag; Next steps output now points at the Releasing section.
  • tests/generator.test.js: updated the two plugin-zip string assertions and the files[] assertion (now asserts assets/src is absent).

Not included

No version bump — following repo convention (bumps are separate release commits). Next release should be a minor (3.0.0 → 3.1.0): plugin-zip now requires Composer on PATH and generated output changes, but the CLI interface is unchanged.

Verification

  • node --test tests/*.test.js70/70 pass
  • Regenerated scaffolds across build/no-build and woo/no-woo: readme.txt, README.md, package.json render with no stray {{...}} tokens; ## Project structure matches the actual directory tree in each combo
  • Full real pipeline exercised end-to-end (npm run buildcomposer install --no-dev --optimize-autoloadernpm run plugin-zip): 68-file zip, vendor/ present with a clean autoloader (no phpunit/phpcs/wpcs leak), deployed and structurally validated

package.json
- plugin-zip now runs `composer prepare-dist` first, so a zip is never
  built without the production autoloader (previously skipped silently,
  exit 0, when vendor/ was absent).
- drop unbuilt assets/src/ from files[] — no runtime PHP reads it. New
  readme.txt "== Development ==" section points to the repo for source,
  gated on has_webpack_build, linking AUTHOR_URI when set.

templates/README.md
- "Architecture & Services" described a Core\Container / Service_Provider
  / Conditional / <prefix>_providers filter system the generator has
  never produced. Replaced with a module-aware "Project structure"
  section. Releasing section updated for the chained plugin-zip.

README.md (CLI's own)
- same fictional architecture writeup corrected to the real singleton
  Plugin bootloader + plain init_hooks() modules; Releasing note updated.

index.js
- add has_author_uri template flag; point "Next steps" at packaging.

tests
- update the two plugin-zip assertions and the files[] assertion.

Verified: 70/70 generator tests; scaffolds regenerated across
build/no-build and woo/no-woo render clean with no stray tokens.
@akshat009
akshat009 merged commit 4d8fcfa into main Aug 31, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant