@o3r/rules-engine
Version:
This module provides a rule engine that can be executed on your Otter application to customize your application (translations, placeholders and configs) based on a json file generated by your CMS.
20 lines • 910 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.useRegisterActionHandlers = void 0;
const schematics_1 = require("@o3r/schematics");
/**
* Replace `actionHandlers.add` or `actionHandlers.delete` by `registerActionHandlers` or `unregisterActionHandlers` in file
* @param tree
*/
const useRegisterActionHandlers = (tree) => {
const files = (0, schematics_1.findFilesInTree)(tree.root, (file) => /\.actionHandlers\.(add|delete)/.test(tree.readText(file)));
files.forEach(({ content, path }) => {
tree.overwrite(path, content
.toString()
.replaceAll(/\.actionHandlers\.add/g, '.registerActionHandlers')
.replaceAll(/\.actionHandlers\.delete/g, '.unregisterActionHandlers'));
});
return tree;
};
exports.useRegisterActionHandlers = useRegisterActionHandlers;
//# sourceMappingURL=use-register-action-handlers.js.map