Restore v0.1 and v0.2 archives with separate progress, publish the curved v0.3 campaign, and document the original 24-level design with reproducible evidence. Refine board presentation and movement, and keep video lab tooling within its own directory.
16 lines
1.0 KiB
JavaScript
16 lines
1.0 KiB
JavaScript
import { readFile, writeFile } from 'node:fs/promises';
|
|
import { createHash } from 'node:crypto';
|
|
|
|
const root=new URL('../',import.meta.url);
|
|
const manifest=JSON.parse(await readFile(new URL('levels/versions/provenance.json',root),'utf8'));
|
|
const archives={};
|
|
for(const source of manifest.versions) {
|
|
const bytes=await readFile(new URL(source.archivePath,root));
|
|
if(createHash('sha256').update(bytes).digest('hex')!==source.sha256)throw new Error(`Historical archive changed: ${source.version}`);
|
|
const levels=JSON.parse(bytes.toString('utf8'));
|
|
if(levels.length!==source.levelCount)throw new Error(`Historical level count changed: ${source.version}`);
|
|
archives[source.version]=levels;
|
|
}
|
|
await writeFile(new URL('src/levels-archive.js',root),'// Generated by npm run levels:versions from byte-preserved historical JSON.\nexport const ARCHIVED_LEVELS = '+JSON.stringify(archives)+';\n');
|
|
console.log('Historical versions synchronized: '+Object.entries(archives).map(([id,levels])=>`${id} (${levels.length} levels)`).join(', '));
|