feat: More bonus (exponential) and method to list icons needed
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
// Loads the game data from disk (the browser loads the same files over HTTP).
|
||||
// Shared by the tests and the scripts in this folder.
|
||||
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { buildContext } from '../public/js/engine/context.js';
|
||||
import { DATA_FILES } from '../public/js/services/data.js';
|
||||
|
||||
export const PUBLIC_DIR = fileURLToPath(new URL('../public/', import.meta.url));
|
||||
|
||||
export const readJson = (relativePath) => JSON.parse(readFileSync(PUBLIC_DIR + relativePath, 'utf8'));
|
||||
|
||||
export function loadContext() {
|
||||
const entries = Object.entries(DATA_FILES).map(([key, file]) => [key, readJson(`data/${file}.json`)]);
|
||||
return buildContext(Object.fromEntries(entries));
|
||||
}
|
||||
Reference in New Issue
Block a user