Add bundled English and Simplified Chinese UI translations (1.1.0-dev)

This commit is contained in:
2026-10-14 10:28:49 +08:00
parent 41395f4102
commit 3b2b213b6f
24 changed files with 1699 additions and 32 deletions
+10 -1
View File
@@ -1,5 +1,6 @@
import { copyFile, mkdir, readFile } from 'node:fs/promises';
import { copyFile, mkdir, readFile, writeFile } from 'node:fs/promises';
import path from 'node:path';
import { createHash } from 'node:crypto';
const root = path.resolve(import.meta.dirname, '..');
const pkg = JSON.parse(await readFile(path.join(root, 'node_modules/asciinema-player/package.json'), 'utf8'));
@@ -13,3 +14,11 @@ for (const [source, destination] of [
}
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.`);
// Content hashes avoid stale assets across successive builds of 1.1.0-dev.
const versions = [];
for (const file of ['player.js', 'player.css', 'style-index.css', 'index.css']) {
const hash = createHash('sha256').update(await readFile(path.join(root, 'build', file))).digest('hex').slice(0, 16);
versions.push(`'${file}' => '${hash}'`);
}
await writeFile(path.join(root, 'build/runtime.asset.php'), `<?php return array(${versions.join(', ')});\n`);