UNPKG

@rxap/ts-morph

Version:

Provides utilities for manipulating TypeScript code using the ts-morph library. It offers a fluent API to add, modify, and remove code elements such as classes, decorators, imports, and properties in both Angular and NestJS projects. This package simplifi

19 lines 975 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CoerceDefaultClassExport = CoerceDefaultClassExport; const ts_morph_1 = require("ts-morph"); const coerce_default_export_1 = require("./coerce-default-export"); require("colors"); function CoerceDefaultClassExport(sourceFileOrClassDeclaration) { const sourceFile = sourceFileOrClassDeclaration.isKind(ts_morph_1.SyntaxKind.SourceFile) ? sourceFileOrClassDeclaration : sourceFileOrClassDeclaration.getSourceFile(); const classDeclaration = sourceFileOrClassDeclaration.isKind(ts_morph_1.SyntaxKind.SourceFile) ? sourceFileOrClassDeclaration.getClasses()[0] : sourceFileOrClassDeclaration; if (!classDeclaration) { console.log(`No class declaration in source file: ${sourceFile.getFilePath()}`.red); } else { (0, coerce_default_export_1.CoerceDefaultExport)(classDeclaration); } } //# sourceMappingURL=coerce-default-class-export.js.map