config-file-ts
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -7,3 +7,3 @@ /** Return true if any files need compiling */ | ||
export declare function jsOutFile(tsFile: string, outDir: string): string; | ||
export declare function compileIfNecessary(sources: string[], outDir: string): boolean; | ||
export declare function compileIfNecessary(sources: string[], outDir: string, strict?: boolean): boolean; | ||
/** create a symlink, replacing any existing linkfile */ | ||
@@ -10,0 +10,0 @@ export declare function symLinkForce(existing: string, link: string): void; |
@@ -39,3 +39,3 @@ 'use strict'; | ||
function needsCompile(srcGlobs, outDir) { | ||
const files = srcGlobs.flatMap(src => glob.sync(src)); | ||
const files = srcGlobs.flatMap((src) => glob.sync(src)); | ||
const srcDestPairs = compilationPairs(files, outDir); | ||
@@ -46,3 +46,3 @@ return anyOutDated(srcDestPairs); | ||
function expectFilesExist(files) { | ||
const missing = files.find(file => !fs.existsSync(file)); | ||
const missing = files.find((file) => !fs.existsSync(file)); | ||
if (missing) { | ||
@@ -79,3 +79,3 @@ return false; | ||
*/ | ||
function compileIfNecessary(sources, outDir) { | ||
function compileIfNecessary(sources, outDir, strict = true) { | ||
if (needsCompile(sources, outDir)) { | ||
@@ -89,5 +89,5 @@ const compileResult = tsCompile(sources, { | ||
skipLibCheck: true, | ||
strict: true, | ||
strict, | ||
target: ts__default.ScriptTarget.ES2019, | ||
noEmitOnError: true | ||
noEmitOnError: true, | ||
}); | ||
@@ -172,3 +172,3 @@ if (compileResult) { | ||
function compilationPairs(srcFiles, outDir) { | ||
return srcFiles.map(tsFile => { | ||
return srcFiles.map((tsFile) => { | ||
return [tsFile, jsOutFile(tsFile, outDir)]; | ||
@@ -175,0 +175,0 @@ }); |
{ | ||
"name": "config-file-ts", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "types": "dist/index.d.ts", |
@@ -11,3 +11,3 @@ import glob from "glob"; | ||
export function needsCompile(srcGlobs: string[], outDir: string): boolean { | ||
const files = srcGlobs.flatMap(src => glob.sync(src)); | ||
const files = srcGlobs.flatMap((src) => glob.sync(src)); | ||
const srcDestPairs = compilationPairs(files, outDir); | ||
@@ -19,3 +19,3 @@ return anyOutDated(srcDestPairs); | ||
export function expectFilesExist(files: string[]): boolean { | ||
const missing = files.find(file => !fs.existsSync(file)); | ||
const missing = files.find((file) => !fs.existsSync(file)); | ||
if (missing) { | ||
@@ -55,3 +55,7 @@ return false; | ||
export function compileIfNecessary(sources: string[], outDir: string): boolean { | ||
export function compileIfNecessary( | ||
sources: string[], | ||
outDir: string, | ||
strict = true | ||
): boolean { | ||
if (needsCompile(sources, outDir)) { | ||
@@ -65,5 +69,5 @@ const compileResult = tsCompile(sources, { | ||
skipLibCheck: true, | ||
strict: true, | ||
strict, | ||
target: ts.ScriptTarget.ES2019, | ||
noEmitOnError: true | ||
noEmitOnError: true, | ||
}); | ||
@@ -160,3 +164,3 @@ if (compileResult) { | ||
): [string, string][] { | ||
return srcFiles.map(tsFile => { | ||
return srcFiles.map((tsFile) => { | ||
return [tsFile, jsOutFile(tsFile, outDir)]; | ||
@@ -163,0 +167,0 @@ }); |
Sorry, the diff of this file is not supported yet
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
36581
493