UNPKG

@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.

23 lines 976 B
"use strict"; 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) => file.endsWith('.ts')); files.forEach(({ content, path }) => { if (!/\.actionHandlers\.(add|delete)/.test(content.toString())) { return; } 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