(config: BuildConfig, tsFilePath: string)
| 151 | * well formed and relative import paths are correct. |
| 152 | */ |
| 153 | export function validateTypeScriptFile(config: BuildConfig, tsFilePath: string) { |
| 154 | const tsconfigPath = join(config.rootDir, 'tsconfig.json'); |
| 155 | const tsconfigResults = ts.readConfigFile(tsconfigPath, ts.sys.readFile); |
| 156 | const tsconfig = ts.parseJsonConfigFileContent( |
| 157 | tsconfigResults.config, |
| 158 | ts.sys, |
| 159 | config.rootDir, |
| 160 | undefined, |
| 161 | tsconfigPath |
| 162 | ); |
| 163 | const program = ts.createProgram([tsFilePath], tsconfig.options); |
| 164 | |
| 165 | const tsDiagnostics = [ |
| 166 | ...program.getSemanticDiagnostics(), |
| 167 | ...program.getSyntacticDiagnostics(), |
| 168 | ...program.getDeclarationDiagnostics(), |
| 169 | ...program.getGlobalDiagnostics(), |
| 170 | ...program.getConfigFileParsingDiagnostics(), |
| 171 | ...program.getOptionsDiagnostics(), |
| 172 | ]; |
| 173 | |
| 174 | if (tsDiagnostics.length > 0) { |
| 175 | const host = { |
| 176 | getCurrentDirectory: () => ts.sys.getCurrentDirectory(), |
| 177 | getNewLine: () => ts.sys.newLine, |
| 178 | getCanonicalFileName: (f: string) => f, |
| 179 | }; |
| 180 | throw new Error(ts.formatDiagnostics(tsDiagnostics, host)); |
| 181 | } |
| 182 | } |
| 183 | |
| 184 | async function validatePackageJson(config: BuildConfig, pkg: PackageJSON, errors: string[]) { |
| 185 | async function validatePath(path: string) { |
no test coverage detected
searching dependent graphs…