Comparing version 1.0.0 to 1.1.0
@@ -45,3 +45,2 @@ #!/usr/bin/env node | ||
// TODO: Finish --js | ||
// TODO: Add --update | ||
process.exit(0); | ||
@@ -62,3 +61,5 @@ } | ||
let absTsconfDirName; | ||
let tsconfFilename; | ||
let tsconfFiles; | ||
let parsedTsConf; | ||
if (conf.verbose) { | ||
@@ -83,3 +84,5 @@ isVerbose = true; | ||
verbose('Parsing tsconfig'); | ||
tsconf = ts.parseConfigFileTextToJson('test', file.toString()); | ||
tsconfFilename = path_1.default.basename(absTsconfPath); | ||
tsconf = ts.parseConfigFileTextToJson(tsconfFilename, file.toString()); | ||
parsedTsConf = ts.parseJsonConfigFileContent(tsconf.config, ts.sys, absTsconfDirName, undefined, tsconfFilename); | ||
tsconfFiles = tsconf.config.files | ||
@@ -113,3 +116,3 @@ ? tsconf.config.files.map(p => path_1.default.resolve(absTsconfDirName, p)) // Get absolute path of files | ||
console.log(`Analyzing ${files.length} typescript files ...`); | ||
const { successFiles, errorFiles } = check_files_1.checkFiles(files, tsconf.config.compilerOptions); | ||
const { successFiles, errorFiles } = check_files_1.checkFiles(files, parsedTsConf.options); | ||
const newFilesToBeIncluded = successFiles.filter(f => !tsconfFiles.includes(f)); | ||
@@ -122,7 +125,7 @@ const brokenFiles = Object.keys(errorFiles).filter(f => tsconfFiles.includes(f)); | ||
// verbose(Object.keys(errorFiles).map(p => path.relative(absTsconfDirName, p)).join('\n')); | ||
console.log(`Include new files (${newFilesToBeIncluded.length}) to tsconf`); | ||
console.log(`\nInclude new files (${newFilesToBeIncluded.length}) to tsconf`); | ||
newFilesToBeIncluded.forEach(nf => { | ||
console.log(reporter_1.yellow(path_1.default.relative(absTsconfDirName, nf))); | ||
}); | ||
console.log(`Remaining ${files.length - newFilesToBeIncluded.length - tsconfFiles.length}/${files.length} files to be fixed`); | ||
console.log(`Remaining ${files.length - newFilesToBeIncluded.length - tsconfFiles.length}/${files.length} files to be fixed\n`); | ||
verbose(remainingFiles.map(p => `\t${path_1.default.relative(absTsconfDirName, p)}`).join('\n')); | ||
@@ -129,0 +132,0 @@ if (brokenFiles.length) { |
{ | ||
"name": "tscfc", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -10,3 +10,3 @@ #!/usr/bin/env node | ||
import { throwError, reportFileCheck, yellow } from "./reporter"; | ||
import { throwError, reportFileCheck, yellow, red } from "./reporter"; | ||
import { checkFiles } from "./check-files"; | ||
@@ -43,3 +43,2 @@ | ||
// TODO: Finish --js | ||
// TODO: Add --update | ||
process.exit(0); | ||
@@ -64,3 +63,5 @@ } | ||
let absTsconfDirName: string; | ||
let tsconfFilename: string; | ||
let tsconfFiles: string[]; | ||
let parsedTsConf: ts.ParsedCommandLine; | ||
@@ -86,3 +87,5 @@ if (conf.verbose) { | ||
verbose('Parsing tsconfig'); | ||
tsconf = ts.parseConfigFileTextToJson('test', file!.toString()); | ||
tsconfFilename = path.basename(absTsconfPath); | ||
tsconf = ts.parseConfigFileTextToJson(tsconfFilename, file!.toString()); | ||
parsedTsConf = ts.parseJsonConfigFileContent(tsconf.config, ts.sys, absTsconfDirName, undefined, tsconfFilename); | ||
tsconfFiles = tsconf.config.files | ||
@@ -114,3 +117,3 @@ ? tsconf.config.files.map(p => path.resolve(absTsconfDirName, p)) // Get absolute path of files | ||
console.log(`Analyzing ${files.length} typescript files ...`); | ||
const { successFiles, errorFiles } = checkFiles(files, tsconf.config.compilerOptions); | ||
const { successFiles, errorFiles } = checkFiles(files, parsedTsConf.options); | ||
@@ -126,3 +129,3 @@ const newFilesToBeIncluded = successFiles.filter(f => !tsconfFiles.includes(f)); | ||
console.log(`Include new files (${newFilesToBeIncluded.length}) to tsconf`); | ||
console.log(`\nInclude new files (${newFilesToBeIncluded.length}) to tsconf`); | ||
newFilesToBeIncluded.forEach(nf => { | ||
@@ -132,3 +135,3 @@ console.log(yellow(path.relative(absTsconfDirName, nf))); | ||
console.log(`Remaining ${files.length - newFilesToBeIncluded.length - tsconfFiles.length}/${files.length} files to be fixed`); | ||
console.log(`Remaining ${files.length - newFilesToBeIncluded.length - tsconfFiles.length}/${files.length} files to be fixed\n`); | ||
verbose(remainingFiles.map(p => `\t${path.relative(absTsconfDirName, p)}`).join('\n')); | ||
@@ -135,0 +138,0 @@ |
26129
486