UNPKG

@tochii/tsconfig-aliases

Version:

Generate path aliases designed for monorepos and structured projects

108 lines (92 loc) 2.35 kB
// ---- index.d.mts ---- declare const defaultTsConfigAliasesOptions: Required<TsConfigAliasesOptions>; declare function tsconfigAliases(options?: TsConfigAliasesOptions, loggerOptions?: LoggerOptions<TransportOptions>): { outFile: string; outDir: string; fullPath: string; backupDir: string; newPaths: string[]; oldPaths: Record<string, string[]> | undefined; }; export { tsconfigAliases as default, defaultTsConfigAliasesOptions, tsconfigAliases }; // ---- types.d.ts ---- interface TsConfigAliasesOptions { /** * Filter out directories that don't contain these files * * Globs are supported * * @default ['package.json', 'tsconfig.*.json'] */ match?: string[]; /** * When set to `true` it will overwrite matching aliases with and without the prefix * * @default true */ loose?: boolean; /** * The prefix to add to the aliases * * @default '@/' */ prefix?: string; /** * The suffix to add to the aliases * * @default '/*' */ suffix?: string; /** * The root directory (can be relative) * * NOTE: If relative, it's resolved against the currently running process's working directory * * @default The current working directory */ root?: string; /** * The directories to scan * * @default ['.'] */ dir?: string[]; /** * Directories to skip * * @default ['node_modules'] */ skip?: string[]; /** * Output file * * Can be absolute or relative * * @default 'tsconfig.aliases.json' */ out?: string; /** * Maximum number of backups to keep * * @default 5 */ maxBackups?: number; /** * Backup directory * * @default The current working directory + '/.tsconfig.aliases.backup' */ backupDir?: string; /** * Folder names of where packages are located in the monorepo * * @default ['packages'] */ packages?: string[]; /** * Whether to enable logging and which level * * @default `trace` */ verbose?: 'fatal' | 'error' | 'warn' | 'info' | 'debug' | 'trace' | 'off'; }