Skip to content
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 3 commits into from
Oct 8, 2024
Merged

GitDirectoryResource #1858

merged 3 commits into from
Oct 8, 2024

Commits on Oct 7, 2024

  1. Implement GitDirectoryResource

    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 committed Oct 7, 2024
    Configuration menu
    Copy the full SHA
    845bcc4 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    0de2924 View commit details
    Browse the repository at this point in the history

Commits on Oct 8, 2024

  1. Use proper listGitRefs name

    adamziel committed Oct 8, 2024
    Configuration menu
    Copy the full SHA
    a4b8a09 View commit details
    Browse the repository at this point in the history