-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add support for the WordPress.org plugin preview #116
Conversation
…ent. Also add some demo data we can import
@dkotter are we able to import a test audio file and have that pre-set in the block? |
Yeah, that would be ideal and I tried to figure that out but wasn't successful in the time I spent on this. As far as I can tell from reading the docs, there isn't a built-in command to import media yet. @10up/open-source-practice If anyone has interest in seeing if they can figure this out, that would be great. If not I can take another stab at some point, as we'll definitely want to do something similar in a few of our other plugins. For reference, here's some of the things I've tried:
Not sure if there's a way to get error reporting / logging in WordPress Playground because that's been my biggest issue with trying to use the |
931047b
to
9e1f5df
Compare
9e1f5df
to
4b998e3
Compare
I've pushed an update with some sample data that references the full URL of a media file in the sample post, it appears to work as expected. I pushed a media file up (source) but since force pushed it out of existence as I think it would be wise to serve it from either another branch on GitHub or via WordPress.org (which will require updating the import file). Please don't merge until we decide where to serve the file from! |
@peterwilsoncc, I've reviewed it, and the WordPress playground functions as expected. Directly referencing audio files contributes to faster booting of the WordPress Playground. I recommend adopting this approach and allowing users to upload audio files for testing the block. |
For a few of our plugins I've been referencing files to import (like on this PR) just straight from a commit on GitHub (like https://raw.githubusercontent.com/10up/retro-winamp-block/4b998e304f5ab68b45c67c4bc4cf78a601e642e3/.wordpress-org/blueprints/demo-data.xml). I guess my thought is we could put the audio file in the But curious if you have additional thoughts on the best location for these files, if referencing a commit on Github doesn't seem to be the best approach. |
Putting blueprint data/files in the |
I'm happy to put it in there. Here's some files we can use and redistribute. For credit, I suggest we include it in the sample post import into the playground installation. https://openverse.org/search/audio?q=Short&license=pdm,cc0,by,by-sa,by-nd&extension=mp3 |
All right, this is ready for review again. I've added a couple test mp3 files and updated our export file to use those files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks Darin.
I've confirmed the file works as expected via JSON.stringify.
@dkotter @peterwilsoncc in testing this on WP.org I'm seeing the generic audio block player render instead of the Winamp player: |
The link added doesn't work for me but if what you're seeing in the Playground is that screenshot, that all looks correct to me. The custom block uses normal audio blocks within it and those render by default. You can toggle to see the Winamp player in the toolbar. By default it's on |
Ah I see, I don't think I noticed the Audio List vs. Preview Player toolbar toggles before. Thinking perhaps the Preview Player option is the better default (as that's how it'll render on the frontend) but that's something I can open in a separate issue. |
This now appears to throw an error:
Perhaps the blueprint was referencing something that was deleted? |
Description of the Change
WordPress.org recently launched support for plugin previews utilizing the WordPress Playground feature. Plugins wanting to take advantage of this need to opt in by setting up a
blueprint.json
file that configures how the preview should load. This PR adds in that file that does the following:Note that this PR is targeted to
trunk
as the hope is we can take advantage of our Plugin Asset Update Action to deploy these changes without having to push out a new release.Also note once these changes are on .org, the preview button will need to be enabled in a test state. Once verified as working, we can enable it for all users.
How to test the Change
The WordPress Playground allows you to spin up a new environment directly through the URL, by going to
https://playground.wordpress.net/#
and pasting your JSON config after the#
. In this case, the URL should be: https://playground.wordpress.net/#{%20%22$schema%22:%20%22https://playground.wordpress.net/blueprint-schema.json%22,%20%22landingPage%22:%20%22\/wp-admin\/post.php?post=5&action=edit%22,%20%22preferredVersions%22:%20{%20%22php%22:%20%227.4%22,%20%22wp%22:%20%22latest%22%20},%20%22phpExtensionBundles%22:%20[%22kitchen-sink%22],%20%22steps%22:%20[%20{%20%22step%22:%20%22login%22,%20%22username%22:%20%22admin%22,%20%22password%22:%20%22password%22%20},%20{%20%22step%22:%20%22installPlugin%22,%20%22pluginZipFile%22:%20{%20%22resource%22:%20%22wordpress.org\/plugins%22,%20%22slug%22:%20%22retro-winamp-block%22%20},%20%22options%22:%20{%20%22activate%22:%20true%20}%20},%20{%20%22step%22:%20%22importFile%22,%20%22file%22:%20{%20%22resource%22:%20%22url%22,%20%22url%22:%20%22https:\/\/raw.githubusercontent.com\/10up\/retro-winamp-block\/d2ff63d1127713d9f2a11235a002f38f2927b0ca\/.wordpress-org\/blueprints\/demo-data.xml%22%20}%20}%20]%20}Changelog Entry
Credits
Props @dkotter
Checklist: