UNPKG

2.29 kBTypeScriptView Raw
1import { Optional } from '@salesforce/ts-types';
2/**
3 * The name of the project config file.
4 *
5 * @ignore
6 */
7export declare const SFDX_PROJECT_JSON = "sfdx-project.json";
8/**
9 * Performs an upward directory search for an sfdx project file. Returns the absolute path to the project.
10 *
11 * **See** {@link SFDX_PROJECT_JSON}
12 *
13 * **See** {@link traverseForFile}
14 *
15 * **Throws** *{@link SfError}{ name: 'InvalidProjectWorkspaceError' }* If the current folder is not located in a workspace.
16 *
17 * @param dir The directory path to start traversing from.
18 * @ignore
19 */
20export declare function resolveProjectPath(dir?: string): Promise<string>;
21/**
22 * Performs a synchronous upward directory search for an sfdx project file. Returns the absolute path to the project.
23 *
24 * **See** {@link SFDX_PROJECT_JSON}
25 *
26 * **See** {@link traverseForFile}
27 *
28 * **Throws** *{@link SfError}{ name: 'InvalidProjectWorkspaceError' }* If the current folder is not located in a workspace.
29 *
30 * @param dir The directory path to start traversing from.
31 * @ignore
32 */
33export declare function resolveProjectPathSync(dir?: string): string;
34/**
35 * These methods were moved from the deprecated 'fs' module in v2 and are only used in sfdx-core above
36 *
37 * They were migrated into the 'traverse' constant in order to stub them in unit tests
38 */
39export declare const traverse: {
40 /**
41 * Searches a file path in an ascending manner (until reaching the filesystem root) for the first occurrence a
42 * specific file name. Resolves with the directory path containing the located file, or `null` if the file was
43 * not found.
44 *
45 * @param dir The directory path in which to start the upward search.
46 * @param file The file name to look for.
47 */
48 forFile: (dir: string, file: string) => Promise<Optional<string>>;
49 /**
50 * Searches a file path synchronously in an ascending manner (until reaching the filesystem root) for the first occurrence a
51 * specific file name. Resolves with the directory path containing the located file, or `null` if the file was
52 * not found.
53 *
54 * @param dir The directory path in which to start the upward search.
55 * @param file The file name to look for.
56 */
57 forFileSync: (dir: string, file: string) => Optional<string>;
58};