Skip to content

Add Playground docs importer - #569

Merged
akirk merged 4 commits into
trunkfrom
import-playground
Jul 15, 2026
Merged

akirk merged 4 commits into
trunkfrom
import-playground

Conversation

@akirk

@akirk akirk commented Jun 18, 2026 •

Copy link
Copy Markdown
Member

Summary

Adds a Playground handbook importer to the Developer theme and a focused Playground command for importing documentation.

playground:import-docs uses jq to derive a temporary ignored Blueprint from the normal Playground Blueprint. It appends a compact step that invokes the manifest and Markdown import actions for the documentation post type supplied through IMPORT_POST_TYPE. The base Blueprint remains unchanged, and no temporary importer PHP files are written into the theme.

The Playground importer reads its manifest from the trunk branch of WordPress/wordpress-playground and handles inline Markdown inside Docusaurus callout markup.

Usage

Import the Playground documentation with:

IMPORT_POST_TYPE=playground yarn playground:import-docs

The command fails with a usage message when IMPORT_POST_TYPE is missing.

JavaScript lint dependency

The theme already imported @wordpress/i18n directly but did not declare it. PR #568 still passed because its unlocked CI install resolved @wordpress/stylelint-config@23.40.1, whose dependency tree did not install @wordpress/i18n; the ignored unresolved WordPress import therefore did not reach the extraneous-dependency check.

@wordpress/stylelint-config@23.42.0, published July 1, updated its @wordpress/theme range from ^0.15.1 to ^0.17.0. The newer theme package installs i18n through @wordpress/compose and @wordpress/keycodes. Once i18n became resolvable, import/no-extraneous-dependencies correctly reported the undeclared direct import. This PR therefore declares @wordpress/i18n explicitly in the theme workspace.

Testing

Validated locally:

  • Parsed package.json and both the base and generated Blueprint JSON.
  • Confirmed jq appends IMPORT_POST_TYPE=playground and the two-step documentation import.
  • Linted the generated runPHP code with php -l.
  • Linted inc/import-playground.php with php -l.
  • Confirmed a missing IMPORT_POST_TYPE exits with the documented usage message.
  • Ran yarn workspace wporg-developer-2023 lint:js successfully after declaring i18n.
  • Ran git diff --check.

The earlier PHP commit hook was bypassed because the local PHPCompatibility sniff fails internally with trim(): Passing null to parameter #1 under the current PHP version. The hook also reports the existing file-header ordering issue in functions.php.

@akirk akirk changed the title Add Playground docs import helper Add Playground docs importer Jul 15, 2026
@akirk
akirk marked this pull request as ready for review July 15, 2026 10:34
akirk added 2 commits July 15, 2026 12:51
The theme imports @wordpress/i18n directly but previously relied on it being absent from the installed dependency tree, while import/no-unresolved ignores @WordPress packages.

Since PR #568, @wordpress/stylelint-config 23.42.0 changed its @wordpress/theme dependency from ^0.15.1 to ^0.17.0. That newer theme package installs @wordpress/i18n through @wordpress/compose and @wordpress/keycodes, causing import/no-extraneous-dependencies to detect the undeclared direct import.

Declare the runtime dependency explicitly so lint does not depend on the transitive install layout.
@akirk
akirk force-pushed the import-playground branch from af50a91 to de34e0c Compare July 15, 2026 11:14
@akirk
akirk merged commit 5a36e40 into trunk Jul 15, 2026
1 check passed
@akirk
akirk deleted the import-playground branch July 15, 2026 11:44
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