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

Update Playground dependencies to 0.6.7 #157

Merged

Conversation

sejas
Copy link
Collaborator

@sejas sejas commented Feb 8, 2024

What?

  • Update playground dependencies to 0.6.3
  • Adapt wp-now code to use the modified APIs.
    • php.request uses body instead of formData
    • wp-login.php is required to login users through the blueprint step.

Why?

To remove crypto dependency in node applications

How?

Updating the main package.json

Testing Instructions

  • Run nvm use && npm install
  • Run npm run build
  • Run node dist/packages/wp-now/cli.js start --blueprint=b.json where b.json is a blueprint with
  • Observe the blueprint executes correctly without any error about TypeError: crypto.randomUUID is not a function
{
	"$schema": "https://playground.wordpress.net/blueprint-schema.json",
	"landingPage": "/wp-admin/plugins.php",
	"preferredVersions": {
		"php": "8.0",
		"wp": "latest"
	},
	"steps": [
		{
			"step": "login",
			"username": "admin",
			"password": "password"
		},
		{
			"step": "installPlugin",
			"pluginZipFile": {
				"resource": "wordpress.org/plugins",
				"slug": "notification"
			},
			"options": {
				"activate": true
			}
		}
	]
}

@sejas
Copy link
Collaborator Author

sejas commented Feb 8, 2024

The fix introduced on WordPress/wordpress-playground#1000, seems to be failing.

The "transpiled" JS is like:

typeof crypto > "u" && import("./__vite-browser-external-2447137e.js").then((e) => {
  global.crypto = e;
});

Where ./__vite-browser-external-2447137e.js:

const e = {};
export {
  e as default
};

So it's not really importing the cyrpto library from Node.js

@sejas sejas self-assigned this Feb 20, 2024
@sejas
Copy link
Collaborator Author

sejas commented Feb 20, 2024

I confirm after upgrading the dependencies, Now I can run blueprints:

❯ npx nx build wp-now
❯ node dist/packages/wp-now/cli.js start --blueprint=b.json
Starting the server......
directory: /Users/macbookpro/proyectos/a8c/playground-tools
mode: playground
php: 8.0
wp: latest
WordPress latest folder already exists. Skipping download.
SQLite folder already exists. Skipping download.
blueprint steps: 2
Blueprint step completed: login
Blueprint step completed: installPlugin
Server running at http://localhost:8881

@sejas sejas changed the title Update Playground dependencies to 0.6.1 Update Playground dependencies to 0.6.3 Feb 20, 2024
@sejas sejas requested a review from adamziel February 20, 2024 14:37
@sejas
Copy link
Collaborator Author

sejas commented Feb 20, 2024

@adamziel , this PR is ready for review. I can release wp-now after this one is merged.

Comment on lines +1 to +5
<?php

// File needs to exist to avoid throwing a 404 error

header('Location: /wp-admin/');
Copy link
Collaborator Author

@sejas sejas Feb 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sejas sejas requested a review from bgrgicak February 23, 2024 10:27
Copy link
Collaborator

@bgrgicak bgrgicak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

Copy link
Collaborator

@adamziel adamziel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, good work @sejas !

@bgrgicak
Copy link
Collaborator

bgrgicak commented Mar 5, 2024

@sejas 0.6.5 is out. We should update this branch to the latest version.

@adamziel adamziel changed the title Update Playground dependencies to 0.6.3 Update Playground dependencies to 0.6.7 Mar 6, 2024
@adamziel adamziel merged commit 5e863ce into trunk Mar 6, 2024
2 checks passed
@adamziel adamziel deleted the update/playground-dependencies-to-introduce-crypto-globally branch March 6, 2024 14:44
@sejas
Copy link
Collaborator Author

sejas commented Mar 6, 2024

@adamziel , @bgrgicak thanks for reviewing and updating the dependencies to 0.6.7 ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants