type-coverage-core
Advanced tools
Comparing version 2.23.0 to 2.24.0
import { TypeCheckResult } from './interfaces'; | ||
export declare function getFileHash(file: string, enableCache: boolean): Promise<string>; | ||
export declare function saveCache(typeCheckResult: TypeCheckResult): Promise<void>; | ||
export declare function readCache(enableCache: boolean): Promise<TypeCheckResult>; | ||
export declare function saveCache(typeCheckResult: TypeCheckResult, dirName?: string): Promise<void>; | ||
export declare function readCache(enableCache: boolean, dirName?: string): Promise<TypeCheckResult>; |
@@ -18,8 +18,8 @@ "use strict"; | ||
} | ||
async function saveCache(typeCheckResult) { | ||
await mkdirIfmissing(); | ||
async function saveCache(typeCheckResult, dirName = defaultDirName) { | ||
await mkdirIfmissing(dirName); | ||
await writeFileAsync(path.resolve(dirName, 'result.json'), JSON.stringify(typeCheckResult, null, 2)); | ||
} | ||
exports.saveCache = saveCache; | ||
const dirName = '.type-coverage'; | ||
const defaultDirName = '.type-coverage'; | ||
function statAsync(p) { | ||
@@ -37,3 +37,3 @@ return new Promise((resolve) => { | ||
} | ||
async function mkdirIfmissing() { | ||
async function mkdirIfmissing(dirName = defaultDirName) { | ||
const stats = await statAsync(dirName); | ||
@@ -44,3 +44,3 @@ if (!stats) { | ||
} | ||
async function readCache(enableCache) { | ||
async function readCache(enableCache, dirName = defaultDirName) { | ||
if (!enableCache) { | ||
@@ -47,0 +47,0 @@ return { |
@@ -22,3 +22,3 @@ "use strict"; | ||
const sourceFileInfos = []; | ||
const typeCheckResult = await (0, cache_1.readCache)(lintOptions.enableCache); | ||
const typeCheckResult = await (0, cache_1.readCache)(lintOptions.enableCache, lintOptions.cacheDirectory); | ||
const ignoreFileGlobs = lintOptions.ignoreFiles | ||
@@ -170,3 +170,3 @@ ? (typeof lintOptions.ignoreFiles === 'string' | ||
if (lintOptions.enableCache) { | ||
await (0, cache_1.saveCache)(typeCheckResult); | ||
await (0, cache_1.saveCache)(typeCheckResult, lintOptions.cacheDirectory); | ||
} | ||
@@ -173,0 +173,0 @@ return { correctCount, totalCount, anys, program, fileCounts }; |
@@ -33,3 +33,3 @@ import * as ts from 'typescript'; | ||
*/ | ||
export declare type ProccessAny = (node: ts.Node, context: FileContext) => boolean; | ||
export type ProccessAny = (node: ts.Node, context: FileContext) => boolean; | ||
export interface LintOptions extends CommonOptions { | ||
@@ -43,2 +43,3 @@ files?: string[]; | ||
reportSemanticError: boolean; | ||
cacheDirectory?: string; | ||
} | ||
@@ -45,0 +46,0 @@ interface CommonOptions { |
{ | ||
"name": "type-coverage-core", | ||
"version": "2.23.0", | ||
"version": "2.24.0", | ||
"description": "A library to check type coverage for typescript code", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
58270
1631