Skip to content

Issues using WordPress Playground VSCode extension with Learn WordPress project #39

Open

Description

@adamwoodnz

I've been testing the VSCode extension with the Learn.WordPress.org project repo.

Context: https://wordpress.slack.com/archives/C04EWKGDJ0K/p1684877322935099?thread_ts=1684852995.310519&cid=C04EWKGDJ0K

This repo has a custom plugin and child theme, so running from the project root would be the ideal local dev scenario, and this is how we currently run the project with wp-env.

The things I tried were:

Setup

Fresh clone of https://github.com/WordPress/Learn
Basic install of dependencies and build: yarn, composer install, yarn workspaces run build

Try full project:

Click Start WordPress Server button from project root.

Result: Notification that server started but browser never loads site.

Try Theme only:

Click Start WordPress Server button from theme folder (https://github.com/WordPress/Learn/tree/trunk/wp-content/themes/pub/wporg-learn-2020)

Result: Notification that server started, browser loads site but TT3 theme is active because parent theme isn’t available.

Try Plugin only:

Click Start WordPress Server button from plugin folder (https://github.com/WordPress/Learn/tree/trunk/wp-content/plugins/wporg-learn)

Result: Notification that server started but browser never loads site.

Environment: About VSCode

Version: 1.78.2 (Universal)
Commit: b3e4e68a0bc097f0ae7907b217c1119af9e03435
Date: 2023-05-10T14:44:45.204Z
Electron: 22.5.2
Chromium: 108.0.5359.215
Node.js: 16.17.1
V8: 10.8.168.25-electron.0
OS: Darwin arm64 21.6.0
Sandboxed: No

Activity

  1. danielbachhuber commented on May 31, 2023

    @danielbachhuber
    Member

    I'll look into this. I think we need to refresh the VS Code Extension's internals (#4) to get closer to the behavior you expect. It would also be nice to add some debugging mechanism for the crashes (#36).

    Result: Notification that server started, browser loads site but TT3 theme is active because parent theme isn’t available.

    @adamwoodnz Out of curiosity, what is your expected behavior for this scenario? Related #33

  2. adamwoodnz commented on Jun 1, 2023

    @adamwoodnz
    Author

    Thanks! Yeah debugging info would be useful, I did look in the Output tab but didn't see anything. I see on #36 that others have.

    @adamwoodnz Out of curiosity, what is your expected behavior for this scenario?

    For this scenario I've just tried again to see exactly what the state was in the admin, but I now can't start the server. Not sure what changed :(

    Screen Shot 2023-06-01 at 11 52 51 AM

    From memory what I saw in wp-admin is that the Learn child theme (wporg-learn-2020) was installed but couldn't be activated due to the parent (wporg) not being mounted.

    Ideally the child theme would be installed and activated, but if that's not possible then at least having the parent installed to allow child activation would be my expectation. The parent is obviously sitting up a level from where the command is run.

    Worth noting that with this particular project (and maybe most website projects in general) we wouldn't be developing the theme or plugin independently, and the 'full project' scenario above is really the critical workflow.

  3. danielbachhuber commented on Jun 1, 2023

    @danielbachhuber
    Member

    @adamwoodnz As a very first step, we published a new version of the VS Code Extension this morning to start to unblock this 😊

    Here's what I ran to set things up:

    git clone git@github.com:WordPress/Learn.git wordpress-learn
    cd wordpress-learn
    yarn
    composer install
    yarn workspaces run build
    

    When I clicked 'Start WordPress Server' in the project directory, here's what I see:

    image

    Notably, it's starting in 'playground' mode and didn't mount your wp-content directory.

    When I clicked 'Start WordPress Server' in the wp-content directory, here's what I see:

    image image image

    It started in the 'wp-content' mode (expected) but is having trouble with the theme paths. The plugins are mounted but it looks like Gutenberg is out of date and fataling for some reason.

    When I clicked 'Start WordPress Server' in the wp-content/plugins/gutenberg directory, here's what I see:

    image

    Gutenberg is mounted as expected but probably fatals when it's attempted to be auto-activated.

    Launching in a child theme will be handled by #33

    It seems like we have a bit of work to do if we want to offer the VS Code Extension or wp-now for WordCamp Europe 😊 cc @adamziel @sejas

    Also, while I'm thinking of it: I wonder if projectPath should be defined as the git repo directory if we look upwards and find one.

  4. danielbachhuber commented on Jun 1, 2023

    @danielbachhuber
    Member

    When I clicked 'Start WordPress Server' in the wp-content directory, here's what I see:

    This might just be a rough NUX. The wporg-learn-2020 theme seemed to activate just fine, although it requires some plugins to be activated too.

    Here's what I see on the frontend:

    image

    It seems like links are hardcoded though, and pretty permalinks don't work:

    image

    I guess we might need the Blueprint thing (#9) to deliver a pre-configured state...

  5. adamziel commented on Jun 2, 2023

    @adamziel
    Collaborator

    @danielbachhuber Yay for Blueprints. Using them would also make it easy to preview Pull Requests for that repo in the browser.

  6. sejas commented on Jun 2, 2023

    @sejas
    Collaborator

    I think to fully support Learn we will need to support mapping directories:

    	"mappings": {
    		".htaccess": "./.wp-env/.htaccess",
    		"wp-content": "./wp-content",
    		"wp-content/mu-plugins/0-sandbox.php": "./.wp-env/0-sandbox.php",
    		"wp-content/uploads/wporg_events.sql": "./.wp-env/wporg_events.sql",
    		"wp-content/uploads/wporg_locales.sql": "./.wp-env/wporg_locales.sql",
    		"bin": "./bin"
    	}
    
  7. danielbachhuber commented on Jun 2, 2023

    @danielbachhuber
    Member

    Probably the ability to define wp-config.php constants too #17

  8. adamziel commented on Jun 2, 2023

    @adamziel
    Collaborator

    Constants can be defined with Blueprints (as outlined in #17). The mappings cannot, though.

  9. removed their assignment
    on Jun 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions