Files
autotest/editor/scripts/action-catalog/index.js
T
2026-05-22 13:46:02 +02:00

24 lines
572 B
JavaScript

const fs = require('fs');
const path = require('path');
const CATALOG_PATH = path.join(__dirname, 'catalog.json');
let cachedCatalog = null;
function loadActionCatalog(forceReload = false) {
if (cachedCatalog && !forceReload) {
return cachedCatalog;
}
const raw = fs.readFileSync(CATALOG_PATH, 'utf-8');
cachedCatalog = JSON.parse(raw);
return cachedCatalog;
}
function getAction(actionKey) {
const catalog = loadActionCatalog();
return catalog.actions ? catalog.actions[actionKey] : undefined;
}
module.exports = { loadActionCatalog, getAction };