Files
wp-asciiplayer/scripts/vendor.mjs
LamGC f04600c37b 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.
2026-10-12 17:56:08 +08:00

16 lines
843 B
JavaScript

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.`);