merge-tsconfigs
Version:
Merge-tsconfigs is a CLI and node tool for merging tsconfig files into the exact tsconfig file you want 🛣️
153 lines (149 loc) • 7.69 kB
TypeScript
import * as type_fest_source_partial_deep from 'type-fest/source/partial-deep';
import * as typescript from 'typescript';
import { CompilerOptions } from 'typescript';
import { PartialDeep } from 'type-fest';
interface CompilerOptionOverrides {
[key: string]: string | boolean | string[] | undefined;
}
type PartialCompilerOptions = PartialDeep<CompilerOptions | CompilerOptionOverrides>;
interface ConfigOptions {
compilerOptions?: PartialCompilerOptions;
debug?: boolean;
out?: string;
tsconfigs?: string[];
exclude?: string[];
include?: string[];
path?: string;
isTesting?: boolean;
}
type LoggerParams = {
isDebugging?: boolean;
gap?: string;
emoji?: string;
name?: string;
};
interface TsConfig {
extends?: string;
compilerOptions?: PartialDeep<CompilerOptions>;
include?: string[];
exclude?: string[];
}
declare const logger: ({ isDebugging, emoji, gap, name }: LoggerParams) => (type: string) => (section: string) => (message: string) => (err: unknown) => void;
declare function resolveJSON(path: string, debug?: boolean): TsConfig;
declare const mergeConfigObjects: (tsconfig1: TsConfig, tsconfig2: TsConfig) => {
include?: string[] | undefined;
exclude?: string[] | undefined;
compilerOptions: {
[x: string]: string | number | boolean | string[] | (string | number)[] | typescript.PluginImport[] | typescript.ProjectReference[] | type_fest_source_partial_deep.PartialObjectDeep<typescript.MapLike<string[]>, {}> | type_fest_source_partial_deep.PartialObjectDeep<typescript.TsConfigSourceFile, {}> | null | undefined;
allowImportingTsExtensions?: boolean | undefined;
allowJs?: boolean | undefined;
allowArbitraryExtensions?: boolean | undefined;
allowSyntheticDefaultImports?: boolean | undefined;
allowUmdGlobalAccess?: boolean | undefined;
allowUnreachableCode?: boolean | undefined;
allowUnusedLabels?: boolean | undefined;
alwaysStrict?: boolean | undefined;
baseUrl?: string | undefined;
charset?: string | undefined;
checkJs?: boolean | undefined;
customConditions?: string[] | undefined;
declaration?: boolean | undefined;
declarationMap?: boolean | undefined;
emitDeclarationOnly?: boolean | undefined;
declarationDir?: string | undefined;
disableSizeLimit?: boolean | undefined;
disableSourceOfProjectReferenceRedirect?: boolean | undefined;
disableSolutionSearching?: boolean | undefined;
disableReferencedProjectLoad?: boolean | undefined;
downlevelIteration?: boolean | undefined;
emitBOM?: boolean | undefined;
emitDecoratorMetadata?: boolean | undefined;
exactOptionalPropertyTypes?: boolean | undefined;
experimentalDecorators?: boolean | undefined;
forceConsistentCasingInFileNames?: boolean | undefined;
ignoreDeprecations?: string | undefined;
importHelpers?: boolean | undefined;
importsNotUsedAsValues?: typescript.ImportsNotUsedAsValues | undefined;
inlineSourceMap?: boolean | undefined;
inlineSources?: boolean | undefined;
isolatedModules?: boolean | undefined;
jsx?: typescript.JsxEmit | undefined;
keyofStringsOnly?: boolean | undefined;
lib?: string[] | undefined;
locale?: string | undefined;
mapRoot?: string | undefined;
maxNodeModuleJsDepth?: number | undefined;
module?: typescript.ModuleKind | undefined;
moduleResolution?: typescript.ModuleResolutionKind | undefined;
moduleSuffixes?: string[] | undefined;
moduleDetection?: typescript.ModuleDetectionKind | undefined;
newLine?: typescript.NewLineKind | undefined;
noEmit?: boolean | undefined;
noEmitHelpers?: boolean | undefined;
noEmitOnError?: boolean | undefined;
noErrorTruncation?: boolean | undefined;
noFallthroughCasesInSwitch?: boolean | undefined;
noImplicitAny?: boolean | undefined;
noImplicitReturns?: boolean | undefined;
noImplicitThis?: boolean | undefined;
noStrictGenericChecks?: boolean | undefined;
noUnusedLocals?: boolean | undefined;
noUnusedParameters?: boolean | undefined;
noImplicitUseStrict?: boolean | undefined;
noPropertyAccessFromIndexSignature?: boolean | undefined;
assumeChangesOnlyAffectDirectDependencies?: boolean | undefined;
noLib?: boolean | undefined;
noResolve?: boolean | undefined;
noUncheckedIndexedAccess?: boolean | undefined;
out?: string | undefined;
outDir?: string | undefined;
outFile?: string | undefined;
paths?: type_fest_source_partial_deep.PartialObjectDeep<typescript.MapLike<string[]>, {}> | undefined;
preserveConstEnums?: boolean | undefined;
noImplicitOverride?: boolean | undefined;
preserveSymlinks?: boolean | undefined;
preserveValueImports?: boolean | undefined;
project?: string | undefined;
reactNamespace?: string | undefined;
jsxFactory?: string | undefined;
jsxFragmentFactory?: string | undefined;
jsxImportSource?: string | undefined;
composite?: boolean | undefined;
incremental?: boolean | undefined;
tsBuildInfoFile?: string | undefined;
removeComments?: boolean | undefined;
resolvePackageJsonExports?: boolean | undefined;
resolvePackageJsonImports?: boolean | undefined;
rootDir?: string | undefined;
rootDirs?: string[] | undefined;
skipLibCheck?: boolean | undefined;
skipDefaultLibCheck?: boolean | undefined;
sourceMap?: boolean | undefined;
sourceRoot?: string | undefined;
strict?: boolean | undefined;
strictFunctionTypes?: boolean | undefined;
strictBindCallApply?: boolean | undefined;
strictNullChecks?: boolean | undefined;
strictPropertyInitialization?: boolean | undefined;
stripInternal?: boolean | undefined;
suppressExcessPropertyErrors?: boolean | undefined;
suppressImplicitAnyIndexErrors?: boolean | undefined;
target?: typescript.ScriptTarget | undefined;
traceResolution?: boolean | undefined;
useUnknownInCatchVariables?: boolean | undefined;
resolveJsonModule?: boolean | undefined;
types?: string[] | undefined;
typeRoots?: string[] | undefined;
verbatimModuleSyntax?: boolean | undefined;
esModuleInterop?: boolean | undefined;
useDefineForClassFields?: boolean | undefined;
};
extends?: string | undefined;
};
declare const mergeConfigContent: (tsconfigs: string[], cwd: string, debug?: boolean) => TsConfig;
declare const writeTsconfig: (tsconfig: TsConfig, cwd: string, out: string, isTesting: boolean) => TsConfig;
declare const updateCompilerOptions: (compilerOptions: PartialCompilerOptions | undefined, currentCompilerOptions: PartialCompilerOptions, updatedPath: CompilerOptions['paths']) => PartialCompilerOptions;
declare const parsePath: (path?: string, debug?: boolean) => CompilerOptions['paths'];
declare const mergeTsConfigs: ({ tsconfigs, exclude, include, compilerOptions, debug, out, path, isTesting, }: ConfigOptions) => TsConfig | undefined;
declare const script: ({ tsconfigs, exclude, include, compilerOptions, debug, out, path, isTesting, }: ConfigOptions) => TsConfig | undefined;
export { mergeTsConfigs as default, logger, mergeConfigContent, mergeConfigObjects, mergeTsConfigs, parsePath, resolveJSON, script, updateCompilerOptions, writeTsconfig };