-
Notifications
You must be signed in to change notification settings - Fork 270
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
GitDirectoryResource #1858
Merged
Merged
GitDirectoryResource #1858
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Related to #1787, Follows up on #1793 Implements GitDirectoryResource to enable loading files directly from git repositories as follows: ```ts { "landingPage": "/guides/for-plugin-developers.md", "steps": [ { "step": "writeFiles", "writeToPath": "/wordpress/guides", "filesTree": { "resource": "git:directory", "url": "https://github.com/WordPress/wordpress-playground.git", "ref": "trunk", "path": "packages/docs/site/docs/main/guides" } } ] } ``` ## Implementation details Uses git client functions merged in #1764 to sparse checkout the requested files. It also leans on the PHP CORS proxy which is now started as a part of the `npm run dev` command. The CORS proxy URL is configurable per `compileBlueprint()` call so that each Playground runtime may choose to either use it or not. For example, it wouldn't be very useful in the CLI version of Playground. ## Testing plan Go to `http://localhost:5400/website-server/#{%20%22landingPage%22:%20%22/guides/for-plugin-developers.md%22,%20%22steps%22:%20[%20{%20%22step%22:%20%22writeFiles%22,%20%22writeToPath%22:%20%22/wordpress/guides%22,%20%22filesTree%22:%20{%20%22resource%22:%20%22git:directory%22,%20%22url%22:%20%22https://github.com/WordPress/wordpress-playground.git%22,%20%22ref%22:%20%22trunk%22,%20%22path%22:%20%22packages/docs/site/docs/main/guides%22%20}%20}%20]%20}` and confirm Playground loads a markdown file.
adamziel
added
[Type] Enhancement
New feature or request
[Package][@wp-playground] Blueprints
[Feature] GitHub integration
labels
Oct 7, 2024
adamziel
added a commit
to adamziel/playground-content-converters
that referenced
this pull request
Oct 8, 2024
Replaces the clunky "Zip, unzip, move files" workflow with a direct git clone built on top of WordPress/wordpress-playground#1858. It's so much nicer!
adamziel
added a commit
that referenced
this pull request
Oct 8, 2024
GitDirectoryResource was merged in #1858. Unfortunately, it didn't provide an easy way of saying "checkout all the files from the repo". This PR adds support for three root path syntaxes: * `"path": "/"` * `"path": "."` * `"path": ""` ## Testing instructions Run this Blueprint locally and confirm it installs the blocky formats plugin: ```json { "$schema": "https://playground.wordpress.net/blueprint-schema.json", "login": true, "landingPage": "/wp-admin/", "steps": [ { "step": "installPlugin", "pluginData": { "resource": "git:directory", "url": "https://github.com/dmsnell/blocky-formats.git", "ref": "trunk", "path": "/" } } ] } ```
This was referenced Oct 8, 2024
adamziel
added a commit
that referenced
this pull request
Oct 8, 2024
GitDirectoryResource was merged in #1858. Unfortunately, it didn't provide an easy way of saying "checkout all the files from the repo". This PR adds support for three root path syntaxes: * `"path": "/"` * `"path": "."` * `"path": ""` ## Testing instructions Run this Blueprint locally and confirm it installs the blocky formats plugin: ```json { "$schema": "https://playground.wordpress.net/blueprint-schema.json", "login": true, "landingPage": "/wp-admin/", "steps": [ { "step": "installPlugin", "pluginData": { "resource": "git:directory", "url": "https://github.com/dmsnell/blocky-formats.git", "ref": "trunk", "path": "/" } } ] } ```
adamziel
added a commit
that referenced
this pull request
Oct 15, 2024
Makes GitDirectoryResource (introduced in #1858) relay the requests through `/cors-proxy.php?{url}` instead of `/cors-proxy.php/{url}`. This makes it compatible with the actual `cors-proxy.php` script Playground ended up shipping. ## Testing instructions None, this only works in production.
adamziel
added a commit
that referenced
this pull request
Oct 15, 2024
Makes GitDirectoryResource (introduced in #1858) relay the requests through `/cors-proxy.php?{url}` instead of `/cors-proxy.php/{url}`. This makes it compatible with the actual `cors-proxy.php` script Playground ended up shipping. ## Testing instructions None, this only works in production. Maybe you could run the Blueprint from #1858 and confirm in the network tools that it's actually using the `?` instead of `/`.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
[Feature] GitHub integration
[Package][@wp-playground] Blueprints
[Type] Enhancement
New feature or request
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related to #1787, Follows up on #1793
Implements GitDirectoryResource to enable loading files directly from git repositories as follows:
Implementation details
Uses git client functions merged in #1764 to sparse checkout the requested files. It also leans on the PHP CORS proxy which is now started as a part of the
npm run dev
command.The CORS proxy URL is configurable per
compileBlueprint()
call so that each Playground runtime may choose to either use it or not. For example, it wouldn't be very useful in the CLI version of Playground.Testing plan
Go to
And confirm the Playground loads a markdown file.