UNPKG

@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

18 lines 828 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FindComponentSourceFile = FindComponentSourceFile; const schematics_utilities_1 = require("@rxap/schematics-utilities"); function FindComponentSourceFile(name, project) { const className = (0, schematics_utilities_1.CoerceSuffix)((0, schematics_utilities_1.classify)(name), 'Component'); try { return project.getSourceFileOrThrow(sourceFile => !!sourceFile.getClass(className)); } catch (e) { console.debug(`Could not find class '${className}' in any of this files.`, project .getSourceFiles() .map(sourceFile => sourceFile.getFilePath()) .filter(filePath => filePath.match(/\.component\.ts/))); throw e; } } //# sourceMappingURL=find-component-source-file.js.map