Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 1x 53x 53x 53x 267x 267x 50x 217x 2x 53x 51x 53x | import { joinPathFragments, logger } from '@nx/devkit'; import type { FsTree } from 'nx/src/generators/tree'; import { directoryExists } from 'nx/src/utils/fileutils'; export const findFiles = (tree: FsTree, src: string, filter: '.html' | '.json' | string = '.html', result = { stderr: '', stdout: '' }) => { Iif (!directoryExists(src)) { const message = `Source directory ${src} does not exist`; logger.error(message); result.stderr = message; return result; } const files = tree.children(src); for (let i = 0, max = files.length; i < max; i += 1) { const filePath = joinPathFragments(src, files[i]); if (!tree.isFile(filePath)) { findFiles(tree, filePath, filter, result); } else if (filePath.endsWith(filter)) { result.stdout += result.stdout.length === 0 ? filePath : ` ${filePath}`; } } if (result.stdout.length === 0) { logger.info(`${src} does not container ${filter} files.`); } return result; }; |