@o3r/core
Version:
Core of the Otter Framework
23 lines • 885 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.updateConfiguration = void 0;
const schematics_1 = require("@o3r/schematics");
const matchingRegex = /(Configuration)<\s*["'](?:strict|legacy)["']\s*>/g;
/**
* Rule to update the configuration declaration
* As configuration cannot be legacy anymore,
* we remove the parametrized type of the interface
* @param tree
*/
const updateConfiguration = (tree) => {
const files = (0, schematics_1.getFilesWithExtensionFromTree)(tree, '.ts');
files.forEach((file) => {
const text = tree.readText(file);
const matches = Array.from(text.matchAll(matchingRegex));
if (matches.length > 0) {
tree.overwrite(file, text.replaceAll(matchingRegex, '$1'));
}
});
};
exports.updateConfiguration = updateConfiguration;
//# sourceMappingURL=configuration.js.map