UNPKG

1.14 kBTypeScriptView Raw
1/**
2 * Typing for the fields of package.json we care about
3 */
4export interface PackageJson {
5 [key: string]: string | PackageJson;
6}
7/**
8 * A function that json from a file
9 */
10export interface ReadJsonSync {
11 (packageJsonPath: string): any | undefined;
12}
13export interface FileExistsSync {
14 (name: string): boolean;
15}
16export interface FileExistsAsync {
17 (path: string, callback: (err?: Error, exists?: boolean) => void): void;
18}
19export interface ReadJsonAsyncCallback {
20 (err?: Error, content?: any): void;
21}
22export interface ReadJsonAsync {
23 (path: string, callback: ReadJsonAsyncCallback): void;
24}
25export declare function fileExistsSync(path: string): boolean;
26/**
27 * Reads package.json from disk
28 *
29 * @param file Path to package.json
30 */
31export declare function readJsonFromDiskSync(packageJsonPath: string): any | undefined;
32export declare function readJsonFromDiskAsync(path: string, callback: (err?: Error, content?: any) => void): void;
33export declare function fileExistsAsync(path2: string, callback2: (err?: Error, exists?: boolean) => void): void;
34export declare function removeExtension(path: string): string;