UNPKG

typescript-member-signatures

Version:

Command line tool to extract given interface member signatures as JSON strings, recursively in the extends chain with the purpose of documentation

26 lines 819 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const cannabis_1 = require("cannabis"); const fs_1 = require("fs"); const glob_1 = require("glob"); const path_1 = require("path"); const ts_morph_1 = require("ts-morph"); function getProject(o) { let p; if (o.project) { p = new ts_morph_1.Project({ tsConfigFilePath: o.project, addFilesFromTsConfig: true }); } else { p = new ts_morph_1.Project(); p.createDirectory('src'); } const root = cannabis_1.setProject(p).getRootDirectory(); if (o.files) { glob_1.sync(o.files).forEach(f => { root.createSourceFile(path_1.basename(f), fs_1.readFileSync(f).toString()); }); } return root; } exports.getProject = getProject; //# sourceMappingURL=getProject.js.map