@rxap/schematics-ts-morph
Version:
This package provides utilities for manipulating TypeScript code using ts-morph, particularly for Angular and NestJS projects. It offers functions to add, coerce, and modify code elements like classes, methods, decorators, and imports. The package also in
15 lines • 1.02 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CoerceComponentClassRule = CoerceComponentClassRule;
const ts_morph_1 = require("@rxap/ts-morph");
const coerce_source_file_1 = require("../coerce-source-file");
const ts_morph_transform_1 = require("../ts-morph-transform");
function CoerceComponentClassRule(options) {
const { componentName, selector, tsMorphTransform, } = options;
return (0, ts_morph_transform_1.TsMorphAngularProjectTransformRule)(options, (project) => {
const sourceFile = (0, coerce_source_file_1.CoerceSourceFile)(project, `/${componentName}.component.ts`);
const { classDeclaration, componentDecoratorObject } = (0, ts_morph_1.CoerceComponent)(sourceFile, componentName, { selector, styleUrls: true, templateUrl: true });
tsMorphTransform === null || tsMorphTransform === void 0 ? void 0 : tsMorphTransform(project, sourceFile, classDeclaration, componentDecoratorObject);
});
}
//# sourceMappingURL=coerce-component-class.js.map