-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use the content files from theme team and a11y team from official repos #19
Conversation
Let's merge WordPress/wordpress-playground#1244 before this one to make sure the |
3c43c95
to
6a1263a
Compare
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
…steps (#1244) Adds an `ifAlreadyInstalled?: 'overwrite' | 'skip' | 'error'` option to installPlugin and installTheme steps. It defaults to `overwrite`. Consider the following Blueprint: ```json { "preferredVersions": { "php": "latest", "wp": "6.4" }, "steps": [ { "step": "installTheme", "themeZipFile": { "resource": "wordpress.org/themes", "slug": "twentytwentyfour" } } ] } ``` Before this PR, it would result in an error. After this PR, the installation just works. If the Blueprint author explicitly wants the installation to fail, they can specify the `ifAlreadyInstalled` option: ```json { "steps": [ { "step": "installTheme", "themeZipFile": { "resource": "wordpress.org/themes", "slug": "twentytwentyfour" }, "ifAlreadyInstalled": "skip" // or "error" } ] } ``` ## Motivation Installing a plugin or theme over a currently installed one is a common gotcha. Currently it results in an error and blocks the Blueprint execution. This behavior is, however, often undesirable as it prevents having a single Blueprint that installs a twentytwentyfour theme on different versions of WordPress. An addition of the `ifAlreadyInstalled` option puts the Blueprint author in control and provides a sensible default behavior where the installation will "just work" by replacing the already installed version of the plugin or theme. Closes #1157 Related to WordPress/blueprints#19 ## Testing instructions Confirm the unit tests pass cc @bgrgicak @brandonpayton
This looks good! Note the media files are not actually imported because of CORS issues. I proposed a fix in WordPress/wordpress-playground#1250, but it makes the import unusably long so I won't enable the media transfer until we have a better WXR importer. Either way, let's merge this PR – thank you @bph! |
…ma (#23) Solves the Blueprint parsing problem as follows: * JSON Schema is the source of truth for the Blueprint data structure * Model classes are generated from JSON Schema * Input Validation is done against the JSON Schema * Mapping validated input into model instances is indirectly done based on the JSON Schema ## Summary of the approach We use [Janephp](https://github.com/janephp/janephp/) to infer the PHP model class structure from the JSON schema We then use Jane's output to generate PHP code using [Nette PHP generator](https://github.com/nette/php-generator): * Model classes * Interfaces for groups of related classes: `StepDefinitionInterface`, `ResourceDefinitionInterface`. * Interface resolution map for the [JsonMapper library](https://jsonmapper.net/). * PHP docstrings with more accurate types than Jane to guide the mapping process From there, the data pipeline looks as follows: 1. Parse raw JSON 2. Validate it with Opis 3. Map it into PHP models using JsonMapper Or, if you're consuming the PHP API directly: 1. Create Model instances 2. Validate them with Opis ## Remaining work - [ ] Solve merge conflicts ## Rationale Parsing and mapping JSON [in TypeScript is a simple problem, but in PHP it's surprisingly involved](WordPress/blueprints#13 (comment)). This PR combines three previously explored approaches into a single pipeline: * WordPress/blueprints#17 * WordPress/blueprints#19 * WordPress/blueprints#21
Uses the content files from theme team and a11y team from official repos.
https://github.com/wpaccessibility/a11y-theme-unit-test
and
https://github.com/WordPress/theme-test-data