Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion scripts/validate.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,10 @@ export function run(args = process.argv.slice(2)) {
]);
validateCatalog(catalog, games, stubs);
mkdirSync(path.join(root, '.release'), { recursive: true });
writeFileSync(path.join(root, '.release', 'index.json.gz'), gzipSync(JSON.stringify({ version: 1, games: catalog, stubs })));
// The engine reference reader rejects unknown fields, so the index carries exactly the five
// row fields it declares; rating, genre and kind stay in data/catalog.json.
const rows = catalog.map(({ id, title, platform, repo: source, tier }) => ({ id, title, platform, repo: source, tier }));
writeFileSync(path.join(root, '.release', 'index.json.gz'), gzipSync(JSON.stringify({ version: 1, games: rows, stubs })));
for (const game of games) writeFileSync(path.join(root, '.release', `game-${game.id}.json`), JSON.stringify(game));
}
}
Expand Down
2 changes: 1 addition & 1 deletion tests/library.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ test('release assets keep the version-1 contract and exact asset set', t => {
assert.deepEqual(readdirSync(path.join(dir, '.release')).sort(), ['game-demo.json', 'game-second.json', 'index.json.gz']);
const index = JSON.parse(gunzipSync(readFileSync(path.join(dir, '.release', 'index.json.gz'))).toString());
assert.equal(index.version, 1);
assert.deepEqual(index.games, config);
assert.deepEqual(index.games, config.map(({ id, title, platform, repo, tier }) => ({ id, title, platform, repo, tier })));
const game = demoGame(source.sha);
assert.equal(readFileSync(path.join(dir, '.release', 'game-demo.json'), 'utf8'), JSON.stringify(game));
assert.doesNotThrow(() => validateGame(JSON.parse(readFileSync(path.join(dir, '.release', 'game-demo.json'), 'utf8'))));
Expand Down
Loading