Skip to content

Commit 82c2969

Browse files
adamzielsejas
andauthored
Update Playground dependencies in package.json (#139)
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>
1 parent f23be25 commit 82c2969

File tree

7 files changed

+104
-61
lines changed

7 files changed

+104
-61
lines changed

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v18.13.0
1+
v18.18.2

package-lock.json

Lines changed: 90 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@
3131
"@codemirror/state": "6.2.0",
3232
"@codemirror/theme-one-dark": "6.1.1",
3333
"@codemirror/view": "6.9.3",
34-
"@php-wasm/node": "0.1.56",
35-
"@php-wasm/progress": "0.1.56",
36-
"@php-wasm/universal": "0.1.56",
37-
"@php-wasm/web": "0.1.57",
34+
"@php-wasm/node": "0.5.4",
35+
"@php-wasm/progress": "0.5.4",
36+
"@php-wasm/universal": "0.5.4",
37+
"@php-wasm/web": "0.5.4",
3838
"@uiw/react-codemirror": "^4.21.20",
39-
"@wp-playground/blueprints": "0.1.56",
40-
"@wp-playground/client": "0.2.0",
39+
"@wp-playground/blueprints": "0.5.4",
40+
"@wp-playground/client": "0.5.4",
4141
"classnames": "^2.3.2",
4242
"comlink": "^4.4.1",
4343
"compressible": "2.0.18",

packages/wp-now/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ To execute this Blueprint, create a file named `blueprint-example.json` and run
118118
"WP_HOME": "http://myurl.wpnow:8881",
119119
"WP_SITEURL": "http://myurl.wpnow:8881"
120120
},
121-
"virtualize": true
121+
"method": "define-before-run"
122122
}
123123
]
124124
}
@@ -140,7 +140,7 @@ The Blueprint to listen on port `80` will look like this:
140140
"WP_HOME": "http://myurl.wpnow",
141141
"WP_SITEURL": "http://myurl.wpnow"
142142
},
143-
"virtualize": true
143+
"method": "define-before-run"
144144
}
145145
]
146146
}
@@ -161,7 +161,7 @@ Run `wp-now start --blueprint=path/to/blueprint-example.json` where `blueprint-e
161161
"WP_DEBUG": true,
162162
"WP_DEBUG_LOG": true
163163
},
164-
"virtualize": true
164+
"method": "define-before-run"
165165
}
166166
]
167167
}
@@ -181,7 +181,7 @@ For example, if you run `wp-now start --blueprint=path/to/blueprint-example.json
181181
"consts": {
182182
"WP_DEBUG_LOG": "/var/www/html/wp-content/themes/atlas/example.log"
183183
},
184-
"virtualize": true
184+
"method": "define-before-run"
185185
}
186186
]
187187
}

packages/wp-now/src/tests/blueprints/wp-config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"WP_HOME": "http://127.0.0.1",
77
"WP_SITEURL": "http://127.0.0.1"
88
},
9-
"virtualize": true
9+
"method": "define-before-run"
1010
}
1111
]
1212
}

packages/wp-now/src/tests/blueprints/wp-debug.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"consts": {
66
"WP_DEBUG_LOG": "/var/www/html/wp-content/themes/fake/example.log"
77
},
8-
"virtualize": true
8+
"method": "define-before-run"
99
}
1010
]
1111
}

packages/wp-now/src/wp-now.ts

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ import getWpNowPath from './get-wp-now-path';
3232
import getWordpressVersionsPath from './get-wordpress-versions-path';
3333
import getSqlitePath from './get-sqlite-path';
3434

35-
function seemsLikeAPHPFile(path) {
36-
return path.endsWith('.php') || path.includes('.php/');
37-
}
38-
3935
async function applyToInstances(phpInstances: NodePHP[], callback: Function) {
4036
for (let i = 0; i < phpInstances.length; i++) {
4137
await callback(phpInstances[i]);
@@ -50,19 +46,6 @@ export default async function startWPNow(
5046
requestHandler: {
5147
documentRoot,
5248
absoluteUrl: options.absoluteUrl,
53-
isStaticFilePath: (path) => {
54-
try {
55-
const fullPath = options.documentRoot + path;
56-
return (
57-
php.fileExists(fullPath) &&
58-
!php.isDir(fullPath) &&
59-
!seemsLikeAPHPFile(fullPath)
60-
);
61-
} catch (e) {
62-
output?.error(e);
63-
return false;
64-
}
65-
},
6649
},
6750
};
6851

@@ -338,7 +321,7 @@ async function initWordPress(
338321
}
339322
await defineWpConfigConsts(php, {
340323
consts: wpConfigConsts,
341-
virtualize: true,
324+
method: 'define-before-run'
342325
});
343326

344327
return { initializeDefaultDatabase };

0 commit comments

Comments
 (0)