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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 6x 6x 6x 6x 1x 5x 5x 5x 5x 5x 6x 6x 1x 1x | import * as path from 'path'; import ConfigurationRepository from '../repositories/config.repository'; import FileEngine from '../../infrastructure/files/file.engine'; import Logger from '../../infrastructure/logging/logger'; import { readTsconfigFile } from '../../infrastructure/files/tsconfig.file.util'; export class HandleTsconfigFile { private static instance: HandleTsconfigFile; constructor() {} public static getInstance() { Eif (!HandleTsconfigFile.instance) { HandleTsconfigFile.instance = new HandleTsconfigFile(); } return HandleTsconfigFile.instance; } public async handle() { /** * 1. is tsconfig file provided with -p flag * 1b. if file doesn't exist, error and exit * 3. log that we handle the file * 4. read it * 5. find attributes : files, exclude, include */ return new Promise(async (resolve, reject) => { let tsconfigFileName = ConfigurationRepository.internalConfiguration.tsconfig; let cwdLocal; Eif (tsconfigFileName) { if (!FileEngine.existsSync(tsconfigFileName)) { reject(`${tsconfigFileName} file was not found in the current directory`); } else { let tsconfigFilePath = tsconfigFileName.indexOf(process.cwd()); Iif (tsconfigFilePath !== -1) { ConfigurationRepository.internalConfiguration.tsconfigFilePath = tsconfigFileName.replace( process.cwd() + path.sep, '' ); } ConfigurationRepository.internalConfiguration.tsconfigFilePath = path.join( path.join(process.cwd(), path.dirname(tsconfigFileName)), path.basename(tsconfigFileName) ); cwdLocal = ConfigurationRepository.internalConfiguration.tsconfigFilePath .split(path.sep) .slice(0, -1) .join(path.sep); Logger.info(`Using tsconfig file : ${tsconfigFileName}`); } } else { Logger.warn( 'No tsconfig file provided with flags, trying to find it at root level' ); } let tsConfigFile = readTsconfigFile( ConfigurationRepository.internalConfiguration.tsconfigFilePath ); resolve(tsConfigFile); }); } } export default HandleTsconfigFile.getInstance(); |