mirror of
https://github.com/LamGC/wp-asciiplayer.git
synced 2026-10-12 23:33:55 +00:00
Refresh player with native block editor preview and local assets
Preserve shortcode rendering, normalize options, bundle the player locally, and add reproducible packaging and WordPress integration tests.
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import { copyFile, mkdir, readFile } from 'node:fs/promises';
|
||||
import path from 'node:path';
|
||||
|
||||
const root = path.resolve(import.meta.dirname, '..');
|
||||
const pkg = JSON.parse(await readFile(path.join(root, 'node_modules/asciinema-player/package.json'), 'utf8'));
|
||||
if (pkg.version !== '3.17.0') throw new Error(`Unexpected player version: ${pkg.version}`);
|
||||
await mkdir(path.join(root, 'build'), { recursive: true });
|
||||
for (const [source, destination] of [
|
||||
['dist/bundle/asciinema-player.min.js', 'player.js'],
|
||||
['dist/bundle/asciinema-player.css', 'player.css'],
|
||||
]) {
|
||||
await copyFile(path.join(root, 'node_modules/asciinema-player', source), path.join(root, 'build', destination));
|
||||
}
|
||||
await copyFile(path.join(root, 'block.json'), path.join(root, 'build/block.json'));
|
||||
console.log(`Bundled local asciinema-player ${pkg.version}; no CDN is used.`);
|
||||
Reference in New Issue
Block a user