MCPcopy
hub / github.com/compodoc/compodoc / findMainSourceFolder

Function findMainSourceFolder

src/utils/utils.ts:280–307  ·  view source on GitHub ↗
(files: string[])

Source from the content-addressed store, hash-verified

278}
279
280export function findMainSourceFolder(files: string[]) {
281 let mainFolder = '';
282 let mainFolderCount = 0;
283 let rawFolders = files.map(filepath => {
284 let shortPath = filepath.replace(process.cwd() + path.sep, '');
285 return path.dirname(shortPath);
286 });
287 let folders = {};
288 rawFolders = _.uniq(rawFolders);
289
290 for (let i = 0; i < rawFolders.length; i++) {
291 let sep = rawFolders[i].split(path.sep);
292 sep.forEach(folder => {
293 if (folders[folder]) {
294 folders[folder] += 1;
295 } else {
296 folders[folder] = 1;
297 }
298 });
299 }
300 for (let f in folders) {
301 if (folders[f] > mainFolderCount) {
302 mainFolderCount = folders[f];
303 mainFolder = f;
304 }
305 }
306 return mainFolder;
307}
308
309// Create a compilerHost object to allow the compiler to read and write files
310export function compilerHost(transpileOptions: any): ts.CompilerHost {

Callers 2

runWebServerMethod · 0.90
runWatchMethod · 0.90

Calls 3

mapMethod · 0.45
replaceMethod · 0.45
forEachMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…