Skip to content

Commit

Permalink
Update Playground dependencies in package.json (#139)
Browse files Browse the repository at this point in the history
Updates the versions of WordPress Playground packages and makes the
necessary adjustments to make the tests work with these new version.
WordPress Playground `0.5.4` is compatible with Node.js v18 via
polyfills, which means wp-now will now be able to use Blueprint steps
like `installPlugin`.

Co-authored-by: sejas <antonio@sejas.es>
  • Loading branch information
adamziel and sejas authored Jan 11, 2024
1 parent f23be25 commit 82c2969
Show file tree
Hide file tree
Showing 7 changed files with 104 additions and 61 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18.13.0
v18.18.2
120 changes: 90 additions & 30 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
"@codemirror/state": "6.2.0",
"@codemirror/theme-one-dark": "6.1.1",
"@codemirror/view": "6.9.3",
"@php-wasm/node": "0.1.56",
"@php-wasm/progress": "0.1.56",
"@php-wasm/universal": "0.1.56",
"@php-wasm/web": "0.1.57",
"@php-wasm/node": "0.5.4",
"@php-wasm/progress": "0.5.4",
"@php-wasm/universal": "0.5.4",
"@php-wasm/web": "0.5.4",
"@uiw/react-codemirror": "^4.21.20",
"@wp-playground/blueprints": "0.1.56",
"@wp-playground/client": "0.2.0",
"@wp-playground/blueprints": "0.5.4",
"@wp-playground/client": "0.5.4",
"classnames": "^2.3.2",
"comlink": "^4.4.1",
"compressible": "2.0.18",
Expand Down
8 changes: 4 additions & 4 deletions packages/wp-now/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ To execute this Blueprint, create a file named `blueprint-example.json` and run
"WP_HOME": "http://myurl.wpnow:8881",
"WP_SITEURL": "http://myurl.wpnow:8881"
},
"virtualize": true
"method": "define-before-run"
}
]
}
Expand All @@ -140,7 +140,7 @@ The Blueprint to listen on port `80` will look like this:
"WP_HOME": "http://myurl.wpnow",
"WP_SITEURL": "http://myurl.wpnow"
},
"virtualize": true
"method": "define-before-run"
}
]
}
Expand All @@ -161,7 +161,7 @@ Run `wp-now start --blueprint=path/to/blueprint-example.json` where `blueprint-e
"WP_DEBUG": true,
"WP_DEBUG_LOG": true
},
"virtualize": true
"method": "define-before-run"
}
]
}
Expand All @@ -181,7 +181,7 @@ For example, if you run `wp-now start --blueprint=path/to/blueprint-example.json
"consts": {
"WP_DEBUG_LOG": "/var/www/html/wp-content/themes/atlas/example.log"
},
"virtualize": true
"method": "define-before-run"
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion packages/wp-now/src/tests/blueprints/wp-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"WP_HOME": "http://127.0.0.1",
"WP_SITEURL": "http://127.0.0.1"
},
"virtualize": true
"method": "define-before-run"
}
]
}
2 changes: 1 addition & 1 deletion packages/wp-now/src/tests/blueprints/wp-debug.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"consts": {
"WP_DEBUG_LOG": "/var/www/html/wp-content/themes/fake/example.log"
},
"virtualize": true
"method": "define-before-run"
}
]
}
19 changes: 1 addition & 18 deletions packages/wp-now/src/wp-now.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ import getWpNowPath from './get-wp-now-path';
import getWordpressVersionsPath from './get-wordpress-versions-path';
import getSqlitePath from './get-sqlite-path';

function seemsLikeAPHPFile(path) {
return path.endsWith('.php') || path.includes('.php/');
}

async function applyToInstances(phpInstances: NodePHP[], callback: Function) {
for (let i = 0; i < phpInstances.length; i++) {
await callback(phpInstances[i]);
Expand All @@ -50,19 +46,6 @@ export default async function startWPNow(
requestHandler: {
documentRoot,
absoluteUrl: options.absoluteUrl,
isStaticFilePath: (path) => {
try {
const fullPath = options.documentRoot + path;
return (
php.fileExists(fullPath) &&
!php.isDir(fullPath) &&
!seemsLikeAPHPFile(fullPath)
);
} catch (e) {
output?.error(e);
return false;
}
},
},
};

Expand Down Expand Up @@ -338,7 +321,7 @@ async function initWordPress(
}
await defineWpConfigConsts(php, {
consts: wpConfigConsts,
virtualize: true,
method: 'define-before-run'
});

return { initializeDefaultDatabase };
Expand Down

0 comments on commit 82c2969

Please sign in to comment.