Files
joywayer 35216f75e7 feat: integrate room framework and isolated subgame bundles
Complete room UI and protocol integration, move game definitions and resources behind bundle entries, publish authoritative version XML, and document single-game builds. Include all current resource changes and experiment artifacts.
2026-09-09 03:13:18 +08:00

21 lines
1.8 KiB
JavaScript

const fs=require('fs'),path=require('path'),assert=require('node:assert/strict');
const project=path.resolve(__dirname,'../../cocoscreator_projects/YouleNexus');
const output=path.join(project,'build/web-mobile-subgame-decoupled-final');
const settings=JSON.parse(fs.readFileSync(path.join(output,'src/settings.json'),'utf8'));
const expected=['game-erqiwang','internal','main','resources','version-erqiwang'];
assert.deepEqual([...settings.assets.projectBundles].sort(),expected);
assert.deepEqual(fs.readdirSync(path.join(output,'assets')).sort(),expected);
const walk=dir=>fs.readdirSync(dir,{withFileTypes:true}).flatMap(e=>e.isDirectory()?walk(path.join(dir,e.name)):[path.join(dir,e.name)]);
const files=walk(output).filter(f=>/\.(js|json|txt)$/.test(f));
const text=files.map(f=>fs.readFileSync(f,'utf8')).join('\n');
for(const marker of ['createTemplateGame','TemplateCreateRoomView','TemplateRoomView','GameEntry_Game_Surface_3'])assert(!text.includes(marker),marker+' leaked');
const uuids=walk(path.join(project,'assets/games/template')).filter(f=>f.endsWith('.meta')).map(f=>JSON.parse(fs.readFileSync(f,'utf8')).uuid);
for(const uuid of uuids)assert(!text.includes(uuid),'template resource UUID leaked: '+uuid);
assert(text.includes('GameEntry_erqiwang'));
assert(fs.readFileSync(path.join(output,'version.xml')).equals(fs.readFileSync(path.join(project,'assets/games/erqiwang/resources/erqiwang/version.xml'))));
const version=JSON.parse(fs.readFileSync(path.join(output,'assets/version-erqiwang/config.json'),'utf8'));
assert(Object.values(version.paths).some(v=>v[0]==='erqiwang/version'));
const result={output,bundles:settings.assets.projectBundles,templateUuidCount:uuids.length,templateCodeAbsent:true,versionXmlExact:true};
fs.writeFileSync(path.join(__dirname,'build-audit.json'),JSON.stringify(result,null,2));
console.log(JSON.stringify(result,null,2));