Skip to content

Commit

Permalink
Interactive code block: Update to the latest wp-playground/client ver…
Browse files Browse the repository at this point in the history
…sion (#86)

This blog post is broken because it uses the old playground client
library:

https://adamadam.blog/2023/04/12/interactive-intro-to-wordpress-playground-public-api/

This commit updates the playground client to the most recent version
released in npm. This should not affect any other package in the
monorepo.
  • Loading branch information
adamziel authored Jul 1, 2023
1 parent bfeec20 commit 8d553b9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
10 changes: 10 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"@php-wasm/universal": "0.1.56",
"@php-wasm/web": "0.1.57",
"@wp-playground/blueprints": "0.1.56",
"@wp-playground/client": "0.2.0",
"classnames": "^2.3.2",
"comlink": "^4.4.1",
"compressible": "2.0.18",
Expand Down
8 changes: 3 additions & 5 deletions packages/interactive-code-block/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ export default defineConfig({

viteStaticCopy({
targets: [
{
src: path('../../dist/packages/playground/client/index.js'),
dest: 'assets/',
rename: () => 'playground-client.js',
},
{
src: new URL('src/lib/block/editor.css', import.meta.url)
.pathname,
Expand Down Expand Up @@ -78,6 +73,7 @@ export default defineConfig({
preserveEntrySignatures: 'strict',
plugins: [react()],
input: {
['playground-client']: '@wp-playground/client',
['comlink']: 'comlink/dist/esm/comlink.mjs',
['editor']: path('src/lib/block/editor.tsx'),
['view']: path('src/lib/block/view.ts'),
Expand All @@ -93,6 +89,8 @@ export default defineConfig({
entryFileNames: (entryInfo) => {
if (entryInfo.name.includes('comlink')) {
return 'assets/comlink.js';
} else if (entryInfo.name.includes('playground-client')) {
return 'assets/playground-client.js';
}
return 'assets/[name]-[hash].js';
},
Expand Down

0 comments on commit 8d553b9

Please sign in to comment.