UNPKG

typed-jsonfile

Version:
62 lines (61 loc) 2.36 kB
import { FS } from 'jsonfile'; import { JsonValue, PackageJson, TsConfigJson } from 'type-fest'; export declare const readJsonFile: <T>(path: string, options?: ({ encoding?: string | null | undefined; flag?: string | undefined; throws?: boolean | undefined; fs?: FS | undefined; reviver?: ((key: any, value: any) => any) | undefined; } & { /** * Support reading .jsonc files * @default if path ends with .jsonc `true`, otherwise `false` */ jsonc?: boolean | undefined; }) | undefined) => Promise<T>; export declare const writeJsonFile: <T extends JsonValue>(path: string, object: T, options?: { encoding?: string | null | undefined; mode?: string | number | undefined; flag?: string | undefined; fs?: FS | undefined; EOL?: string | undefined; spaces?: string | number | undefined; replacer?: ((key: string, value: any) => any) | undefined; } | undefined) => Promise<void>; export declare const readPackageJsonFile: (path: string | { dir: string; }, options?: { encoding?: string | null | undefined; flag?: string | undefined; throws?: boolean | undefined; fs?: FS | undefined; reviver?: ((key: any, value: any) => any) | undefined; } | undefined) => Promise<PackageJson>; export declare const writePackageJsonFile: (path: string | { dir: string; }, packageJson: PackageJson, options?: { encoding?: string | null | undefined; mode?: string | number | undefined; flag?: string | undefined; fs?: FS | undefined; EOL?: string | undefined; spaces?: string | number | undefined; replacer?: ((key: string, value: any) => any) | undefined; } | undefined) => Promise<void>; export declare const readTsconfigJsonFile: (path: string | { dir: string; }, { errorTolerant, }?: { /** Whether try to ignore syntax errors * @default false */ errorTolerant?: boolean | undefined; }) => Promise<TsConfigJson>; export declare const writeTsconfigJsonFile: (path: string | { dir: string; }, tsconfigJson: TsConfigJson, options?: { encoding?: string | null | undefined; mode?: string | number | undefined; flag?: string | undefined; fs?: FS | undefined; EOL?: string | undefined; spaces?: string | number | undefined; replacer?: ((key: string, value: any) => any) | undefined; } | undefined) => Promise<void>;