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.
This commit is contained in:
@@ -14,6 +14,32 @@ import {
|
||||
|
||||
const roots = [];
|
||||
|
||||
test('application composition cannot import or re-export any concrete game',async()=>{
|
||||
const root=await createFixtureRoot();
|
||||
await writeFixture(root,'framework/sdk/contracts/value.ts','export type Value=string;');
|
||||
await writeFixture(root,'games/a/game.ts','export const game=1;');
|
||||
await writeFixture(root,'app/entry.ts',"export {game} from '../games/a/game.ts';");
|
||||
const violations=scanImportBoundaries({frameworkDir:join(root,'framework'),gamesDir:join(root,'games'),appDir:join(root,'app')});
|
||||
assert.equal(violations.length,1);assert.match(violations[0].message,/app composition cannot import/);
|
||||
});
|
||||
|
||||
test('public Cocos code cannot import a concrete game or application registry',async()=>{
|
||||
const root=await createFixtureRoot();
|
||||
await writeFixture(root,'framework/sdk/contracts/value.ts','export type Value=string;');
|
||||
await writeFixture(root,'games/a/game.ts','export const game=1;');
|
||||
await writeFixture(root,'app/registry.ts','export const registry=1;');
|
||||
await writeFixture(root,'scripts/Startup.ts',"import {game} from '../games/a/game.ts';import {registry} from '../app/registry.ts';");
|
||||
const violations=scanImportBoundaries({frameworkDir:join(root,'framework'),gamesDir:join(root,'games'),publicDirs:[join(root,'scripts')],appDir:join(root,'app')});
|
||||
assert.equal(violations.length,2);assert.ok(violations.every(v=>/public.*games/.test(v.message)));
|
||||
});
|
||||
|
||||
test('games cannot inherit another game implementation',async()=>{
|
||||
const root=await createFixtureRoot();
|
||||
await writeFixture(root,'games/a/view.ts','export class View{}');
|
||||
await writeFixture(root,'games/b/view.ts',"import {View} from '../a/view.ts';export class Other extends View{}");
|
||||
assert.match(scan(root)[0].message,/another game/);
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
await Promise.all(roots.splice(0).map((root) => rm(root, { recursive: true, force: true })));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user